Skip to content

test(web): track every page's Lighthouse results over time and flag regressions - #355

Merged
botandbang merged 5 commits into
mainfrom
bnb/lighthouse-history
Nov 1, 2026
Merged

botandbang merged 5 commits into
mainfrom
bnb/lighthouse-history

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

What and why

Pull requests measured 3 pages against fixed budgets, with no history, so slow drift and signed-in pages went unseen. Added: lighthouse/pages.json (41 pages, signed out or as neon.test/ada.test, with a schema), scripts/lighthouse.ts (one network start, Playwright sign-in, lhci collect per page on phone and desktop, 3 runs each, existing budgets), scripts/lighthouse-history.ts with scripts/lib/lighthouse.ts (per-page medians in a JSON Lines history; fails on a regression past each metric's tolerance against the last 5 runs, or a bad result: failed run, redirect, error status, failed budget; notes slow creep, unstable runs and machine or Lighthouse changes), pnpm test:lighthouse:full, and weekly jobs in web-scheduled.yml that keep main's history as the lighthouse-history artifact and open an issue through scheduled-issue.yml when they fail. lighthouserc.cjs now takes its pages from the list (the ones marked pr).

Changed: the production build on the local network couldn't be signed in. adapter-node 6 treats requests as https, so the CSRF check refused the form; dev-network.ts --production now sets PROTOCOL_HEADER. And the OAuth client refused http PDSes outside dev; it now allows them when ALLOW_PRIVATE_NETWORK is set. The e2e sign-in helper moved to tests/sign-in.ts so both use it.

The history job reads history only from this workflow's own scheduled or hand-started runs on main, unpacked into an empty directory with just the history file copied out, so a fork's pull request can't plant one. The Lighthouse jobs share the e2e tests' changes gate from #352; a skipped week only uploads the history again so it doesn't expire.

Signed-in pages aren't held to an SEO budget. The first weekly runs will report the existing bad results (8 public pages without a meta description, and layout shift on 5 pages) until they're fixed separately.

How it was tested

Unit tests for the comparison and summaries, checked by breaking the logic on purpose; an OAuth test that fails without the allowHttp change. A full local run: all 41 pages on both form factors, 3 runs each. Chromium e2e: one failure that also fails on main. Coverage, lint, type check, knip, actionlint, zizmor and tools/policy.sh pass. The weekly jobs and the artifact hand-off only run on GitHub.

adapter-node 6 takes every request to be https unless PROTOCOL_HEADER
names a header that says otherwise, so SvelteKit's CSRF check refused
the sign-in form posted from http://127.0.0.1. dev-network.ts
--production now sets PROTOCOL_HEADER=x-forwarded-proto.

The OAuth client also refused the network's http PDS outside dev. It now
allows http when ALLOW_PRIVATE_NETWORK is set, which is already what lets
the production build reach a loopback PDS.
lighthouse/pages.json lists the pages to measure, each signed out or
signed in as a seeded account, and lighthouserc.cjs takes its pull
request pages from it. `pnpm test:lighthouse:full` starts the network
once, signs in with Playwright, and runs lhci collect on every page on a
phone and a desktop against the existing budgets. scripts/lighthouse-history.ts
then holds each page's medians against the last five recorded runs and
fails on a regression past a metric's tolerance or on a bad result (a
failed run, a redirect, an error status, a failed budget).

The e2e sign-in helper moves to tests/sign-in.ts so both use it.
Web scheduled runs scripts/lighthouse.ts in one job per form factor,
then compares their summaries with main's history in a job that installs
nothing. The history is the lighthouse-history artifact, which each run
on main downloads, adds to and uploads again. A regression or bad result
fails the run, which opens the scheduled-failure issue.
…n main

The history job took the newest lighthouse-history artifact from any run
whose head branch was named main, which a pull request from a fork with
a branch of that name also has, and unpacked it over apps/web, where it
could replace the script the job runs next. It now only looks at this
workflow's scheduled and hand-started runs in this repository, unpacks
each into an empty directory, and copies out the history file alone.
# Conflicts:
#	.github/workflows/web-ci.yml
#	.github/workflows/web-scheduled.yml
@botandbang
botandbang requested a review from bnb as a code owner November 1, 2026 16:23
@github-actions github-actions Bot added documentation Improvements or additions to documentation github_actions Pull requests that update GitHub Actions code web The Local Network website (apps/web) web: accounts Signing in, sessions and the account pages web: server Spaces, sync, HappyView, the database and the server around them tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings labels Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Coverage Report for apps/web

Status Category Percentage Covered / Total
🟢 Lines 95.43% (🎯 93%)
🟰 ±0 pp
7916 / 8295
🟢 Statements 94.08% (🎯 91%)
⬇️ -0.01 pp
12052 / 12810
🟢 Functions 94.18% (🎯 92%)
⬇️ -0.03 pp
3125 / 3318
🟢 Branches 84.72% (🎯 80%)
⬆️ +0.01 pp
5623 / 6637
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/web/src/lib/server/atproto/oauth.ts 91.86%
🟰 ±0 pp
88.88%
⬆️ +0.51 pp
93.1%
🟰 ±0 pp
90.9%
🟰 ±0 pp
244, 308, 315-317, 328-331
Generated in workflow #33 for commit 144fe70 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Client JavaScript 680.7 KiB 680.7 KiB 0 B (0%)
Client JavaScript, brotli 226.8 KiB 226.8 KiB 0 B (0%)
Client CSS 89.6 KiB 89.6 KiB 0 B (0%)
Client CSS, brotli 12.9 KiB 12.9 KiB 0 B (0%)

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Coverage Report for apps/localtoolbox

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 100%)
🟰 ±0 pp
4303 / 4303
🟢 Statements 99.64% (🎯 95%)
🟰 ±0 pp
5862 / 5883
🟢 Functions 99.65% (🎯 95%)
🟰 ±0 pp
1715 / 1721
🟢 Branches 97.72% (🎯 50%)
🟰 ±0 pp
2791 / 2856
File CoverageNo changed files found.
Generated in workflow #33 for commit 144fe70 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Packaged (localtoolbox.zip) 366.1 KiB 366.1 KiB -10 B (-0%)
Unpacked (dist/) 842.8 KiB 842.8 KiB 0 B (0%)

@botandbang

Copy link
Copy Markdown
Contributor Author

Closing and reopening so CI runs against current main (with #353's CodeQL fix). Branch unchanged.

@botandbang botandbang closed this Nov 1, 2026
@botandbang botandbang reopened this Nov 1, 2026
@botandbang botandbang closed this Nov 1, 2026
@botandbang botandbang reopened this Nov 1, 2026
@botandbang
botandbang enabled auto-merge November 1, 2026 16:50
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Rust coverage

From run 33. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.39% (84408/86668) 96.53% (13504/13989) 95.67% (185844/194265)
Hegel property tests alone 95.38% (82660/86668) 94.09% (13162/13989) 93.46% (181551/194265)

@botandbang
botandbang added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit acbcdbc Nov 1, 2026
68 of 99 checks passed
@botandbang
botandbang deleted the bnb/lighthouse-history branch November 1, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation github_actions Pull requests that update GitHub Actions code tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings web: accounts Signing in, sessions and the account pages web: server Spaces, sync, HappyView, the database and the server around them web The Local Network website (apps/web)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants