Skip to content

audit(ui): sweep every authenticated screen, and stop the admin screen that never stopped fetching - #855

Merged
thinkclay merged 2 commits into
mainfrom
redesign/r1-852-sweep
Sep 22, 2026
Merged

thinkclay merged 2 commits into
mainfrom
redesign/r1-852-sweep

Conversation

@thinkclay

@thinkclay thinkclay commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Part of #852. Release 1, epic #847.

The harness

scripts/audit/sweep-routes.mjs captures every static route in both app modes at 1440 and 390. It derives its route list from apps/scaffald/app, so it cannot drift from the router, and mints a session the way tests/infrastructure/playwright/setup/setup/auth.setup.ts already does. Alongside each PNG it records what a screenshot cannot: where the page landed, whether the document scrolls sideways, where the heading sits, and every console error and 4xx/5xx.

200 captures over 98 routes, committed as the "before" for releases 1–3, with sweep.json and sweep.md.

What it found on the first run

Fixed here

/office/settings/geographic never finishes loading. It reads core.system_config, which grants nothing to authenticated (RLS is off, so PostgREST answers 42501), and its effect shows an error toast — while listing toast as a dependency. ToastContext memoises its value on the live toasts array, so showing a toast changes the hook's identity and re-runs the effect that showed it.

Measured Before
Requests to /rest/v1/system_config per visit ~35,000
Across the 200-capture sweep 70,104
Time to networkidle never (180 s timeout, both widths)
Error toasts unbounded

The dependency is the half that makes it unbounded, so that is fixed here. The missing grant is a migration and is filed separately (#856); until it lands the screen shows one honest error instead of a retry storm.

Filed, not fixed

Finding Issue
core.system_config grants nothing to authenticated #856
/office/cms/jobs is permanently empty — z.coerce.boolean() reads "false" as true #857
Five Office routes scroll sideways on a 390 px phone #858
/auth/terms and /auth/privacy redirect a signed-in user to /dashboard #859
120 of 200 captures have no programmatic page heading #860
22 distinct heading positions on desktop, 24 on mobile, across 39 screens #851

Verification

pnpm prepush clean. The one code change is a useEffect dependency list; /office/settings/geographic was re-captured and now settles.

🤖 Generated with Claude Code

…n that never stopped fetching

`smoke-authed.mjs` looks hard at four ATS screens. Nothing looked at the
other ninety-four, which is what a reskin needs, so `sweep-routes.mjs`
derives its route list from the app directory — it cannot drift from the
router — mints a session the way the Playwright auth setup does, and
captures every static route in both app modes at 1440 and 390. Alongside
each PNG it records what a screenshot cannot show: where the page landed,
whether it scrolls sideways, where its heading sits, and what the console
and network said.

200 captures over 98 routes, committed as the "before" for releases 1-3.

The first run found a screen that never finishes loading.
`/office/settings/geographic` reads `core.system_config`, which grants
nothing to `authenticated` (RLS is off, so PostgREST answers 42501), and
its effect shows an error toast — while listing `toast` as a dependency.
ToastContext memoises its value on the live `toasts` array, so showing a
toast changes the hook's identity and re-runs the effect that showed it.
Measured: ~35,000 requests to /rest/v1/system_config per visit, 70,104
across the sweep, the page never reaching networkidle in 180 s, and an
unbounded stack of error toasts.

The dependency is the half that makes it unbounded, so that is fixed
here. The missing grant is a migration and is filed separately; until it
lands the screen shows one honest error instead of a retry storm.

Refs #852

Co-Authored-By: Claude Opus 5 <[email protected]>
…ps its data

Running the sweep over the full route list on the integration branch,
Metro ran out of heap 56 captures in (#680). Everything after that came
back `ERR_CONNECTION_REFUSED`, and the harness recorded **140 route
failures** — indistinguishable from real ones, on a branch whose whole
purpose was to prove thirteen merged PRs had broken nothing. The natural
response to that report is "re-run and see", which is exactly how a real
failure gets waved through.

`lib/dev-server.mjs` already exists for this and already says so: a smoke
that cannot reach the server exits INFRA (97), never 1. The sweep used
its preflight but not its mid-run check. It does now: the first
unreachable route aborts with a line that does not look like an
assertion, names where it stopped, and suggests the `SWEEP_ONLY` prefix
to resume from.

The report is also written after every capture rather than at the end.
The PNGs were always on disk; the facts that make them readable — where
the page landed, whether it scrolled sideways, where the heading sat —
were lost with the process.

Both proved themselves on the next run: the server died again during the
Office mobile pass, and instead of 30 invented failures the run exited 97
with 72 usable captures on disk.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay

Copy link
Copy Markdown
Contributor Author

Added a commit: the sweep now aborts with EXIT_INFRA when the dev server stops answering mid-run, and writes its report after every capture rather than at the end.

Both came from using this harness on the release-1 integration branch. Metro ran out of heap 56 captures into a full run (#680), and everything after came back ERR_CONNECTION_REFUSED — so the report showed 140 route failures on a branch whose entire purpose was proving nothing had broken. lib/dev-server.mjs already exists for this and already says a smoke that cannot reach the server exits INFRA, never 1; the sweep used its preflight but not its mid-run check.

Both fixes proved themselves on the very next run: the server died again during the Office mobile pass and, instead of 30 invented failures, the run exited 97 with 72 usable captures already on disk.

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