Skip to content

fix(e2e): keyboard-reachable MCP config block, and 304s are not redirects - #76

Merged
wojciechszyjka merged 7 commits into
mainfrom
fix/worker-harness-e2e
Nov 30, 2026
Merged

wojciechszyjka merged 7 commits into
mainfrom
fix/worker-harness-e2e

Conversation

@wojciechszyjka

@wojciechszyjka wojciechszyjka commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Tracking plan: .ai/runs/2026-11-30-worker-harness-e2e.md

Status: complete

What failed

The Worker harness (node scripts/worker-harness.ts --data .data) ended 19 of 20; the one failure was real / e2e: 73 of 75:

  1. test/e2e/a11y.spec.ts "axe for-agents mobile": serious scrollable-region-focusable on .fa-pre.
  2. test/e2e/layout.spec.ts "a click on Browse modules lands on the home page without a redirect": 304 .../run/fonts/Geist-Regular.woff2 (and Geist-Medium, GeistMono-Regular) collected as redirects.

Root cause

  1. /for-agents renders the MCP configuration as <pre class="fa-pre"> with overflow-x: auto only when meta.mcpUrl is set. At 390 px its "url": ... line (about 60 monospaced characters) is wider than the block (under 39 fit), so it scrolls sideways, holds no link or button, and has no tabindex: a keyboard cannot reach it. This is live on production (modules.openmercato.com/for-agents). The static e2e never saw it because test/e2e/build.ts emitted every variant without an MCP URL, so the Connect section was not rendered; the harness real build carries the production MCP_URL.
  2. The test counted every status from 300 to 399. The Worker sends public, max-age=0, must-revalidate for /run/fonts (src/worker/headers.ts, REVALIDATE_CACHE), so on the click to the home page the browser revalidates the fonts and gets 304 Not Modified. A 304 is not a redirect.

What changed

  • site/src/pages/for-agents.astro: .fa-pre gets tabindex="0" and aria-label="MCP configuration as JSON".
  • Same pattern on the page and its sibling pages, every scroll region that holds no link or button:
    • site/src/islands/AgentPane.tsx (for-agents demo): .ap__json (full JSON of a call, scrolls both ways, sideways on phones) gets tabIndex={0} and a name per call; .ap__res--err (an error, max-height: 360px; overflow: auto) too.
    • site/src/islands/SubmitForm.tsx (/submit): .sf__yaml (overflow-x: auto, already named "Descriptor YAML") gets tabIndex={0}.
    • site/src/pages/about.astro: .ab-lines (the release-lines table, overflow-x: auto, no link) gets tabindex="0", named by its figcaption.
    • Checked and left as they are: CommandChip .cmd__text (already focusable when it can scroll), /compat .cp-tablewrap and /radar .radar__scroll (hold links), /m .agentv__pre (already focusable and named), .tabs__list and .mods__cats ul (buttons and links), the /submit sample pre and .ap__args (wrap, no overflow).
  • test/e2e/build.ts: every variant (real, stale, templates) is emitted with --mcp-url: MCP_URL when set, else the production address https://om-modules.openmercato.workers.dev/mcp (the same as the route matrix's BUILD_ENV). Its JSON line is about 60 characters, well past the width of the block at 390 px, so a11y.spec.ts on the static build fails without the fix above. No other fixture-based test or snapshot needed an update: the harness real build already carried this URL and its other 73 e2e tests passed with it; the e2e suite has no pixel baselines.
  • test/pages/redirects.ts (new): isRedirect(status, location), true for 301, 302, 303, 307, 308 or any answer with a Location header. Used by:
    • test/e2e/layout.spec.ts (the failing test; the rest of the test is unchanged),
    • test/pages/route-matrix.ts (rowOf) and test/worker/router.test.ts (the redirect rows), which had the same >= 300 && < 400 pattern. No row of the three committed route matrices changes classification.
  • Not changed: the Worker cache headers.

Tests that cover it

  • test/e2e/a11y.spec.ts "axe for-agents mobile" now meets the Connect block in the static build too.
  • test/e2e/layout.spec.ts "a click on Browse modules ..." passes on the Worker's 304 revalidations and still fails on a real redirect.
  • test/pages/scroll-regions.test.ts (new, no browser): the five regions are focusable and named; the e2e build passes an MCP URL; its JSON block is wider than a 390 px phone.
  • test/pages/redirects.test.ts (new): 301/302/303/307/308 and a Location header are redirects; 300, 304, 305, 306 without one are not.

Run here: tsc --noEmit, astro check (0 errors), prettier --check ., check-text, vitest (3255 passed; the same 22 tests in 5 files fail on unchanged main in this sandbox: git, shell and network fixtures), and E2E_ONLY=stale node test/e2e/build.ts, whose for-agents.html has the Connect section and <pre class="fa-pre" tabindex="0" aria-label="MCP configuration as JSON">. Playwright was not run (no browser in the sandbox).

How to verify

node scripts/worker-harness.ts --data .data

Expected: worker harness: 20 of 20 checks passed, 0 failed, 0 not run.

Static path: node test/e2e/build.ts && yarn e2e test/e2e/a11y.spec.ts test/e2e/layout.spec.ts; with the for-agents.astro change reverted, "axe for-agents mobile" fails on .fa-pre.

Open question for the owner

Live Pages serves /run/fonts with Cache-Control: public, max-age=14400, must-revalidate (zone Browser Cache TTL; checked with curl on modules.openmercato.com/run/fonts/Geist-Regular.woff2), while the Worker sends max-age=0 (REVALIDATE_CACHE), so every page view revalidates the fonts. Not changed here; should the Worker match Pages?

Follow-up (out of scope): README code blocks on module pages (lib/core/text.ts renders <pre><code>, .md pre { overflow-x: auto }) can scroll sideways without a focus stop; the /m axe check passed on the KSeF page, whose README has no wide block.

@wojciechszyjka wojciechszyjka added the bug Something isn't working label Nov 30, 2026
@wojciechszyjka
wojciechszyjka marked this pull request as ready for review November 30, 2026 08:52
@wojciechszyjka

Copy link
Copy Markdown
Collaborator Author

om-auto-create-pr: complete

  • Fixed: .fa-pre on /for-agents (and four sibling scroll regions) is focusable and named; the static e2e build emits an MCP URL so axe meets it; the redirect checks in test/ count only 301/302/303/307/308 or a Location header.
  • Verification: CI green (build, checks, validate, www content). Locally: tsc, astro check, prettier, check-text, vitest (only the 22 sandbox-bound tests that also fail on main), and a static stale build whose for-agents.html carries the fixed <pre>. Playwright not run here.
  • Next: owner reruns node scripts/worker-harness.ts --data .data, expected 20 of 20; then review and merge. Open question on the font Cache-Control is in the description.

@wojciechszyjka
wojciechszyjka merged commit de9030d into main Nov 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant