Skip to content

[Angular 21] PWA, e2e parity suite and CI - #959

Merged
devin-ai-integration[bot] merged 3 commits into
devin/angular21-basefrom
devin/angular21-pwa-e2e-ci
Nov 19, 2026
Merged

devin-ai-integration[bot] merged 3 commits into
devin/angular21-basefrom
devin/angular21-pwa-e2e-ci

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

Restores the PWA on Angular 21, replaces the removed Protractor e2e with a Playwright parity suite that runs the same specs against legacy (Angular 9, master) and Angular 21, and adds GitHub Actions CI. Part of the 5-session Angular 21 migration. The other sessions are porting feeds, the story page, the user profile and header/footer/settings.

PWA

  • app.config.ts: provideServiceWorker('ngsw-worker.js', { enabled: !isDevMode(), registrationStrategy: 'registerWhenStable:30000' }), with @angular/service-worker@^21.2.
  • angular.json production config: "serviceWorker": "ngsw-config.json", using the existing config and src/manifest.json.
  • ngsw-config.json prefetched /manifest.webmanifest, but that file does not exist on master or here. It now prefetches /manifest.json, the real manifest. I removed the dead <link rel="manifest" href="manifest.webmanifest"> and the #1976d2 theme-color meta left behind by ng add @angular/pwa from index.html.
  • pwa.spec.ts proves the production build serves a working worker in both apps: manifest served, ngsw.json built from the config, ngsw-worker.js registered and controlling the page, and the app shell loading with the network offline.

Parity suite (parity/)

  • It has its own package.json, so Playwright does not touch the app's lockfile. One playwright.config.ts defines two projects: legacy on :4000 and angular21 on :4200.
  • Both projects run production builds, so the PWA spec runs against both. scripts/serve-legacy.sh creates a worktree of origin/master in .parity-legacy/, runs nvm use 14 and ng build --prod. scripts/serve-angular21.sh runs nvm use 24 and ng build. Both serve the build through a dependency-free SPA static server. Playwright starts only the servers for the selected projects and reuses servers that are already running.
  • Hacker News API calls are answered from recorded fixtures/, so both apps render the same data and the specs can assert exact text. PARITY_LIVE=1 switches to the live API.
  • Specs check what a user sees: feeds and pagination, header nav, the jobs header, the story page with its full comment tree and collapse/expand, the user profile, the settings popup, the theme toggle (backdrop colour, persisted across reload), open links in a new tab, font size and list spacing.

CI: .github/workflows/ci.yml runs on PRs (and on pushes to master / devin/angular21-base). It uses Node from .nvmrc (24) and runs npm ci, the production build, a check that ngsw-worker.js and ngsw.json exist, and npm test -- --watch=false.

Results

Project Result
legacy 22/22 passed (also from a fresh worktree via serve-legacy.sh; live API: 17 passed, 5 fixture-only skipped)
angular21 3/22 passed (pwa.spec.ts). The other 19 fail because feeds, story, user and header/settings are still placeholders on devin/angular21-base. This is expected until those PRs merge.
Unit tests (ng test) 2/2 passed

How to run the suite

cd parity
nvm use 24            # npm on Node 22 crashes on install
npm ci
npx playwright install chromium

npx playwright test                       # both projects (starts legacy :4000 and angular21 :4200)
npx playwright test --project=legacy
npx playwright test --project=angular21
npx playwright show-report report/html

Useful environment variables:

  • LEGACY_DIR=/path/to/master-checkout reuses an existing master checkout.
  • PARITY_NO_SERVER=1 uses servers you started yourself.
  • PARITY_LIVE=1 uses the live API.

Details are in parity/README.md.

Needs a decision

  • Legacy user profile is broken against the live API. node-hnapi no longer serves /user/:id. With fixtures, both apps get the same user. In live mode the suite forwards the legacy call to api.hnpwa.com/v0/user/:id.json, the endpoint the Angular 21 base already uses. master itself is not changed.
  • Pluralisation. Legacy renders 1 comment (singular), and the base pipe keeps that. The specs assert legacy behaviour.
  • .travis.yml (Node 6.9, Firebase deploy from master) is left untouched. Delete it or port it to Actions?
  • CI does not run the parity suite yet. Adding an angular21 parity job makes sense once the feature PRs land.

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/dac47e7b0bbc45db81e29beff9221705
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/dac47e7b0bbc45db81e29beff9221705?variant=devin


Devin Review

devin-ai-integration Bot and others added 3 commits November 19, 2026 14:07
…ceWorker

Co-Authored-By: danial.asaria <danialasaria@gmail.com>
…lar21

Co-Authored-By: danial.asaria <danialasaria@gmail.com>
Co-Authored-By: danial.asaria <danialasaria@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

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

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​angular/​service-worker@​21.2.261001007598100
Added@​types/​node@​24.19.21001008194100
Added@​playwright/​test@​1.65.110010010099100

View full report

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Devin Review found 4 potential issues.

Custom reviewers

  • ✨ Blast Radius Reviewer: no findings · View
  • 🛡️ API Security Reviewer: 1 finding · View

Devin Review

Comment thread src/app/app.config.ts
Comment on lines +19 to +22
provideServiceWorker('ngsw-worker.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000',
}),

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🟡 New contributor absent from credits

After adding the PWA, README.md still omits this PR's contributor from its contributors list. The contribution rule requires an entry for each contributor.

Learn more

The contributor list is separate from the application code. CONTRIBUTING.md asks each contributor to add themselves there, and this PR introduces the PWA and parity suite without changing that list.

Example: A reader checks the README after this PR lands and finds no entry for its contributor, Devin AI.

Recommended fix: Add the contributor's preferred credit to the README contributors section as part of this PR.

Devin Review


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

Comment on lines +10 to +13
if [ ! -d "$LEGACY_DIR" ]; then
git -C "$REPO_DIR" fetch origin master
git -C "$REPO_DIR" worktree add --detach "$LEGACY_DIR" origin/master
fi

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🔍 Legacy comparisons can remain on old master

On subsequent runs, serve-legacy.sh neither updates the worktree nor rebuilds its existing output. REBUILD=1 rebuilds the old checkout, so parity results can silently target an outdated master.

Devin Review


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

Comment on lines +22 to +25
const urlPath = decodeURIComponent(new URL(req.url, 'http://localhost').pathname);
let file = path.join(root, path.normalize(urlPath));
if (!file.startsWith(root) || !fs.existsSync(file) || fs.statSync(file).isDirectory()) {
file = path.extname(urlPath) ? null : path.join(root, 'index.html');

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🟥 Encoded traversal exposes sibling build files

A request containing ..%2f can make file resolve outside root into a sibling with the same prefix. startsWith(root) accepts that sibling, so anyone reaching the parity server can read its files.

Devin Review


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

};

http.createServer((req, res) => {
const urlPath = decodeURIComponent(new URL(req.url, 'http://localhost').pathname);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🛡️ API Security Reviewer: Low — Single-request parity server denial of service

A reachable attacker can terminate either parity server with GET /%, because decodeURIComponent throws outside an exception handler. listen(port) binds all interfaces, exposing this crash to other hosts wherever network access permits.

View in Devin Review · Custom reviewer

Devin Review


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

@devin-ai-integration
devin-ai-integration Bot merged commit b53f3d8 into devin/angular21-base Nov 19, 2026
6 checks passed
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