Skip to content

MBA-3267: migrate angular2-hn from Angular 9 to React (final integration) - #907

Closed
devin-ai-integration[bot] wants to merge 21 commits into
masterfrom
devin/mba-3267-react-integration
Closed

devin-ai-integration[bot] wants to merge 21 commits into
masterfrom
devin/mba-3267-react-integration

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

MBA-3267 — final integration: angular2-hn is now a React 19 app

Jira: MBA-3267

Final wave of the Angular 9 → React migration. Branched from the foundation branch, merged the five Wave 2 branches locally (--no-ff, no conflicts), then cut over to the repo root.

Supersedes

This PR supersedes and replaces all child PRs of this run. Close them, don't merge them:

Duplicate work: open PRs #889 and #896–#900 come from another concurrent run of the same migration. Only one set should land.

What changed

  • Cutover: react-app/* moved to the repo root with git mv (history kept). Angular is gone: src/app/**, main.ts, polyfills.ts, test.ts, environments/, typings.d.ts, styles.scss, old index.html/manifest.json, angular.json, ngsw-config.json, karma.conf.js, Protractor e2e/, tsconfig.app.json/tsconfig.spec.json (Angular versions), tslint.json, browserslist, yarn.lock, the old package.json, and .travis.yml. package.json and package-lock.json contain no @angular/*, rxjs, zone.js, karma*, protractor or tslint* packages (checked with grep).
  • CI: .travis.yml is replaced by .github/workflows/ci.yml at the root. It runs lint, format:check, typecheck, unit tests and build, plus a Playwright e2e job against the production build. No react-app working directory or path filters remain.
  • Deploy: .github/workflows/deploy.yml deploys to Firebase Hosting on push to master (or by manual dispatch). It only runs when the FIREBASE_SERVICE_ACCOUNT/FIREBASE_TOKEN secrets exist, and the check runs inside the production environment job. It was not run.
  • Firebase: the root firebase.json keeps the database rules and hosts dist/. It has a SPA rewrite for routes and extensionless paths (dotted /user/foo.bar included). Missing static files return 404 instead of index.html. It also carries the PWA cache headers. .firebaserc and database.rules.json are kept.
  • e2e: the 9 test.fixme integration-wave specs are enabled and pass against the real components. New e2e/integration.spec.ts covers:
    • title font size, list spacing and open-in-new-tab, set through the real settings popup, then persisted and reloaded (item-details titles stay at 16px)
    • Escape closes the popup and returns focus to the cog
    • username links in feeds and in comments go to /user/:id
  • Docs: README rewritten (stack, setup, scripts, ports, themes, PWA, deploy). CONTRIBUTING updated. MIGRATION.md is now a short architecture/migration notes doc: the Wave ownership map is gone, the traps are kept.
  • Angular's safety public/ngsw-worker.js is kept. It retires the old Angular service worker for returning visitors.

Checks (root)

npm ci && npm run lint && npm run format:check && npm run typecheck && npm test && npm run build && npm run e2e
lint ✓ · format:check ✓ "All matched files use Prettier code style!" · typecheck ✓
vitest: Test Files 18 passed (18) · Tests 220 passed (220)
vite build ✓ · PWA precache 14 entries (410.51 KiB), dist/sw.js + workbox-*.js
playwright: 33 passed

Firebase hosting emulator (firebase-tools@14 emulators:start --only hosting, serving dist/):

  • /, /news/2, /item/8863, /user/pg, /user/foo.bar → 200 index.html
  • /sw.js, /ngsw-worker.js, /manifest.webmanifest, /index.html → no-cache. The manifest is served as application/manifest+json.
  • /assets/*.js and workbox-*.js → max-age=31536000, immutable. Icons → max-age=86400.
  • /assets/missing.js and /missing.png → 404 (not rewritten)

Devin Review follow-up

  • The service-worker warm-up now retries failed or non-2xx requests instead of marking them as warmed (95b78f0).

Documented deviations (kept on purpose)

  • Unknown URLs keep the URL and show an empty shell.
  • The React User model uses HNPWA's created_time (node-hnapi /user returns 404 for everyone).
  • Escape closes settings (a React addition).
  • New-tab links use rel="noopener noreferrer".
  • Google Analytics (Universal Analytics UA-66348622-3) is not ported. Google has shut down UA, so its hits are no longer processed. See MIGRATION.md.
  • HTTP errors, error bodies, null/non-JSON user bodies and invalid ids show an error, never an endless loader.

Angular quirks kept for parity

  • .head-margin never applies.
  • Replies under deleted comments are hidden.
  • "1 points" is not pluralised.
  • On first visit the theme comes from prefers-color-scheme and is persisted, and it follows live scheme changes.
  • titleFontSize only affects feed titles.

Known security finding

Snyk: deepmerge comes in through workbox-build (from vite-plugin-pwa) and cannot be fixed upstream yet. It is a build-time dependency only.

Devin-Org: engineering

devin-ai-integration Bot and others added 20 commits October 20, 2026 20:46
…ary, routing placeholders, CI, MIGRATION.md contract

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…ze HN-relative links in sanitizeHtml

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…ature modules

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…ase hosting for React

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
… params get offline shell, no SPA rewrite for static files

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…back button

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…he real components

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
…egration e2e

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
… e2e

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: Ishita Gupta <ishita.gupta@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

End-to-end UI testing (MBA-3267 final integration)

What was tested: React revision 2daa87d as a production build (vite preview on :4173) and the Angular origin/master reference (on :4300), both against the live HN APIs. Angular is on the left of each screenshot, React on the right.

Limitations

  • The later 95b78f0 commit (service-worker warm-up retry) was not part of this UI run. It is covered by new unit tests, and e2e/offline.spec.ts plus e2e/pwa.spec.ts passed on 95b78f0.
  • Angular user-profile parity could not be compared. Angular's original node-hnapi /user/* returns an error for every user, while React profiles load through HNPWA.

Results

  • All five feeds load. More/Prev pagination works on every feed (page 2 starts at item 31, Prev returns to item 1). Header active states are correct. The jobs feed shows the YC header and no author/points/comments line.
  • Item 8863 renders its deep nested comments, and collapse/expand works. Ask/text posts, a 3-option poll with nonzero bars, job items and the unknown-item error all render.
  • Profiles render for pg (with about), test (no about) and an unknown user (error). Real username links in feeds (pcai) and in comments (BrandonM) open /user/:id.
  • Settings popup: open, close, initial focus, Tab/Shift+Tab focus trap, and Escape closing with focus returned to the cog all work.
  • Default, Night and AMOLED themes persist after reload.
  • Font size 20 and list spacing 12 apply to feed items and persist. Item-detail titles stay at 16px.
  • Open-in-new-tab, checked in a fresh Chrome profile: links have target="_blank" rel="noopener noreferrer" and a click opens a second page.
  • 375px and 1280px feed/item layouts match Angular. Desktop scrollbar gutters are 15px in both, and the header x/width match.
  • PWA: the manifest shows no installability errors, and the service worker activates and controls the page. Cached feed, item and profile reload with service-worker network requests aborted through CDP.
  • No React functional or parity bug was found.

Continuous runtime recording

Desktop feed, Angular left / React right

Mobile nested comments, Angular left / React right

Full-page comparisons (375 / 1280) and PWA

Feed 375
Feed 1280
Item 375
Item 1280
User 375 (Angular user API errors)
User 1280 (Angular user API errors)
PWA manifest + activated SW
Settings persisted
Offline profile

Written by Devin

@devin-ai-integration

Copy link
Copy Markdown
Author

Closing as part of the nightly demo-repo reset — reopen if this demo artifact is still needed.

@devin-ai-integration
devin-ai-integration Bot deleted the devin/mba-3267-react-integration branch November 9, 2026 13:05
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.

0 participants