Skip to content

feat: cut over to the React PWA (integrate #932–#936, Workbox SW, Playwright e2e) - #937

Open
eashansinha wants to merge 23 commits into
masterfrom
devin/1794419120-react-cutover
Open

eashansinha wants to merge 23 commits into
masterfrom
devin/1794419120-react-cutover

Conversation

@eashansinha

@eashansinha eashansinha commented Nov 11, 2026 •

Copy link
Copy Markdown

Summary

Phase 3 of the Angular → React migration. Branch is based on react-migration/1794416868-trunk and merges all five slice branches (#932 foundation, #934 app shell, #936 feeds, #935 item details, #933 user profile), then cuts the repo over to the React app.

  • Integration: the only conflict was src/routes.test.tsx (feat(react): port user profile page (/user/:id) #933 vs feat(react): port feeds (FeedPage + FeedItem) with pagination #936). I kept feat(react): port feeds (FeedPage + FeedItem) with pagination #936's feed-route assertions and every slice's own tests. 73 unit tests pass.
  • React app moved to repo root (not kept in react-app/): with Angular removed, the React app is the only project. Keeping it at the root keeps firebase.json, CI and Travis simple and avoids setting a working-directory everywhere. Deleted: Angular src/, angular.json, karma/protractor/tslint/tsconfig.*, ngsw-config.json, yarn.lock and the Angular deps. Static assets moved unchanged from src/assets to public/assets.
  • PWA parity (vite-plugin-pwa generateSW → dist/sw.js):
    • precache = the ngsw app group (index.html, JS, CSS, favicon, manifest) + assets/** (lazy in ngsw; precached here because it's only ~350 KiB in total)
    • navigateFallback: '/index.html' → deep links (/item/123, /newest/1) load offline
    • no API data caching, same as ngsw (it had no dataGroups)
    • index.html head and body restored from the Angular one: meta, icons, /manifest.json, theme #b92b27, the #skip link, and an empty #root followed by a sibling .app-loader#content so the #root:empty + .app-loader startup logo shows before React mounts. Dropped the dead manifest.webmanifest link and the duplicate CLI-default #1976d2 theme-color.
  • Analytics parity: RouteAnalytics mirrors Angular's NavigationEnd handler (ga('set','page', url); ga('send','pageview')) on the first load and on every client-side navigation. The redirect-only / route is skipped, so you get the equivalent of urlAfterRedirects.
  • Hosting/CI: firebase.json serves dist/ with an SPA rewrite and no-cache on sw.js/index.html. .github/workflows/ci.yml runs lint, unit tests, build and a Playwright e2e job. .travis.yml now builds with Node 24 and keeps the Firebase deploy.
  • e2e (e2e/app.spec.ts; desktop and Pixel 7 Chromium; runs against vite preview of the production build; API mocked via context.route): feed load and paging, item with nested comments and collapse, user page (mocked, because the live /user/:id 404s), AMOLED theme persists across reload, startup loader before mount, and offline reload plus an uncached deep link served by the SW.
  • README/CONTRIBUTING rewritten for the React app.

Unchanged on purpose, to match Angular: the settings cog doesn't close an open panel; the header overlaps at 320px; the skip link targets the loader; there is no catch-all route, so bare /newest or unknown URLs leave the loader showing.

The slice PRs #932–#936 can be closed once this lands. Or merge them into trunk first; either way, this PR already contains them.

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/9bcb935af0524ad78339307f809ed1d2
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/9bcb935af0524ad78339307f809ed1d2?variant=devin
Requested by: @eashansinha


Devin Review (Staging)

devin-ai-integration Bot and others added 19 commits November 11, 2026 17:12
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Devin Bot

Repo: COG-GTM/angular2-hn (Angular 9 Hacker News PWA). The user asked: "let's spin up multiple devins to execute on an angular to react migration in @COG-GTM/angular2-hn". You are Phase 3 (integration + cutover) of a multi-session migration. Earlier sessions built the React app in react-app/ across these green PRs, all targeting the integration branch react-migration/1794416868-trunk:

  • #932 foundation (Vite + React + TS, API client, settings, routes, styles)
  • #934 app shell (header/footer/settings)
  • #936 feeds
  • #935 item details + comments
  • #933 user profile (adds dompurify)
    They may or may not be merged into the trunk branch yet. Do not merge PRs yourself.

Deliverable: one PR into master from a new branch based on react-migration/1794416868-trunk that:

  1. Combines all five PRs' branches (merge them into your branch), resolving conflicts (several edit react-app/src/routes.test.tsx; #933 changes package.json/lockfile). Keep every slice's tests.
  2. Makes the React app a PWA equivalent to the current one: service worker precaching / app shell offline support and manifest/icons, matching what ngsw-config.json, src/manifest.json and index.html do today.
  3. Cuts over hosting and CI: firebase.json serves the React build, CI builds/tests the React app, and the Angular app, its config and its dependencies are removed (move the React app to the repo root or keep react-app/, your call; explain it).
  4. Adds a small Playwright e2e suite covering: feed load + paging, opening an item with comments, user page, settings theme change persisting across reload, and offline reload after first visit.
  5. Updates README for the React app.
    Behavior must stay the same as the Angular app; known Angular-parity quirks (settings cog doesn't close the open panel; 320px header overlap) are out of scope, leave them. Note: the live node-hnapi /user/:id endpoint currently 404s for every user, so test the user page with mocked responses. Gotcha on Devin VMs: the default Chrome profile (C... (366 chars truncated...)

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 3 potential issues.

2 code quality issues are available in Devin Review only.

Devin Review (Staging)

Debug

Playground

Comment thread vite.config.ts
manifest: false,
registerType: 'autoUpdate',
injectRegister: 'auto',
filename: 'sw.js',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Existing PWA installations remain on Angular

After deployment, users controlled by ngsw-worker.js keep receiving its cached Angular shell instead of registering sw.js. Its update manifest is gone, and the hosting rewrite serves React HTML for /ngsw.json, so the old worker cannot upgrade.

Learn more

The production Angular app registered a root-scoped ngsw-worker.js and precached /index.html through its app asset group. A browser already controlled by that worker can continue receiving its cached Angular HTML on every navigation. This deployment replaces the build output with React assets and sw.js, removing /ngsw.json; the SPA rewrite sends React HTML for that missing manifest instead. The old worker cannot obtain a valid Angular update, and React's registration code never runs in the cached Angular page.

Example: Alice installed the production Angular PWA last week. After this deployment, she opens the app online; ngsw-worker.js serves her old index and requests /ngsw.json, which now responds with React HTML. She remains on Angular instead of receiving the React app.

Recommended fix: Provide an explicit migration path for existing root-scoped ngsw-worker.js registrations. For example, make /ngsw.json return a genuine 404 rather than the SPA fallback so Angular can retire its worker, and verify the transition with a browser profile controlled by the old production worker before deploying.

Devin Review (Staging)


Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Comment thread src/styles/global.scss Resolved
Comment thread src/App.tsx Resolved
devin-ai-integration Bot and others added 3 commits November 11, 2026 17:58
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

2 code quality issues are available in Devin Review only.

Devin Review (Staging)

Debug

Playground

Comment thread index.html
<app-root></app-root>

<div id="root"></div>
<div class="app-loader" id="content">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Skip link lands on hidden loader

After React mounts, the skip link targets #content, which now sits outside #root as a hidden loader. Keyboard users cannot skip to the application.

Learn more

The skip link near the start of the body points to #content. Before the app mounts, the target is the loading element; after mounting, the CSS in the loader styles hides that element. The rendered app lives in the preceding #root, so the anchor no longer targets the content users want to reach.

Example: A keyboard user presses Tab and activates “skip to navigation” after the feed loads. The browser follows #content to the hidden loading element rather than moving into the feed or header.

Recommended fix: Place the persistent #content target around the rendered application, or move the skip link's target into the application after mount while retaining a useful target before mount. Keep the loader as a separate sibling so the #root:empty + .app-loader selector still works.

Devin Review (Staging)


Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Comment thread src/components/RouteAnalytics.tsx Resolved
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 finding. Devin automatically fixed it.

Fixed by Devin (1)
  • Homepage visits count as two pageviews — RouteAnalytics skips the redirect-only / route, matching Angular's urlAfterRedirects; test asserts one pageview for /news/1.

View findings in Devin Review · Follow Devin's work

Devin Review

@devin-ai-integration

Copy link
Copy Markdown

Browser verification: live API and offline PWA

Tested the production vite preview build in Chrome with a clean profile, against live node-hnapi data.

  • Feed paging (More/Prev) works, and new, show, ask and jobs each load their own items.
  • Nested comments on a live item collapse and expand.
  • The user endpoint 404s upstream; the page shows an error and the shell stays intact. The profile happy path is covered by the mocked Playwright test.
  • Night and AMOLED themes, font size and the open-links-in-new-tab setting all survive a reload.
  • DevTools detects the manifest and icons. sw.js is activated and controlling the page.
  • Offline, a reload and a never-visited /item/:id deep link both render the app shell from the SW, and the API errors show as expected. No API responses are in the Workbox caches, which matches Angular.
  • Bare /newest (no page number) is a routing gap that already exists in Angular, not a regression.
  • npx playwright test: all passing on desktop and Pixel 7 Chromium, in CI and locally.

The manual browser run used the build from before the last loader and GA commits. Those commits are covered by unit and e2e tests.

Live feed Nested comments
feed comments
Persisted AMOLED settings Offline shell
settings offline

Recording:
recording

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant