mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-07-03 20:31:45 +00:00
cbe6e94b1a
Adds an anti-drift coverage selftest that fails CI if a future analytics tab is added to `public/analytics.js` but not registered in `test-a11y-axe-1668.js` `ROUTES`. Wires it into the `.github/workflows/deploy.yml` axe job alongside the existing reciprocity selftest. ## Relationship to #1706 / #1711 Follow-up to #1706 / #1711 — #1711 already added the 8 missing analytics tabs to `ROUTES` (`subpaths`, `nodes`, `distance`, `neighbor-graph`, `rf-health`, `clock-health`, `scopes`, `prefix-tool`). This PR locks that in: a future tab added to `analytics.js` without a corresponding `ROUTES` entry now breaks CI on this assertion. NOT closing #1706 — that issue is already closed by #1711. ## What the gate does (headline) `test-a11y-axe-routes-coverage.js` scrapes `<button class="tab-btn" data-tab="...">` declarations from `public/analytics.js` and asserts every declared tab is exercised by `test-a11y-axe-1668.js` `ROUTES` as `/analytics?tab=<tab>`. Asymmetry vs the existing selftest, intentional: - `test-a11y-axe-1668-selftest.js` — checks `REGISTERED_ANALYTICS_TABS ⊆ analytics.js` dispatch arms (no dead registrations). - `test-a11y-axe-routes-coverage.js` (new) — checks `analytics.js data-tab buttons ⊆ ROUTES` (no axe-blind tabs). Together they keep the axe matrix honest in both directions. ## Diff scope Only two files vs merge base: - `.github/workflows/deploy.yml` (+1 line — wires the new test into the deploy-job batch) - `test-a11y-axe-routes-coverage.js` (+74 lines, new file) No production code changes, no `ROUTES` changes (those landed in #1711). ## TDD framing Net-new drift gate — no prior assertions to break, no behavior change in shipped UI. Per workspace `AGENTS.md` net-new-test exemption ("net-new UI surfaces … test must land in the SAME PR but doesn't need to be the FIRST commit"), this analogous net-new gate ships green from commit 1. A red→green pair would require a synthetic regression in `analytics.js` or `ROUTES`, which isn't appropriate for an anti-drift guard. ## Local run Local Alpine chromium 136 crashes under Playwright's CDP probe (`posix_fallocate64: symbol not found`) — affects the axe runner generally, not this selftest. The coverage assertion itself is pure Node (file read + regex + set diff) and runs locally clean. Real verdict comes from CI's Playwright-bundled chromium. --------- Co-authored-by: Kpa-clawbot <bot@openclaw.local>