test(coverage): finish #8683 — convert ~10 remaining behaviour-by-text suites and document the text checks that stay

Author: koala73Created Sep 28, 2026Updated Sep 28, 2026
Labelstestaudit

Follow-up to #8683 (closed). #8685 deleted 23 of the source-text suites, and #8686 replaced 13 more with runtime tests. This issue covers what #8683 left open: step 4 for about 10 kept suites, and step 3 for the suites where the text is the contract.

1. Suites that still check behaviour only by matching source text

The #8683 review kept each of these because it is the only guard on something real. But the behaviour it claims can break while the matched text stays, so none of them is a real test yet.

Suite What it claims Route
tests/social-velocity-seed-health.test.mjs The relay writes error seed-meta on Reddit failures, and writes healthy meta only after the canonical write succeeds Runtime test. tests/social-velocity-boundary.test.mts:91-110 already runs seedSocialVelocity through a vm harness.
tests/save-to-storage-quota-guard.test.mjs saveToStorage still writes after the quota flag is set; the persistent cache stays behind the flag Runtime test. It is small and needs a storage stub that fails on quota.
tests/rss-mobile-yielding.test.mts Mobile feed parses are queued and yield, desktop parses stay concurrent, and no-store relay responses are never cached Runtime test through src/services/rss. Its L14 regex requires an exact comment line.
tests/notifications-settings-ui-invariants.test.mjs Realtime disables all/high and snaps to critical; atomic setNotificationConfig save; the gate is hasTier(1), not isProUser DOM test. tests/dom/notifications-settings-web-push.test.mts already mounts the panel.
tests/energy-variant-renewable-guard.test.mts The energy variant mounts and loads the renewable panel outside the happy-only branch Runtime test. Its regexes currently depend on comment text.
tests/app-destroy-lifecycle.test.mjs App.destroy teardown order, the vessel runtime epoch gate, and listener pairing DOM test. tests/dom/app-followed-countries-cap-drop-toast.test.mts (#8686) now runs the real init/destroy, so the same approach may fit.
tests/a11y-issue-7382-welcome-invariants.test.mjs /pro welcome a11y: no opacity fade, a single logo anchor, a Launch CTA aria-label that matches its text Test against the built public/pro output, as tests/pro-welcome-prerender.test.mjs does.
tests/digest-cache-key-sensitivity.test.mjs The digestFor memo key includes cand.rule.sensitivity ?? 'high', which guards a cross-user data leak Extract the key builder into scripts/lib/digest-orchestration-helpers.mjs, as #8686 did for the score floor.
tests/relay-tanker-shipstatic.test.mjs The AISStream subscription includes ShipStaticData, plus the tanker classification fallback, TTL and size cap The relay starts a server on import, so export or extract the pure pieces first. If that is too invasive, keep this as a text check and document why (section 2).
tests/cloud-prefs-panel-sync-guard.test.mjs (partly) App reapplies cloud prefs live (tier clamp, map mode, tab heal) The dirty-key half already runs in tests/cloud-prefs-sync-concurrency.test.mts:849. Convert or drop the App wiring half.
tests/map-renderer-deferral.test.mjs (partly) Readiness and viewport queues Keep the import-graph and dist checks (roughly L191-333). The regex method-body checks (roughly L335-614) are partly covered by tests/map-viewport-runtime.test.mts; drop or convert the rest.

2. Text checks that stay: say why in the header

#8683 step 3 asked every text check that stays to explain in its file header why the source text is the contract. Examples include CSP, committed HTML, cross-file health-key parity, and code that cannot be imported. The kept suites that lack such a header are the contract and wiring guards listed in the #8683 review (#8683 comments and the #8685 description). Add one or two sentences to each, stating what is pinned and why a runtime test cannot do the job.

Acceptance

  • Every suite converted from section 1 is proven to fail. Change the production code so the behaviour breaks while the old matched text stays, and show the new test go red (the method used in #8685 and #8686). Record each change in the PR.
  • Delete or rename the old suite once its checks are covered, and drop its entry from scripts/shared/data-test-durations.json.
  • Every suite that stays a text check has a header saying why.
  • npm run test:data, and test:dom / test:convex where touched, pass.

Out of scope

  • The break-the-code sweep over suites that import production code. That is a separate issue.
  • The four stale entries in scripts/shared/data-test-durations.json that were already on main before #8685 (checkout-overlay-lifecycle, deckgl-layer-state-aliasing, entitlement-watchdog, national-debt-ticker). Remove them in whichever PR touches that file first.