Skip to content

feat(serving): Mod+Shift+K never reaches a patch or the browser - #1298

Merged
allisonmahmood merged 4 commits into
mainfrom
feat/switcher-relay
Nov 8, 2026
Merged

allisonmahmood merged 4 commits into
mainfrom
feat/switcher-relay

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

What changed

A patch's frame holds keyboard focus, so Patchy never heard Mod+Shift+K pressed inside a patch, and any listener of the patch's could take it. Some browsers use the chord destructively: Zen closes every unpinned tab on it. Now the key reaches neither the patch's code nor the browser, in every patch at every version ever published, single-file pages included, and on Patchy's own pages, shells and notices from their first byte. Nothing opens yet; the menu is #1270.

How:

  • One script, the switcher relay, claims the chord. It is one capture listener on window, registered before any other script. It preventDefaults and stops a trusted press, including mid-composition and on autorepeat. It asks for the switcher only on a press that isn't a repeat or an input method's (packages/core/src/switcher/key.ts keeps claims and activates apart).
  • Serving inserts it into every patch document as the first child of the real <head> (withSwitcherRelay from @patchy/serving/shell). It goes in after the digest check and before compression, so stored artifacts and digests are unchanged and one cached body still serves every viewer. patchy dev serves the same. The place comes from the bounded parse5 parser, which stops as soon as it knows (headStart in html-policy.ts): just past an explicit <head …>, so its attributes survive, or else where the parser would imply the head, always past the BOM, comments, the doctype and <html …>. A document that ends inside an unfinished comment, tag or attribute value gets the relay at the end of its last finished token, so the relay is never swallowed.
  • Patchy's own pages carry the same script at the top of their <head>: every htmlPage (app pages, doors, notices, the 404) and every patch shell (company, public, local). Each one's CSP admits it by one 'sha256-…' source, generated beside the script: the shell CSP with and without Clerk, every pageResponse branch and the notice CSP. A patch's own content CSP takes no hash, which would switch its 'unsafe-inline' off.
  • Framed, the relay talks to the shell with { patchy: "switcher", v: 1, kind } window messages, apart from the broker's MessageChannel and carrying no authority.
    • hello lets the frame take focus. The broker no longer does that at mount: until then the frame is hidden (data-waiting), so neither a click nor Tab can focus its empty first document, and the shell's own relay holds the key.
    • A frame with no relay is shown and focused on load. The relay at the top of the shell shows the frame, not the broker: it ships in the same response as the markup, so a broker from another release can't strand it. A frame whose content never arrives stays hidden, with nothing in it to reach, and there is no deadline that could reopen the hole on a slow load.
    • open opens the switcher at company scope and logs one console line; on a public shell it is ignored. When a switcher closes, closed puts focus and the selection back.
  • The contract feat(core): Mod+Shift+K opens Patchy's switcher #1270 builds on (@patchy/core/switcher):
    • Before a menu loads, window.patchySwitcher is undefined, or true once anything asked for it: one pending request to open, however many presses or frame messages made it.
    • After the menu loads, window.patchySwitcher is an object { open, toggle } (the Switcher interface). The menu installs it as it starts and opens at once if it found true.
    • What opens: openSwitcher(window) calls open, which opens and leaves an open menu open, or records true until a menu loads. It is all a frame can ever reach.
    • What toggles: toggleSwitcher(window) calls toggle, which closes an open menu and opens a closed one, or records true until a menu loads. Only the relay at the top of a page calls it, on the chord pressed in that page's own document; with the menu open, its focus keeps the press there.
    • On a frame's open (from frame.contentWindow, origin "null", at company scope) the broker calls openSwitcher(window), never toggleSwitcher. Public scope ignores it; local scope only logs.
  • Core generates the script with its own build (scripts/build-core-scripts.mjs → gitignored packages/core/src/generated/). It runs from core's build and test, root prepare and typecheck, every vitest run and pnpm dev, and it is a Turbo input and output. It takes a list of outputs, so feat(core): Mod+Shift+K opens Patchy's switcher #1270 adds switcher.js as one more entry.

Closes #1268

Look at

The relay holds the key against a patch listening everywhere (test/browser-tier1/switcher-relay.spec.ts). The patch has its own capture listener first in its <head>, a document listener, a field listener and an onkeydown attribute. With withSwitcherRelay made a no-op, the four tests that need it fail, and the two that test the shell and Patchy's own pages still pass:

  ✘  a patch's own listeners and fields never hear the switcher key
  ✘  the shell takes the relay's open at company scope and ignores it on a public page
  ✓  the shell ignores switcher messages from anywhere but its frame's relay
  ✘  the shell holds the key until the patch's relay says hello, then hands the patch focus
  ✘  the relay puts the cursor back where the press found it once the switcher closes
  ✓  Patchy's own pages and notices claim the key from their first byte

With the relay in, all six pass, and so do the four focus.spec.ts cases.

Sol's rounds 1 and 2, each test red on the code before its fix and green now:

  • The frame takes no click or Tab while its content is held. Before, a click focused the empty about:blank and the chord went uncancelled: [false, undefined] where [true, true] was expected.
  • With { open, toggle } installed, two chord presses in the frame and a posted open leave it [true, true, true]; the shell's own press then toggles it false.
  • <!doctype html><!-- unfinished and <!doctype html><html lang="en both run the relay: a later listener hears a but never K, and the shell gets open. Seven new headStart cases (unfinished comment, near-closed comment, bogus comment, root tag, attribute value, head tag after a comment, doctype) failed on the old code.
  • Round 2: with the content held for 11 s, the frame stays hidden, and a click, Tab and the chord are all claimed by the shell. A stub broker that only sets the frame's src, as an old one would, framing relay-less content: the shell's relay still shows the frame on its load.

The chord equals TanStack's matcher. key.test.ts holds activate equal to isTrusted && !repeat && matchesKeyboardEvent(event, "Mod+Shift+K") under the repo's patched @tanstack/hotkeys (now a core devDependency). It covers 26 presses on mac, windows and linux: US, Dvorak, remapped J on the K key, Cyrillic, AZERTY, symbols, dead keys, AltGr both ways, wrong modifiers, repeat, composing, Process, Unidentified, keyCode 229 and untrusted. A second table checks that composing and repeat presses are claimed but never activated.

The relay is about 2.4 KB raw, 1.06 KB brotli, larger than the issue's 0.5 KB estimate. Most of that is the focus and selection restore #1270 relies on, and the top-level frame release.

How it was verified

  • pnpm check: format, lint, typecheck and synth pass. The offline tests fail only where the CLI stub servers get a stray GET / from a local port probe and where npm is missing beside the machine's Node. The same files fail the same way on origin/main on this machine (cliLifecycle, cliPublish, cli, cliRepoRecovery, install, Supervisor), and the set changes from run to run. CI is the arbiter.
  • pnpm verify under the shared lock: format, lint, typecheck, synth, postgres-concurrency, tier2-smoke and browser (the whole tier 1 Playwright suite) pass.
    • cli-smoke caught a real gap: the packed e2e compared the frame's bytes with the upload. It now expects the upload led by the relay, and the receipt's digest is checked against the bytes with the relay removed. Rerun, it passes in full with mise's Node 24 first on PATH. Without that, it stops at npm missing beside this machine's Node, past every relay assertion.
    • install passes with Node 24 on PATH; it fails at once on npm without it.
    • test and test (bun) fail only on the stray GET / in CLI stub servers, plus execution tests that time out or fail on the base too. Supervisor, PatchesApi and IMAP Runtime pass alone.
  • Browser: switcher-relay.spec.ts (10) and focus.spec.ts (4) pass on the latest commit, plus the mutation and red runs above.
  • After Sol's round 2, the switcher-relay (10), focus (4) and starting (7) browser specs pass under the shared lock. pnpm check gives the same picture as after round 1, plus a PGlite metering test that timed out under load and passes alone.
  • After Sol's round 1, pnpm check under the shared lock: format, lint, typecheck and synth pass. The offline tests fail only in the same stub-server and npm files as before (cliLifecycle, cliLook, cliPublish, cliRepoRecovery, cli, install). The affected unit suites (core, serving, auth page, devServer, server) pass: 286 tests.
  • New unit tests: the chord tables, head placement (headStart over 15 shapes, parsed back with parse5 to check the mode, root and head attributes are unchanged and the marker is the head's first child, plus the parser-bound fallbacks), withSwitcherRelay, the hash being the exact script text's, and the relay's source in every CSP above. Pages' BOM, compression and content-bytes tests now expect the stored bytes plus the relay. The BOM still leads.
  • A scratch checkout installed with --ignore-scripts, so nothing was generated, then pnpm --filter "@patchy/core..." build. It generated src/generated/relay-script.ts and compiled dist/switcher and dist/generated. The @patchy/server... build and the packed CLI build then passed, and the packed CLI's dist carries the relay and the broker's line.
  • Not checked here: real browsers on a Mac (Safari, Chromium, Zen) and Windows. Per the issue, that is by hand on the candidate if Allison can reach it, otherwise straight after deploy. Pass: the key-test page's count stays at zero, the browser does nothing, and the shell's console shows Mod+Shift+K is Patchy's switcher key; it never reaches the patch's own code.

Hit every surface:

  • CLI: patchy dev serves the relay. README and GLOSSARY updated; no command, flag or exit code changed, so ADR-0004 is unchanged.
  • Project skills: patchy-hotkeys and sdkCapabilities.ts updated.
  • Dev loop: pnpm dev builds core's scripts after the broker. docs/DEVELOPMENT.md updated.
  • Vocabulary and product shape: a Switcher relay term in the Serving glossary, and GLOSSARY-MAP, docs/product.md and the README layout updated. ADR-0010 gains "The switcher relay": the one inserted script and the one authority-free window message. ADR-0006 no longer says shells never run inline script.
  • Served pages: the ui-consistency spec now names the hashed relay as the one inline script. bundleCheck.ts is unaffected, since the relay is added at serve time, not in the bundle.
  • Not touched: the wire contract (packages/api), migrations, company resources, reverse states and the repo layout.

One departure from the issue: the guard and the relay are one script. At the top of a page it records the request for that page's switcher; in a frame it posts to the shell. Framed notices (a non-200 at a content URL runs under the content sandbox policy) therefore carry the relay with nothing extra, and every first-party page claims the key, doors included. Their CSPs gained one hash source each. The content sandbox policy already allows inline script, so framed notices need no hash, and adding one would switch 'unsafe-inline' off.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Serving adds a script to the bytes it sends and the CSPs that allow it. No CLI behaviour, API, schema or configuration changes.

  • What does a revert leave behind? Nothing stored. Artifacts and digests were never rewritten, and the per-process document cache refills from storage. Tabs already open keep the relay they loaded until they reload.
  • Does the release before it still work with that? Yes. A relay under an old shell posts messages nobody handles, so the key just does nothing. A new shell framing old, relay-less content focuses the frame on load, and the key reaches the browser as it does today.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area area:integrations Company connections and integration implementations area:ui Portal and first-party browser pages, shared rendering and styles size:xl Over 1,000 changed lines; review in multiple passes labels Nov 7, 2026
@allisonmahmood
allisonmahmood changed the base branch from main to feat/switcher-list November 7, 2026 14:40
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review (round 1)

CHANGES REQUESTED

  1. [P1] The empty frame can still take focus before the relay runs — packages/serving/src/broker.ts:800. Hold the content response, click the blank iframe, then press Mod+Shift+K. Chromium focuses its initial about:blank document; the trusted K event has defaultPrevented === false, and the shell receives no request. Waiting for hello prevents the broker's early focus call, but the iframe emitted at packages/serving/src/shell.ts:79 remains clickable and keyboard-focusable throughout the wait. This leaves the destructive browser shortcut exposed during loading. Make the frame unfocusable from its initial markup, for example with inert, and release that restriction on hello or the legacy load fallback before the conditional focus handoff. Preserve focus held by shell controls and the starting cover. Add a delayed-content browser case that clicks or tabs toward the frame before pressing the chord.

  2. [P2] A frame's open message calls a toggle rather than an idempotent open — packages/serving/src/broker.ts:811, packages/core/src/switcher/messages.ts:40. The callback contract explicitly says window.patchySwitcher toggles. The broker calls that same callback for every valid frame open, so patch code can post two valid messages and close the menu. With the documented toggle callback installed, two genuine opaque-frame messages produced states [true, false] in Chromium. There is no menu yet, but this is the seam the next PR consumes, and it contradicts the specified boundary that a patch may open the menu but cannot close or drive it. Separate the frame's idempotent open operation from the trusted shell chord's toggle, using distinct callbacks or an explicit intent. Test repeated frame messages after installing the callback, rather than checking only the pending boolean.

  3. [P2] EOF inside a token can swallow the entire relay — packages/core/src/html-policy.ts:189. <!doctype html><!-- unfinished passes the CLI bundle check and publishes successfully. headStart returns the string length, so the injected script becomes part of the unfinished comment. Chromium sees zero scripts, the broker focuses the frame on load, and a trusted Mod+Shift+K is left uncancelled. An unfinished start tag has the same problem. Track a safe insertion boundary before an unfinished token instead of appending at EOF, while keeping the doctype and completed root/head tags intact. Add parser and browser cases for unfinished comments and tags that assert the relay actually executes and cancels the chord.

Verification: 189 targeted unit tests and all 10 supplied relay/focus browser cases passed. The additional browser probes reproduced the three findings above. A clean archive installed with --ignore-scripts also built the server and packed CLI successfully. No source files were edited.

Surface review covered served pages, CLI/local serving and project skills, dev-loop wiring/docs, and vocabulary/product/ADR mirrors. No wire/API, migration, company-resource, reverse-state or package-layout changes apply. Combining guard and relay, covering door pages, the larger script and the temporary console line do not independently require changes. Keeping the patch content CSP hash-free is correct: adding a hash would disable its unsafe-inline scripts.

Reviewed by GPT 6.1 Sol (xhigh) in Codex, orchestrated from T3 Code.

allisonmahmood added a commit that referenced this pull request Nov 7, 2026
… a frame only ever opens

Sol's round 1 on #1298:
- The frame starts hidden (data-waiting) so neither a click nor Tab can
  focus its empty first document before the relay runs; the broker shows
  it on hello or load, and the shell's style shows it after 10 s whatever
  arrives, so a broker from another release never leaves it locked.
- window.patchySwitcher becomes { open, toggle }: a frame's open message
  calls openSwitcher, which only ever opens; only the chord pressed in the
  page itself calls toggleSwitcher.
- headStart stops at the end of the last finished token, so a document cut
  short inside a comment, tag or attribute value can't swallow the relay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Thanks, Sol: all three are fixed in 9e00a27.

P1, empty frame takes focus. The shell now renders the frame with data-waiting and visibility: hidden, so neither a click nor Tab can reach its first about:blank document. The broker's handOffKeys drops the attribute on the relay's hello, or on load for a document without one, and only then focuses. The deadline lives in the shell's own style, not the broker: a one-shot animation: patch-frame-waiting 0s 10s forwards shows the frame after 10 s whatever arrives. A new shell that loads an old broker from another host mid-deploy is therefore never left locked. The starting cover and the four focus.spec.ts cases are unchanged. The new spec case holds the content, then clicks the frame and presses the chord, then Tabs and presses it again. Both are now claimed by the shell; on the previous commit the click gave [false, undefined]. A second case holds the content forever and sees the frame show after its deadline.

P2, a frame's open toggled. window.patchySwitcher is now true | { open, toggle }. openSwitcher calls open, which only ever opens, and it is what the broker calls for a frame's open. toggleSwitcher calls toggle, and only the relay at the top of a page calls it, for the chord pressed in that document. Before a menu loads, either one records true. The browser case installs a recording { open, toggle }. Two chord presses in the frame plus a posted open give [true, true, true], and the shell's own press then gives false. A unit test covers the pending, repeated-open and toggle states.

P3, EOF swallows the relay. headStart now records the end of the last finished token before the head: the root's start tag, or a doctype or comment that ends in its own terminator. A document that ends before anything implies its head gets the relay there, not at EOF. Seven new parser cases failed on the old code and now pass, each checked by parsing the result back: unfinished, near-closed and bogus comments, an unfinished root tag, attribute value, head tag and doctype. The browser case publishes <!doctype html><!-- unfinished and <!doctype html><html lang="en. In both, a listener added later hears a but never K, and the shell gets open.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review (round 2)

CHANGES REQUESTED

  1. [P1] The ten-second fallback reopens the empty-frame hole — packages/serving/src/shell.ts:79. Hold the content response beyond ten seconds: CSS makes the still-empty about:blank frame visible and focusable before hello or load. Clicking it and pressing Ctrl+Shift+K produced a trusted event with defaultPrevented === false and no shell request in Chromium. This affects ordinary slow loads; tier 1 has no starting cover. Keep unloaded frames unfocusable until hello/load, and recover from an old broker through shell code that waits for content readiness rather than a blind deadline. Extend the deadline test to click/Tab and press the chord after ten seconds.

The toggle and unfinished-markup findings are fixed, and the revised contract suits the menu. The zero-duration, one-shot animation does not continuously repaint. Cold-start cover focus and Chromium's accessibility tree behaved correctly when the relay arrived behind the cover and when it cleared.

Verification: 202 targeted unit tests and 49 supplied Chromium browser cases passed under the required lock. Extra probes reproduced the deadline escape and checked malformed markup and cover accessibility. No source files were edited.

Reviewed by GPT 6.1 Sol (xhigh) in Codex, orchestrated from T3 Code.

allisonmahmood added a commit that referenced this pull request Nov 7, 2026
…no deadline

Sol's round 2 on #1298: the 10 s CSS fallback showed a still-empty frame
on any slow load, where a click and Mod+Shift+K reached the browser.

The relay at the top of the shell now shows `[data-waiting]` frames
itself, on a validated `hello` from that frame or the load of its content
(a load before the frame has a `src` is its first, empty document). It
ships in the same response as the markup, so a broker from another
release can't strand the frame, and a frame whose content never arrives
stays hidden. The broker only hands focus.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Thanks, Sol: fixed in 2eec766.

P1, the 10 s fallback reopened the hole. The CSS deadline is gone. The relay at the top of the shell now releases [data-waiting] frames itself. The release comes on a hello that passes the same checks the broker uses (origin "null", patchy, v and kind, and the source must be that frame's window), or on the load of the frame's content. A load is ignored while the frame has no src, because that is its first, empty document. The relay ships inline in the same response as the markup it releases. A new shell running an old broker from another host therefore can't strand the frame, and a frame whose content never arrives stays hidden. The broker now only hands focus; its listeners run after the relay's, so the frame is already showing. A frame's load never reaches window, so the relay listens on document in the capture phase.

Tests: with the content held 11 s, the frame stays hidden, and a click, Tab and the chord are all claimed by the shell. That case fails on 9e00a27. A stub broker that only sets src, framing relay-less content, has its frame shown on load by the shell's relay. The hello-only case now blocks load at document capture, so only hello can release it. The focus.spec.ts and starting.spec.ts cases still pass.

The release logic sits on the relay's top-level branch, so framed documents never run it. Splitting it into its own script would cost a second hash, and framed notices rely on the one script working both ways. The window.patchySwitcher contract is unchanged.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review (round 3)

CHANGES REQUESTED

  1. [P1] Failed or replacement documents still expose an unguarded frame — packages/core/src/switcher/relay.ts:115. Abort the initial content request: Chromium fires iframe load for its error document, this branch removes data-waiting, and the broker focuses it. A loaded patch navigating itself to about:blank or a CSP-blocked URL leaves the same hole: the frame stays visible after losing its relay. Against the real server, clicking these frames and pressing Ctrl+Shift+K produced a trusted K with defaultPrevented === false and no shell request. Require relay readiness for current content, send failed/unexpected replacement loads to a guarded shell notice, and explicitly scope the legacy load fallback. Add browser cases for failed initial loads and self-navigation.

The deadline fix works for slow/held content. Invalid messages cannot release a waiting frame; subsequent patch messages cannot re-hide a released frame. Normal reload/re-src, focus, the starting cover and Chromium accessibility checks passed. The #1270 open/toggle contract remains unchanged.

Verification: 202 targeted unit tests and all 21 relay/focus/starting Chromium cases passed under the required lock; additional real-server probes reproduced the finding. No source files were edited.

Reviewed by GPT 6.1 Sol (xhigh) in Codex, orchestrated from T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Thanks, Sol. Documents without the relay in the frame are out of scope for this PR; they are filed as #1303. A patch navigating its own frame to about:blank, an outside site or a blocked URL is the patch leaving or replacing its own document. That is the same class as the document.open() sabotage ADR-0010 already says isn't hardened against. A network-level failed load is rare; HTTP errors get a framed notice that carries the relay. Telling a failed or replaced load apart from relay-less content from a pre-relay release would break the first rollout, or change what people see when a patch navigates away, which is a product change. 66997dd states the limit in ADR-0010: "A document Patchy didn't serve has no relay: the browser's error page after a failed request, or a page the patch navigates its own frame to. The key isn't claimed there (#1303)."

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 66997dd7612b0425a184b84cc145a341fdd4ef35 (base 3e778e05ff688133e45adfdc221981a3167f3325, feat/switcher-list) on brightline, by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.

How: a brightline environment at the head. I added a single-file page that listens for keys everywhere, published in two versions, a public copy, a page with no explicit <head>, and a tier 1 repo patch (patchy init) whose own code adds key listeners. A Playwright script ran the same 75 checks in Chromium and in Firefox, as Jordan, Priya, Allison and a signed-out reader. An init script in every frame records whether each K press ended defaultPrevented, and logs every securitypolicyviolation. A positive control showed that detector firing in both engines.

Done means

  • Any patch, any version, single-file pages included: Mod+Shift+K reaches neither the patch's code nor the browser. Passed on Linux in Chromium and Firefox. I tested a tier 1 single-file page (v2), the same page at /~v/1, a tier 1 repo patch, a page with no explicit head, the scenario's kickoff brief, and tier 2 Kudos and New Business. In each, the press ended defaultPrevented and trusted, and none of the patch's listeners heard K: its own first-in-head window capture listener, document, field, onkeydown, or listeners added later. Typing ab, the chord, then c left the field reading abc. The shell got open (window.patchySwitcher === true) and logged its console line once. Clicking into the frame and tabbing into it behave the same way. With a Mac user agent, Meta+Shift+K is claimed and Control+Shift+K reaches the patch. Real Mac and Windows browsers were not run (see below).

  • The same holds on portal pages, patch shells and notices from the first byte. Passed in Chromium and Firefox. I checked 21 Patchy pages, including:

    • Home with the Final step dialog's focused button, All patches and its Tools view, a patch's page, Your agents, Company, Integrations, Agent access (as a member and as the admin), What's new and Guide;
    • the 404, the access_denied and needs_rebuild notices, the 401 sign-in door, /login and /dev/sign-in.

    The relay was the first <script> in each page's HTML. A press with focus on the page, on the body or in a search field was claimed. Also checked: a retired patch's address notice, a 404 notice loaded inside a patch frame (claimed in the frame, and the shell got open), and the starting cover, held up by delaying the document stream. The cover holds focus, the shell claims the chord under it, and the frame takes focus when the tools are ready.

  • Public patch pages claim the key but do nothing. Passed in both engines: signed out, a public page's press is defaultPrevented, the patch hears no K, patchySwitcher stays undefined and there is no console line.

Browser run, excerpts (Chromium; Firefox gives the same 75/75)
PASS older published version (v1): chord claimed in the frame (defaultPrevented, trusted) — [{"prevented":true,"trusted":true}]
PASS older published version (v1): patch's own and later listeners never hear K — late=10 own=26 K-lines=0
PASS older published version (v1): typing around the chord — "abc"
PASS tier 2 Kudos: shell got open at company scope — true
PASS tier 2 Kudos: Tab into the frame (2 presses), chord claimed in it — frame=[{"prevented":true,"trusted":true}] shell=[]
PASS Mac UA: Meta+Shift+K claimed, shell opens — {"meta":[{"prevented":true,"trusted":true}],"metaHeard":[],"metaState":true}
PASS Mac UA: Control+Shift+K is left to the patch — {"control":[{"prevented":false,"trusted":true}],"controlHeard":["window-capture K","document K","field K","window-bubble K","window-onkeydown K"]}
PASS public page: claimed, nothing opens, no console line — {"seen":[{"prevented":true,"trusted":true}],"heardK":[]}
PASS own page / (200): relay first, chord claimed — initial=BUTTON.btn btn-primary:true … state=true
PASS own page /brightline/key-listener signed out (401): relay first, chord claimed
PASS own page /nobody/nothing-here (404): relay first, chord claimed
PASS no console errors, CSP violations or page errors
[chromium] 75/75 passed
[firefox] 75/75 passed

cover: up after 2487 ms; focus DIALOG.shell-scrim; chord at the shell → patchySwitcher=true
cover: ready; frame focused; cover closed; errors=[]

"2 presses": after blur(), the browser's focus starting point sits past the frame, so the first Tab leaves the page and the second enters the frame. Shift+Tab enters at once. That is standard focus navigation, and once released the frame's markup is the same as on the base.

Served bytes, digests, compression, caching (curl as Jordan and signed out): passed.

  • Each content response is the relay (2,460 bytes with its tags) followed by the exact stored file. The relay sits right after the patch's own <head data-mark="own-head">, after a leading comment and doctype when there is no head, and first in Vite-built heads (tier 1 repo, Kudos, New Business). With the relay removed, the bytes hash to the SHA-256 from each publish receipt (v1, v2, the no-head page, the repo patch, the public page).
  • gzip and br both decode to the identity bytes. Responses carry vary: Accept-Encoding and text/html; charset=utf-8.
  • Cache-Control is unchanged: private, no-store for company patches, public, max-age=60 for the public page.
  • The shell's inline script hashes to the 'sha256-…' in its CSP. The patch content CSP is unchanged (script-src 'unsafe-inline', no hash). The 404's CSP still refuses any other inline script: an injected one was blocked in both engines.
  • Clerk-mode CSP strings, printed from the head's own code: the shell with and without Clerk, all four pageResponse branches (Clerk or not, app or not) and the notice CSP each admit the relay's hash, and none gains 'unsafe-inline'.

Golden journeys

  • Sign in: passed in Chromium and Firefox. Signed out, /brightline/kudos answers 401 with the door, which claims the chord. Sign in leads through /dev/sign-in as Jordan and lands back on /brightline/kudos.
  • Publish a page: passed. Allison's CLI published single-file pages and a repo, and Jordan opened them at their addresses. The way back: retire showed the retired notice, which carries the relay, and restore put the page back (200).
  • Share and unshare: passed. After share … public, harbor-pine-kickoff answers 200 without a session; after share … company it answers 401 again.
  • Find and open a tool: passed. Home's search finds Kudos, and it opens in its frame.
  • Use a tool live: passed in both engines. Jordan typed a kudos with the chord pressed mid-message; the text was intact, and it appeared on Priya's open page without a reload.
  • Use a tier 2 tool: passed in both engines. Jordan moved Verdant Grocers from Lead to Discovery and it moved on Allison's open board, then back.
  • Focus and the starting cover: passed. The frame is shown and focused on open for every patch above, and the cover behaves as described under Done means.
  • Nothing looks different: pnpm dev compare jordan … --base origin/feat/switcher-list. Every page answered 200 with no browser errors on both sides. Kudos, New Business and the kickoff brief are pixel-identical (Kudos below). Home differs only in the Final step's setup line, which carries each instance's own host and token. All patches differs only in its "1 minute ago" / "just now" times.
  • Tests: the PR's targeted unit suites passed locally (core switcher, html-policy, html, serving shell-headers, render and Pages, auth page, devServer: 202 tests). All 26 checks pass on the head, including browser, tier2-smoke, cli-smoke, clerk-live and install on Linux, macOS and Windows. I also ran the PR's own switcher-relay and focus specs in Firefox: 13 of 14 pass, and the one failure is the spec's harness (see Notes).

Rollback answers: they match the diff. The diff has no migration, packages/api or apps/infra change, and stored artifacts and digests are untouched: the relay goes in at serve time and the stripped bytes match the receipts. A revert leaves only per-process document caches, which refill from storage, and public content browsers may keep for up to 60 s. An old shell ignores the relay's messages, so the key does nothing. A new shell framing relay-less content shows and focuses it on load; the PR's stub-broker case covers that, and it passed in Chromium on CI and in Firefox here. No one-way label is needed, and rollback-rehearsal passed.

Not run

  • WebKit: this host lacks the system libraries Playwright's WebKit needs (libicu74, libxml2, libflite1), and installing them needs root.
  • Real Mac and Windows browsers (Safari, Chrome, Zen) and the browser's own shortcut: headless browsers have no browser shortcuts to trigger, so "nothing reaches the browser" here means only that the press ended defaultPrevented. The Mac case was emulated with a Mac user agent in Chromium and Firefox. Allison's hand test after deploy covers the rest.
  • Clerk-mode pages in a browser: needs Clerk keys and a person's sign-in. The Clerk CSP strings were checked from code, and clerk-live passed on CI, but its specs don't watch the console for CSP errors.
  • A natural cold start: this instance's tools start in under 2 s, so the cover never shows on its own. I held the document stream to bring it up; CI's starting.spec.ts covers the rest.
  • A guest's view (Taylor at Cedar Works) and patchy dev in a browser: not opened. Every non-public shell renders at company scope, and every content document gets the relay whoever views it. The devServer tests pass.

Notes

  • The relay is 2,443 bytes of script text (2,460 with its tags), against the PR's "about 2.1 KB raw".
  • In Firefox, the spec "the shell ignores switcher messages from anywhere but its frame's relay" fails only at its synthetic step. Firefox's MessageEvent constructor won't take the opaque frame's cross-origin WindowProxy as source. The real spoofed messages earlier in that test are ignored correctly. CI runs this suite in Chromium only, so this matters only if the suite gains a Firefox project.
  • The known gap, a document Patchy didn't serve (a network error page, or a page the patch navigates its own frame to), is fix(serving): Mod+Shift+K is safe after a patch frame leaves Patchy's content #1303 and stated in ADR-0010. I didn't test it.

After: /brightline/kudos at 1280px, no visible change from before

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Heads-up from the hotkeys work: #1302 (the fix for #1299) also changes handOffKeys in packages/serving/src/broker.ts. In desktop Chromium the patch's sandboxed frame commits in its own process, which drops the early frame.focus(). So #1302 calls frame.contentWindow.focus() as the patch starts loading, on load, and one task after the shell window's focus event, but only when the shell's focus is on the iframe. Whichever PR lands second has to merge this by hand. Keep this PR's data-waiting removal and hello handoff, keep #1302's focusPatch() call and window focus listener, and remove that listener in stop. CI's browser tier moves to desktop Chromium (channel: "chromium") in #1302, so run this PR's focus checks there too.

allisonmahmood and others added 4 commits November 8, 2026 01:01
A patch's frame holds focus, so the shell never hears Mod+Shift+K pressed
inside it, and Zen closes unpinned tabs on it. One inline script, the
switcher relay, now claims the chord first in every document Patchy serves:
Serving inserts it ahead of a patch's own code at serve time, and Patchy's
pages, shells and notices carry it at the top of their head, admitted by
its CSP hash. Framed, it tells the shell `hello` and `open`; the broker
hands the frame focus on `hello` or `load`. Core generates it with its own
build, and a table test holds the chord equal to TanStack's matcher.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a frame only ever opens

Sol's round 1 on #1298:
- The frame starts hidden (data-waiting) so neither a click nor Tab can
  focus its empty first document before the relay runs; the broker shows
  it on hello or load, and the shell's style shows it after 10 s whatever
  arrives, so a broker from another release never leaves it locked.
- window.patchySwitcher becomes { open, toggle }: a frame's open message
  calls openSwitcher, which only ever opens; only the chord pressed in the
  page itself calls toggleSwitcher.
- headStart stops at the end of the last finished token, so a document cut
  short inside a comment, tag or attribute value can't swallow the relay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…no deadline

Sol's round 2 on #1298: the 10 s CSS fallback showed a still-empty frame
on any slow load, where a click and Mod+Shift+K reached the browser.

The relay at the top of the shell now shows `[data-waiting]` frames
itself, on a validated `hello` from that frame or the load of its content
(a load before the frame has a `src` is its first, empty document). It
ships in the same response as the markup, so a broker from another
release can't strand the frame, and a frame whose content never arrives
stays hidden. The broker only hands focus.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A document Patchy didn't serve carries no relay: the browser's error page
after a failed request, or a page a patch navigates its own frame to.
Tracked in #1303.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit 0a78106 into main Nov 8, 2026
26 checks passed
@allisonmahmood
allisonmahmood deleted the feat/switcher-relay branch November 8, 2026 00:16
allisonmahmood added a commit that referenced this pull request Nov 8, 2026
## What changed

Moving between patches meant the back button, the address bar or a trip
through Home, and inside a patch Patchy showed nothing at all. Now
Mod+Shift+K (⌘⇧K on a Mac) opens Patchy's **Go to…** menu over any
company patch a person can open, a guest's view of a shared patch
included, and over every signed-in portal page. With nothing typed, the
patch they were last in comes first and lit, so ⌘⇧K then ↵ flips back to
it. Escape or the key again closes it and puts the cursor back where it
was, inside the patch's own field too. The look is mock direction 2,
"Quiet list".

How:

- **`/~shell/switcher.js`** is core's second generated script
(`scripts/build-core-scripts.mjs`), plain DOM code with no Preact,
Effect or schema library. The generator now refuses any bundled input
from outside core. Every host serves it like the broker, immutable under
its digest. App pages load it from `htmlPage` when they pass `app`, and
company shells from `renderPatchWrapper`, ahead of Clerk's and the
session's scripts. The tag names the viewer and company the page was
rendered for. Doors, public shells and `patchy dev` don't load it, so
they only claim the key. The script is 14.9 KB raw and 5.6 KB brotli.
- **The menu** is a command list in a modal `<dialog>` with the starting
cover's flat `shell-scrim`, and no animation or blur. It installs `{
open, toggle }` as `window.patchySwitcher`, the contract from #1298, and
opens at once if a press came before it loaded.
- **Nothing typed:** the flip target, then the next five by last open,
then **This patch**, then **Patchy**. Patch slots that opens leave fill
with patches the viewer has never opened, the company's live ones before
those shared with them, each by title, then id, six patch rows in all
(decided by Allison on 2026-11-08). So a new member or a guest sees
patches straight away. With nothing to flip back to, no patch is lit:
the first row after them is, so ⌘⇧K ↵ never opens a patch the person
hasn't been to. An unopened company patch shows no detail; a shared one
shows its company's name. This patch is the card's Overview and
Versions, plus Log and Settings for the owner and admins, shown only
once the list confirms membership. Patchy is the places, minus the
page's own, plus What's new with its dot.
- **Typing** goes through a pure ranking module (`switcher/rank.ts`):
word starts in any order, then initials, then a match inside a word from
three letters. Ties go by open score, then title, then id.
- **The list in the browser** (`switcher/client.ts` over
`switcher/cache.ts`) is one versioned sessionStorage entry keyed to the
page's viewer and company. It holds row metadata and the tab's `{
current, previous }` patch ids.
- It fetches `/switcher.json` on load, and again on open once the copy
is a minute old.
- A stale session is refreshed once through `window.patchySession`, then
the list is fetched once more.
- Signed out, a refusal, someone else's list or a non-list response
clears everything. So does signing out on the page: posting the form to
`/logout` forgets the list and pointers before the browser leaves for
the door, which has no switcher, and an answer still on its way is
dropped (`forgetOnSignOut`).
- A stored entry that is someone else's, an older version's, or doesn't
read back whole is removed, pointers and all. Pointers alone, as before
a first list lands, still read back.
- A list that lands after the menu opened, before the person typed,
moved the selection or pointed at any row (the lit one included), is
drawn as if it had been there at open: the flip first and lit. After any
of those, and on later refreshes, the rows already shown keep their
order and the selection stays put.
  - It takes its inputs as options, so #1271's notices can reuse it.
- **Keys around the chord.** A company shell's switcher tells the
patch's relay it is there with a new shell message, `available`. It
answers each validated `hello` from its frame itself, so this never
depends on the broker's release; it runs before the broker gives the
frame its address, so it hears every `hello`. From then on, an
activating press makes the relay hold every keydown, keypress and keyup
in the frame. The hold lasts until the browser blurs the frame and it
has really lost focus to the menu, `closed` arrives, or a second passes;
a blur the page dispatches itself ends nothing. So the patch never hears
a key meant for the menu. An Enter pressed in the few milliseconds
before the menu has focus is dropped, not flipped; a person's ⌘⇧K ↵ is
slower than that. Without `available` (a public shell, `patchy dev`, an
older shell) nothing is held, and typing goes on as before. The relay
accepts `available` and `closed` only as trusted messages from its real
parent. Nothing is replayed, and the frame never gives up focus. The
menu takes focus before it draws its rows.
- **The field keeps focus.** It is a `<label>`, and a press anywhere in
the dialog but its text, the glyph and panel included, leaves focus in
it.
- **Closing** puts focus back where the menu opened from. Over a patch
that is the frame, then `closed` so the relay restores the field and
selection, once the frame has focus again (Firefox returns it only after
the key event that closed the menu). Focus leaving the open menu, to the
patch, another window or the browser, closes it the same way, so Go to
never shows while typing goes elsewhere. It can also be the shell
control or the starting cover. On app pages it is the element that held
focus. The cover waits while the menu is open, and clearing it never
takes the menu's focus (`stream-status.ts`).
- **Components:** core gains `kbd` and the command-list contract
(`command-list.ts`: field, listbox, lit row, group label, empty line),
with its own scoped reset. `mono`, `page-mark`, `mark`, `tag`,
`shelf-label`, the What's new dot and the `field`/`field-group` rules
moved into `shellStyles`, so a served shell draws them as an app page
does. Escaping, patch marks and the sidebar's places moved into
dependency-free modules (`escape.ts`, `patch-marks.ts`, `places.ts`)
that the browser bundle can carry. Their old exports are unchanged.
- **Smaller changes:** the switcher list's type moved from Portal into
`@patchy/core/switcher`, as #1294 suggested. The shell's console line on
`open` is gone at company scope; `patchy dev` keeps it.

Closes #1270

**This PR changes code from #1298.** The commit `fix(core): the relay
holds the keys after the chord only where a switcher will take them`
changes `packages/core/src/switcher/relay.ts` and `messages.ts`, with
their cases in `switcher-relay.spec.ts` and ADR-0010. Of #1298's
`broker.ts`, this PR changes only the console line on `open`. Without
it, a fast ⌘⇧K ↵ from a patch's field sent the Enter into the patch,
since the browser delivered it inside the frame before the shell had
handled the relay's `open`. The fix needs the shell's switcher to say a
menu exists (`available`), and the relay to hold keys only then and to
accept only its real parent's messages and the browser's own focus and
blur. That only matters once there is a menu, so it lands here rather
than in #1298.

## Look at

**The flip**, filmed on `brightline` as Allison: Spend Requests, then
New Business, then ⌘⇧K ↵ back to Spend Requests, typing to filter, and
the menu on Home.


https://github.com/user-attachments/assets/117eb293-cae5-4fe6-931c-0c391df522cc

**Over a patch**, nothing typed. Spend Requests is lit as the flip
target, and New Business, the patch on screen, isn't a row:

![The switcher over New
Business](https://github.com/user-attachments/assets/b45a9f2f-da83-4d8e-97a3-58a69b89dee4)

**A new member** (Jordan on `brightline`, who hasn't opened anything)
with nothing typed: the company's patches by title, none lit, and the
first place lit:

![The switcher for a new member on
Home](https://github.com/user-attachments/assets/6d6510f6-046f-46aa-a526-5849e0003a3b)

**Typed** ("ku" over Spend Requests), and **on Home**, where Home isn't
offered:

| Typed | On Home |
| --- | --- |
| ![The switcher with ku
typed](https://github.com/user-attachments/assets/a51a9ead-c07c-431f-9491-f9410fb2a731)
| ![The switcher on
Home](https://github.com/user-attachments/assets/069b7972-7257-417c-85fd-7819d1ba8fe3)
|

**Pages with the menu closed don't change.** `pnpm dev compare` as
Allison on `brightline`, before at `66997dd` (#1298's head) and after at
`ab55b42`:

| Page | 1280px | 390px |
| --- | --- | --- |
| `/` | No visible change | No visible change |
| `/brightline/new-business` | No visible change | No visible change |

<details><summary>After, 1280px</summary>

![Home
after](https://github.com/user-attachments/assets/f8972e01-7ba9-4a70-bd3e-f3ac8d6dbd15)

![New Business
after](https://github.com/user-attachments/assets/f0be0e61-a42c-4189-b559-05ba2aaddf8a)

</details>

**The spec caught a real race.** `dialog.close()` queues its `close`
event, and Chrome can handle a fast key press first. Without a guard,
the stale event from an Escape closed a menu reopened straight
afterwards. The menu now acts on its dialog's `close` event only while
the dialog is actually closed. The cover spec reopens it immediately
after Escape to hold that.

## How it was verified

- **`test/browser-tier1/switcher.spec.ts`**, 16 cases, all pass twice
over with `--repeat-each=2` in Chromium, and once more after the rebase
onto `main`. The 14 that aren't Chromium-only (all but the starting
cover's two) also pass twice over in Firefox.
- Someone who has opened nothing: a new colleague's menu on All patches
lists the company's patches by title with Home lit; a guest's lists the
patch shared with them, named with its company's name, with Home lit.
- ⌘⇧K, then ↵ once the menu has focus, three flips in a row from the
patch's field: each lands. Then ⌘⇧K ↵ with no pause: the patch's own
listeners and its form never hear the Enter.
- A menu slow to open (600 ms after the relay asks, the shell otherwise
free) over a patch that forges blur events every 20 ms: the Enter
pressed straight after the chord never reaches the patch, and nothing
flips. The broker never answers `hello`, as #1298's doesn't, so
readiness comes from the switcher alone. With the switcher's answer
disabled, the patch hears the Enter: the case bites.
- A patch that grabs focus back 400 ms after losing it, never leaves Go
to up while typing goes to the patch. In Chromium the menu closes and
"private" lands in the patch. In Firefox the inert frame can't take
focus, and the keys stay in the menu.
- A fresh tab whose list is held back: the menu opens on the places with
Home lit; once the list lands the flip is first and lit. Pressing ↓
first keeps All patches lit instead, and so does pointing at Home, the
lit row.
- A click on a group label, then on the glyph: the field keeps focus,
typing filters and ↵ opens.
- Sign out from the account menu: the tab's entry is gone on the page
the form leads to.
- Over a patch with the cursor in a field: the flip is lit, typing
filters, no match offers All patches, Escape restores the field's
selection (typing replaces it), ⌘⇧K ↵ flips both ways, the arrows wrap,
the key again closes, hover lights a row, the scrim closes and a click
opens.
- On All patches and Home: the flip to the patch the tab left, no own
place, no This patch, and focus back in the sidebar search.
- A guest: shared rows named with their company's name and no This
patch. Revoking the grant drops the row when the held `/switcher.json`
lands, while the menu stays open.
- Another viewer's planted entry is ignored and removed, while the same
entry as the viewer paints from cache. Denied `sessionStorage` still
lists.
- Sessions: stale gets the list back (401, refresh, 200), an exhausted
retry keeps the copy (401, 401), and signed out clears the list and the
entry.
- A host with no `switcher.js`: the key is claimed and `patchySwitcher`
stays `true`. With `/switcher.json` answering a 404 page: places only.
- A public shell loads neither file, and a key typed straight after the
chord lands in the patch's field.
- Over the starting cover: the menu opens over it, Escape returns focus
to the cover, and a cover clearing behind the reopened menu leaves focus
in it. A cover due while the menu is open waits, then takes focus once
it closes.
- **`switcher-relay.spec.ts`** now runs the relay alone on a host
without `switcher.js`, since a loaded menu answers its pending requests.
A new case shows that a page dispatching `available` itself is ignored
and the key after the chord stays the page's. The shell's own
`available` holds the next key, a blur the page forges releases nothing,
and `closed` ends the hold. All 11 pass, as do the 4 `focus.spec.ts` and
7 `starting.spec.ts` cases, twice over in Chromium.
- **Unit tests:**
- `rank.test.ts`: the mock's "sa" order, any-order words, initials,
inside-a-word from three letters, no typos, deterministic ties.
- `cache.test.ts`: round trip, metadata only, removal of another
viewer's or company's entry, of a bad list, bad pointers or an old
version, pointers on their own kept, full or denied storage, pointer
moves.
- `rows.test.ts`: every nothing-typed and typed case above, member vs
admin cards, the hold on refresh, the "4 min" … "Oct 2, 2025" labels.
Never-opened patches: a new member's six of eight by title and none lit,
a guest's shared patches named with their company, the mix (the flip,
then opened, then the company's unopened, then shared, capped at six),
and the patch on screen left out.
- `client.test.ts`: adopt, freshness, refresh once, keep, forget,
pointers, and sign-out forgetting for good with an answer still on its
way.
- `command-list.test.ts`: structure, escaping and the CSS in
`shellStyles`.
- `html.test.ts` and `render.test.ts`: the tag on app pages and company
shells only, ahead of Clerk, with escaped ids.
  - `Pages.test.ts`: `switcher.js` is immutable only under its digest.
- **`pnpm check`** (rerun after the round-three fixes): format, lint,
typecheck and synth pass. Its tests fail only in this machine's known
places, which fail the same on `origin/main` here: a stray `GET /`
reaching CLI stub servers (cli, cliPublish, cliLifecycle, cliLook,
cliRepoRecovery) and npm missing beside `/usr/bin/node` (install).
- **`pnpm verify`** under the shared lock, run before the round-one
fixes, with mise's Node 24 first on PATH: format, lint, typecheck,
synth, postgres-concurrency, cli-smoke, install and tier2-smoke pass.
test and test (bun) fail only on the same stray `GET /` and on load.
RequestEvents, Engine and Supervisor pass alone; Supervisor's case had
hit its 20 s timeout at a load average of 15. The browser job stopped at
its first failure, so I reran the whole tier 1 suite: 103 of 104 pass.
The one failure is `tier1.spec.ts` "hostile navigation", whose
foreign-origin stub heard a bare `GET /` from the local port probe.
#1294 documented it failing the same way on `origin/main`.
- **Not checked:** the hand test on a Mac in Safari, Chrome, Firefox and
Zen. That covers focus and cursor restore, the first moments after a
patch opens, and whether initials matches read clearly without
highlighting. WebKit isn't runnable here, so Safari is unverified. CI
runs Chromium only; the Firefox run was local.

Hit every surface:

- **Served pages:** the `ui-consistency` spec now covers the switcher as
the one shell UI a person opens over a running patch, the command list
and `kbd`, the components `shellStyles` now shares, the switcher script
on app and company shells, and how the starting cover yields to it.
- **Vocabulary and product shape:** Portal's glossary gains
**Switcher**, Serving's **Switcher relay** says what the menu does with
its messages, `docs/product.md` describes the switcher, and GLOSSARY-MAP
and the README layout mention it. ADR-0010 already states the final `{
open, toggle }` contract from #1298.
- **Dev loop:** `pnpm dev` already runs core's generator, which now
emits two scripts. No runner change.
- **Not touched:** the wire contract (`/switcher.json` is Portal's,
browser-only), the CLI (no command, flag or exit code; `patchy dev`
stays claim-only), migrations, company resources, reverse states
(opening and closing are the pair) and the repo layout.

Where this departs from the issue, each a gap the issue left open:

- A shared patch's detail is its company's name: guests record no opens,
so there is no time to show.
- Typed results are one ranked list without group labels, as the mock's
typed state is. Card and place rows keep their icons.
- The place a page belongs to isn't offered, as on the mock's Home.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

A new browser script and its route; no API, CLI, schema or configuration
change. #1267 (reopens within 10 minutes count once, PR #1295, now on
main) ships in the same release, so flips don't inflate Your usual.

- **What does a revert leave behind?** A `patchy.switcher` entry in
`sessionStorage` in tabs that loaded the menu. It holds row metadata
only and lasts until the tab closes. Pages already open keep the script
they loaded.
- **Does the release before it still work with that?** Yes. It never
reads the entry. A page from this release asking an older host for
`switcher.js` gets nothing, so the relay claims the key and nothing
opens. An older host without `/switcher.json` gives the menu places
only.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3
Code.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 8, 2026
## What changed

This adds release 40's What's new entry, written from `08e1fd9`. It
covers everything merged since release 39's `through` (`17b1ad8`), and
sets the `patchy` release to `0.40.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: Jump anywhere with ⌘⇧K | #1294, #1298, #1304, #1307 |
| Improved: Your usual stays yours | #1295 |
| Patch changes: Mod+Shift+K no longer reaches patch code; Patchy serves
one script first in every patch document | #1298 |

#1293 is release 39's own entry. The range is exactly the switcher stack
(#1091), which ships as one release. #1295 had to ship no later than the
menu, and it does.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `64ce907` (release 39) to this
PR's merge:**
- **No PR in the range is `one-way`.** There are no migrations, no API
or CLI contract changes, and no infrastructure changes.
- **#1295** changes only how new opens add to a person's score. Scores
written under the new rule stay valid for release 39, which keeps
counting every open.
- **#1298** inserts the relay into served patch bytes at serve time.
Stored files and digests are unchanged, so release 39 serves them as
before.
- **#1304 and #1307** add a `sessionStorage` entry that release 39 never
reads. #1307's new `claims` field on a completed Clerk handshake exists
only in memory.

**Rollback line:** If this release misbehaves, roll back to
`64ce90784350341fc2f60fe4f4161a78444f243e` (release 39).

## How it was verified

- **Tests:** the `packages/core` What's new test passes (5), the
`packages/api` suites pass (64), and the three files are formatted.
- **The range:** each of #1294, #1298, #1295, #1304 and #1307 was:
- reviewed by GPT 6.1 Sol at xhigh, with every finding fixed or declined
in writing on the PR;
  - accepted on its final head by an agent that didn't write it;
  - merged green on a branch up to date with main.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

The changelog entry and the release version only.

- **What does a revert leave behind?** Nothing. CLIs installed from this
release report `0.40.0` and are told to match the server, as at every
release.
- **Does the release before it still work with that?** Yes.

Written by Claude Opus 5.5 in Claude Code, orchestrated from T3 Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 10, 2026
Stacked in the UI overhaul (#1315) after F2; merge the stack together,
not alone.

## What changed

Your agents lived at `/machines` and company management at `/company/…`.
They now have the addresses the new sidebar names: Your agents at
`/agents`, with Connect an app at `/agents/connect?app=<app>` and Add a
computer at `/agents/computer` as pages of their own, and People,
Integrations and Agent access at `/settings/people`,
`/settings/integrations` and `/settings/agent-access` (`/settings` opens
People). Released skills, CLIs and bookmarks carry the old addresses, so
every one of them keeps working. No page is restyled; later lanes
rebuild them.

Closes #1318

## Look at

**1. One map, by method and path: `apps/server/src/Moved.ts`.** Each
entry is an old route exactly as the last release registered it, found
with Effect's own `FindMyWay` under the router's default rules, so any
letter case, trailing slash, repeated slash or percent-encoding the
router accepted before still works. A GET answers 308 to the new URL
with the query as sent; a browser carries the fragment across on its
own. A POST, from a form left open across the move, is handed to the
router under its new URL before routing, so the new route answers it
with every check it makes (same-origin, admin-only, ownership). That is
the pattern `servingHeaders` already uses for HEAD. Anything else under
the old prefixes stays a 404.

| Old | New |
|---|---|
| `GET /machines` | `/agents` |
| `GET /machines?agent=<app>` | `/agents/connect?app=<app>` (other
parameters kept) |
| `GET+POST /machines/revoke-all` | `/agents/disconnect-all` |
| `POST /machines/:id/revoke` | `/agents/computers/:id/disconnect` |
| `POST /machines/agents/:id/disconnect` | `/agents/apps/:id/disconnect`
|
| `GET /company`, `GET /settings` | `/settings/people` |
| `POST /company/invites[/:id/{revoke,resend}]`, `POST
/company/users/:id/role` | `/settings/people/invites…`,
`/settings/people/users/:id/role` |
| `GET+POST /company/users/:id/{deactivate,reactivate}`,
`/company/guests/:id/remove` | `/settings/people/users/…`,
`/settings/people/guests/…` |
| `GET+POST /company/agent-access` | `/settings/agent-access` |
| `/company/connections…`: index, catalogue, connect pages and posts,
Pidgeon's Find addresses, a connection, its five acts and six
confirmations | `/settings/integrations…`, same shape |

`apps/server/src/Moved.test.ts` boots the whole server and walks the
map: every old GET (signed in and out) answers 308 with
`?show=a%20b&q=x+y&empty` kept byte for byte and no fragment, and its
target is a real route. For every old POST, another site's form gets the
same 403 as at the new address, and a member's request for what isn't
theirs gets the identical status, location and page. Two old forms
change what the new routes change: revoking a computer and turning agent
access on. Spellings the router accepted (`/company/`, `/COMPANY?…`,
`/%63ompany`, `//machines//revoke-all`) redirect or post as before;
`?%61gent=codex` and `?app=claude&agent=codex` land on Codex's steps, as
the old page showed. Unknown URLs under the old prefixes still 404. With
the rewrite taken out, the POST tests fail.

**2. Your agents' "add" disclosures became links to their own pages,**
because the old `?agent=` link now needs a destination of its own. The
links keep the ids old `/machines#add-a-computer` and
`#connect-an-agent` links name; `test/browser-tier1/moved.spec.ts`
follows both old links in a browser. Screenshots below come from `pnpm
dev compare` on throwaway `brightline` instances. *Before* opens the old
address on the base; *after* opens the same old address on this head,
which follows the redirect.

## How it was verified

- `pnpm check`: format, lint, typecheck and synth pass. In the offline
tests, the only failures were the CLI stub tests that a local tool's
stray `GET /` breaks on this machine (a different handful each run, none
touching these paths) and load-sensitive execution tests. Each passes
alone; CI runs the full suite.
- After rebasing on #1294/#1298: auth, companies, core, integrations,
portal, MCP and the server wiring suites, 1,176 tests, pass.
- `pnpm dev up imap`: the dev runner connected `imap/invoices` through
the moved connect page and its new URL wait, then published.
- Enrollment refuses the `agents` handle (`Companies.test.ts`, and
`/join` in `AuthPages.test.ts`). `settings` was reserved already.
- **Not run locally:** the browser suites (CI runs `moved.spec.ts`) and
live Clerk (`login-door`, `patchy-login` now open `/settings/people` and
`/agents`).
- **Not checked:** whether a production company already holds the
`agents` handle. That's left to the orchestrator before release.

Surfaces it follows through to: every href, form action, receipt
redirect and refusal link; the dev personas hint; device-login and
consent links (their routes don't move); hints agents read from the API,
MCP door, publish warnings, SDK generation and the CLI; the global
`patchy` skill (`skills-lock.json` refreshed) and its onboarding
reference; the project skills under `packages/sdk/skills`; `docs/API.md`
(regenerated), `docs/product.md`, ADR-0004, README, DEVELOPMENT,
OPERATIONS, the auth glossary and the acceptance skill; the dev runner's
connect URLs and URL waits. The rollback rehearsal drives the live
release as well as this head, so it opens People and Disconnect
everything at the old addresses (both releases answer them) and accepts
either form address. Past What's new entries hold no old paths. Seeds
and scenarios don't change.

Left for later lanes: copy that names the old Company group ("Back to
Company", "Turn it on at Company", the sidebar's group label) goes to N
and the page lanes, and Revoke → Disconnect to P4. No core additions.
Core's sidebar place list changes only its hrefs.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Every old address keeps answering: GETs redirect permanently, POSTs are
served where they were. No schema, API shape or configuration changes;
hint strings name the new addresses.

- **What does a revert leave behind?** No schema or rows. It does leave
the new addresses that people's agents and clients now rely on: the
global `patchy` skill on `main` sends people to `/agents`, this
release's CLI hints name `/settings/integrations`, `/settings/people`
and `/settings/agent-access`, and the API, MCP and publish hints it
served say the same, as do bookmarks people make.
- **Does the release before it still work with that?** No. It serves
none of `/agents…` or `/settings/…`, so every one of those links and
hints answers 404 until production rolls forward again. Nothing else
breaks: no data or schema changes. Labelled `one-way`.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated by Fermy.

<!-- patchy-dev:compare:allison -->

#### Before and after, as Allison Mahmood (admin)

Before is `0a78106` (where this branch left main) and after is `529f6be`
(ui/u-addresses), both on the `brightline` scenario, from `pnpm dev
compare`.

##### `/machines`

**1280px, after**

![After: /machines at
1280px](https://github.com/user-attachments/assets/5d9f5f83-85bd-450d-a8d0-922664d71f6c)

<details><summary>1280px, before</summary>

![Before: /machines at
1280px](https://github.com/user-attachments/assets/809206ef-52d2-4a6f-a38f-4f7ba223093f)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /machines at
390px](https://github.com/user-attachments/assets/5b269bee-e9e3-4d97-965a-84fb39fcf24e)
| ![After: /machines at
390px](https://github.com/user-attachments/assets/f6c6844d-d6e1-4207-868c-9fcac37dd8b1)
|

##### `/machines?agent=codex`

**1280px, after**

![After: /machines?agent=codex at
1280px](https://github.com/user-attachments/assets/ed835e8f-fe5f-4fec-b1bc-01a92fe99871)

<details><summary>1280px, before</summary>

![Before: /machines?agent=codex at
1280px](https://github.com/user-attachments/assets/6c322fc0-2e4d-4f60-b54e-9b206a0f7cf8)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /machines?agent=codex at
390px](https://github.com/user-attachments/assets/ad85cfea-863e-4f83-bc60-19179f439234)
| ![After: /machines?agent=codex at
390px](https://github.com/user-attachments/assets/337c5748-c3be-49da-b0e1-dec374238319)
|

##### `/agents/computer`

**1280px, after**

![After: /agents/computer at
1280px](https://github.com/user-attachments/assets/bd137049-1899-4f77-94c2-67d59702fca3)

<details><summary>1280px, before</summary>

![Before: /agents/computer at
1280px](https://github.com/user-attachments/assets/c0fcdab8-3792-47e9-83f2-ab77696578f3)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /agents/computer at
390px](https://github.com/user-attachments/assets/778f167c-fe67-49fe-934e-3547fd719424)
| ![After: /agents/computer at
390px](https://github.com/user-attachments/assets/b0e8f065-f304-40d6-bea7-b9da60e1c0f5)
|

- Before at 1280px answered 404; 1 browser error(s): `Failed to load
resource: the server responded with a status of 404 (Not Found)`.
- Before at 390px answered 404; 1 browser error(s): `Failed to load
resource: the server responded with a status of 404 (Not Found)`.

##### `/company`

**1280px, after**

![After: /company at
1280px](https://github.com/user-attachments/assets/0f2b2e47-dc63-458f-9f22-d7efe25cb2f0)

No visible change at 1280px.

| Width | Before | After |
| --- | --- | --- |
| 390px | No visible change | ![After: /company at
390px](https://github.com/user-attachments/assets/5c7cef63-832c-4528-bdac-42a1c221204e)
|

<!-- /patchy-dev:compare:allison -->

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
…h's sheet or the account menu (#1301)

## What changed

Speech input can type a letter that fires a patch's single-key shortcut.
#1224 lets each person turn those off. #1276 stores the choice and #1279
taught `patchy/hotkeys` to obey it, but nothing passed the choice to a
patch yet. Now Patchy's shell does:
- it names a viewer's patch frame with their setting;
- the shortcuts sheet's row opens Patchy's own dialog to change it;
- the account menu gets the same switch;
- a version built before the setting tells a viewer who turned shortcuts
off that its shortcuts still work.

This is the top of the stack `main ← #1297 ← #1255 ← #1256 ← #1279 ←
#1276 ← this`, and the six land together. #1302, CI's move to desktop
Chromium, waits on #1402 and lands later. It's restacked onto `main`
after the UI overhaul (#1332–#1354) and the switcher (#1298, #1304), and
ported to both. The restack comment says what changed beyond conflict
resolution.

Closes #1275
Closes #1224

## Look at

**1. The frame is named in the shell's static markup, not by a script
that creates it.** A parser-created iframe gets its `name` attribute
before its browsing context exists. So the server renders
`name="patchy:shortcuts=on|off"` on the existing static iframe, after
`main`'s `data-waiting`, and only for a company or local shell rendered
for its viewer (`shell.ts`, `Pages.ts`). A public shell is everyone's
document, a member's included since #1339, so it never carries one, and
`renderPatchWrapper` throws if asked to. Probed before choosing, in
Chromium and Firefox:

| Probe, a sandboxed frame whose `src` a deferred script sets | Chromium
| Firefox |
| --- | --- | --- |
| Static markup with `name`: first load, a reload after the value
changed, back after it changed | `off`, `on`, `on` | `off`, `on`, `on` |
| A `<template>` cloned by script, as the ticket's creator would | same
| same |

In desktop Chromium, where the frame runs in its own process, the patch
reads `window.name === "patchy:shortcuts=off"` on first load and after a
new version's Reload re-creates the frame. Static markup keeps three
things:
- **No inline script and no CSP change.** The shell still admits only
the switcher relay's hash.
- **Both mixed-release pairings work.** The markup is `main`'s plus one
attribute (and `data-shortcuts-note`), so an older broker mounts it
unchanged, and this broker mounts an older unnamed shell as before.
`render.test.ts` pins that the frame differs from the unnamed one only
by its name.
- **Every re-creation renders again.** A new-version reload is a fresh
server render.

**2. Patchy's dialog** (`packages/serving/src/shortcuts.ts`), from the
mock's direction C. A running patch's shell keeps its own pinned style
subset on `main` (`servedStyles`; the overhaul left patch shells alone).
So the dialog stays a `shell-scrim` over one `note-info` `note-float`,
with `glyph-sm`, the primary button and a quiet Cancel. The setting's On
or Off is a served `tag` after the question. The old `pill` isn't in
that subset, and `main`'s pin test would refuse it, so it's gone.

| | Desktop | Phone |
| --- | --- | --- |
| The sheet's row | ![The sheet with its Single-key shortcuts row
reading Off, and dashed
keycaps](https://github.com/user-attachments/assets/081d4f78-b123-40f3-a830-5ddcbd14fd2d)
| ![The sheet as a bottom sheet on a phone, its row reading
Off](https://github.com/user-attachments/assets/6b720ace-142a-4a84-a102-0deae6fd486e)
|
| Patchy's dialog | ![Patchy's dialog: Turn off single-key shortcuts in
every patch except public ones?, an ON tag, Turn off and
Cancel](https://github.com/user-attachments/assets/e90123d3-9e4f-47ec-babb-19534349f39a)
| ![The dialog centred on a
phone](https://github.com/user-attachments/assets/5e214a77-e990-4efe-a882-7f41efdd8cb9)
|
| A failed save | ![The dialog turned amber, saying Couldn't save.
Nothing changed., with Try
again](https://github.com/user-attachments/assets/ec24539c-2f35-4fd6-8a30-48d2f291b7c4)
| ![The failed save on a
phone](https://github.com/user-attachments/assets/d540007f-c910-4ac5-961b-b2b21c42181b)
|

The sheet is the SDK's, drawn in the patch's own frame by #1279, and
`main` hasn't touched it.

The copy and the failure pattern are as reviewed:
- The title says what the switch covers: "Turn off single-key shortcuts
in every patch except public ones?", or "Turn on …". The buttons are
**Turn off**, **Turn on** and **Cancel**.
- A refused save, a 200 without `{ value }` and an empty 200 all turn
the note `note-warn`, with the alert line "Couldn't save. Nothing
changed." and **Try again**.

The abuse rules, each a step of the browser spec:
- One dialog at a time.
- A question needs `navigator.userActivation.isActive` in the shell.
- However the dialog closes, it arms a flag: Turn off or Turn on,
Cancel, Escape, or the browser closing it, mid-save or not. The flag
holds new dialogs off until a 250 ms poll reads the old activation as
lapsed. So a request on the press that answered the last dialog gets the
value with no dialog, and only a fresh press opens another.
- Only an `isTrusted` click saves.
- Dismissing never waits. Cancel or Escape mid-save closes the dialog at
once and returns focus to the frame. The save keeps the one-dialog slot
until the route answers, and the operation then resolves with what the
route stored, or with the setting as it was if the save failed or timed
out after 35 s.
- While tier 2's tools are starting, a question gets the setting as it
is.
- **New with the switcher:** while Patchy's switcher is open, a question
also gets the setting as it is, as the starting cover waits for it. If
the switcher is open over the dialog when it closes, the dialog leaves
focus with the switcher, which hands it back.

**3. The account menu's switch**, a no-script form in `main`'s personal
menu: name, Your agents, the switch, Sign out. It posts the value it
switches to, with `return` set to the page. On the overhaul's component
set, the item is the switch: a `menu-item` with `role="switch"` and
`aria-checked`, the `keyboard` icon, and core's `switch` drawn at its
end in the item's state. Core's `fields` and `menus` chunks gained the
two selectors that draw it. The account menu is 248px wide, up from 220,
so the label stays on one line beside the switch.

| Before | Off | After the press: the receipt, and On |
| --- | --- | --- |
| ![The account menu with name, email, Your agents and Sign
out](https://github.com/user-attachments/assets/f1ba9ba2-2514-402a-a1bf-1f83643bbd7f)
| ![The account menu with the Single-key shortcuts switch
off](https://github.com/user-attachments/assets/171a45ef-a592-41a0-b810-09315d9013cb)
| ![The receipt Turned on single-key shortcuts, and the switch
on](https://github.com/user-attachments/assets/c4c0bfb2-71eb-4cfd-9661-dbf575eab48b)
|
| ![The phone menu
before](https://github.com/user-attachments/assets/e3c6daf1-7faf-4d7f-adc7-b80a9301fefc)
| ![The phone menu with the switch
off](https://github.com/user-attachments/assets/4c450fa9-8bea-4e0f-825c-66d74866f9ac)
| ![The phone menu after the press, the switch
on](https://github.com/user-attachments/assets/ea8ca452-812a-4804-9780-acc608bab291)
|

"Before" is this branch's page with the switch's form removed in the
browser, which is exactly `main`'s account menu. `ViewerApi.ts` reads
the form before the session, so a signed-out post that names `return`
goes back to that page, whose own door signs in there.

**4. D1's note.** The note shows to a viewer whose setting is Off, on a
version from 0.33.0 on that doesn't claim `shortcutSetting`, unless its
recorded imports leave out `patchy/hotkeys`.
- **Only a repo build claims `shortcutSetting: 1`**
(`MANIFEST_CAPABILITIES` in `@patchy/api`). A single HTML file may carry
an older SDK bundled inline, so it claims nothing.
- **Recorded imports refine D1's release rule.** A repo build without
`patchy/hotkeys` in `sdkImports` gets no note. A single file records no
imports, so the release rule decides: from 0.33.0 on, the note shows.
- The note reuses the new-version bar in the shared bottom stack: "This
patch's single-key shortcuts still work until it's updated." with a
quiet **Dismiss**, kept per patch in the shell's `localStorage`.

| Desktop | Phone |
| --- | --- |
| ![The note bar at the bottom over the 0.38 bundle: This patch's
single-key shortcuts still work until it's updated.
Dismiss](https://github.com/user-attachments/assets/456c09d9-7ca4-4d06-87d3-50df231178cb)
| ![The note as a bottom sheet on a
phone](https://github.com/user-attachments/assets/f312e473-d3c0-4e65-aa50-91a34fc7fca4)
|

**5. The flow**, desktop then phone. The sheet's row leads to Patchy's
dialog, Turn off brings the sheet back on its row reading Off, then the
account menu turns them back on.


https://github.com/user-attachments/assets/d604fe56-04cd-416c-83fa-42e4beebc2f0


https://github.com/user-attachments/assets/17f547e2-472b-4c2d-90ac-98884108c875

## How it was verified

- **Unit (vitest)**, with the rest of the stack's touched files: 35
files, 330 tests, plus core's style rules, gallery and served-style pin
(358 with `render.test.ts`):
- `render.test.ts`: the frame's name after `data-waiting` in static
markup, and that it is the only difference from an unnamed frame. A
public shell refuses a viewer's setting. `ignoresShortcutSetting`'s
cases.
- `html.test.ts`: the account menu's switch, its value, its `return`,
and escaping.
  - `ViewerApi.test.ts`: a signed-out form post goes back to its page.
- `devServer.test.ts`: each dev person's own setting, and the route,
which writes the file before it changes what shells read.
- `executeConfig.test.ts`: a repo build's manifest records
`shortcutSetting`.
- `served-styles.test.ts`: the served styles' digest moved on purpose,
for the one rule that keeps the dialog's tag whole.
- **The browser tier** (`test/browser-tier1/shortcut-setting.spec.ts`):
thirteen tests on published patches through the real shell and broker,
as reviewed. That includes the committed 0.38 bundle
(`hotkeys-0.38.html`), whose shortcuts still fire under this shell with
Off stored, with no row and with the note.

  | Engine | Result |
  | --- | --- |
| Desktop Chromium, `channel: "chromium"`, frame isolated, from a local
config | 13 passed |
  | Chromium headless shell, as CI runs it | 13 passed |

`hotkeys.spec.ts` and `focus.spec.ts` pass in both as well. Company
patches put the setting's row first in the sheet's Tab order. The
unnamed-frame test opens a public patch.
- **The whole tier 1 suite** at this stack's top (`06476fe`), as `pnpm
verify` runs it in CI's headless shell: 168 of 168. At the previous
push, with #1302's desktop project as well, it also passed 168 of 168.
- **The rollback rehearsal**, against the live release 41 (`7f93b91`):
`7f93b91 → 06476fe → 7f93b91 → 06476fe`, all four steps passed in 116 s.
It covers #1276's migration, and the live release serving a repo build
that this head's CLI wrote with `shortcutSetting`.
- `pnpm verify` at this head: format, lint, typecheck, synth,
postgres-concurrency, cli-smoke, install, tier2-smoke and browser pass.
`test` and `test (bun)` had 15 timeouts while the machine's load average
was near 30. All 11 files rerun alone pass (216 tests), as does Bun's
`PatchesApi` (63). The previous push's `pnpm verify` passed every step.
The served shell's page state is exempt from the page-markup rules in
`.oxlintrc.json`, and `shortcuts.ts` joins `stream-status.ts` and
`downloads.ts` there for the same reason.
- **Hit every surface.**
  - Wire contract: `docs/API.md` is regenerated and current.
- CLI: README, the `patchy-hotkeys` project skill and the capability
catalogue. No command, flag or exit code changed.
  - Dev loop: `docs/DEVELOPMENT.md` and the `patchy-dev-loop` skill.
- Vocabulary: the Companies and patchy glossaries, and
`docs/product.md`.
- Served pages: the `ui-consistency` spec names the menu's switch, the
dialog and note in the shell's exception, and `shortcuts.ts` in the lint
exemption.
  - Reverse states: the switch turns it back on from both places.
- Not applicable: migrations (#1276's), company resources and the repo
layout.
- **Not run on this head:** Firefox and WebKit. Firefox passed 12 of 13
before the port, the tier 2 test being Chromium-only. WebKit can't
launch here, and CI has no WebKit.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

The release that carries this carries the whole stack. Nothing needs
action. A viewer's shortcuts stay on until they turn them off, and
patches published before it behave as they did until rebuilt.

Suggested `patchChanges` line for the release, beside #1279's:

> patchy/hotkeys: a viewer can now turn single-key shortcuts off. Then a
page-wide hotkey whose every step types a character, such as `A`, `G H`
or `?`, fires nothing, while chords, named keys and hotkeys `within` an
element still fire. Label those commands so the sheet keeps them as
buttons, and write a key that belongs to one part of the page `within`
it. `window.name` carries the setting and is Patchy's: don't set it.

Landing note: #1276's migration is `0038_single_key_shortcuts`, above
#1217's `0037_feedback`. If another migration lands first, it renumbers.

- **What does a revert leave behind?**
- `shortcutSetting: 1` in the manifests of repo builds published
meanwhile. The release before reads stored manifests without refusing
extra keys, and in the rehearsal it served a version that carried the
field.
  - People's stored settings, from #1276.
  - Dismissed-note keys in browsers' `localStorage`.
- A CLI of this release refuses to publish to an older instance before
sending anything, as any mismatched release does.
- **Does the release before it still work with that?** Yes. Its shell
names no frame, so every shortcut is on, the sheet hides its row, and no
note shows.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3
Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite now runs desktop
Chromium in new headless mode. One test whose accessibility helper can't see
an out-of-process frame stays in the headless shell (#1306).

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite's chromium project now
runs desktop Chromium in new headless mode, every test in it; the firefox
project still runs focus.spec.ts alone.

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process

Desktop Chromium runs a patch's sandboxed frame in its own process and
Playwright's default headless shell keeps it in the shell's, so focus and
keyboard checks could pass in CI and fail in Chrome (#1299, fixed on main by
the relay's hello handoff in #1298). The tier 1 suite's chromium project now
runs desktop Chromium in new headless mode, every test in it; the firefox
project still runs focus.spec.ts alone.

Closes #1299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… its own process (#1302)

## What changed

CI's browser tier ran Playwright's `chrome-headless-shell`, which keeps
a patch's sandboxed frame in the shell's process. Desktop Chrome gives
it its own process. That's how #1299 shipped: in desktop Chrome a patch
didn't hear the keyboard until clicked, while CI was green. #1298 fixed
#1299 on `main`.

This PR moves the tier 1 suite's `chromium` project to desktop Chromium,
so a focus or keyboard bug that only Chrome shows fails CI. It no longer
holds anything back: every test in the suite runs in desktop Chromium.
#1407's `firefox` project still runs `focus.spec.ts` alone.

Closes #1299

## Look at

**`playwright.tier1.config.ts`.** The `chromium` project sets `channel:
"chromium"`, the full build in new headless mode, and #1407's `firefox`
project sits beside it unchanged. The headless-shell hold-out is gone.
#1406 fixed the local-hotkeys test's accessibility helper, which
couldn't read an out-of-process frame, and the test now passes in
desktop Chromium. `pnpm test:browser` runs `chromium`, as on `main`, so
`package.json` doesn't change.

**What landed first.** In desktop Chromium on CI, `switcher.spec.ts`
failed often (#1402). #1412 fixed that on `main`, with one real
desktop-Chrome focus race fixed in the shell's broker and switcher tests
that acted too early. One of #1412's tests, the tab switch in
`switcher.spec.ts`, skips in the headless shell, which keeps every tab
focused. It starts running on CI with this PR.

**The frame really is out of process.** CDP's `Target.getTargets` lists
it as its own `iframe` target in desktop Chromium, and not in the
headless shell.

## How it was verified

- **On CI at this head, `a92a7f1`:** the `browser` job passed twice in a
row. Each time desktop Chromium passed 180 and Firefox 8, with none
failed or skipped. The local-hotkeys test and the tab-switch test ran in
desktop Chromium.
- **Locally:** the local-hotkeys test passed 3 of 3 in desktop Chromium,
and the Firefox project 8 of 8.
- **Earlier heads, stacked on #1412 before it merged:**
- Five passes in a row at its first head, and two or three at each later
one.
  - One failure was the #1377 flake, since fixed on `main` by #1414.
- One `test (bun)` failure was a `Fleet.test.ts` clock-step case, which
passed on rerun.
- The other failures were gaps in #1412's own fix, each fixed in #1412.
- **CI cost.** No new download. `playwright install chromium` without
`--only-shell` already puts both Chromium builds in Chromium's cache
entry, and the action's comment says why it stays that way.
- **Not checked:** headed Chrome on a real display. New headless is the
same browser build and runs the frame out of process, as the target
count shows.

Hit every surface:
- **Dev loop docs:** `docs/DEVELOPMENT.md` says the browser job runs
desktop Chromium with `focus.spec.ts` also in Firefox, and that a script
launching its own browser for a focus check passes the same channel. The
CI job's and the Playwright action's comments say the same.
- **Doesn't apply:** served pages, the wire contract, the CLI,
vocabulary, migrations, company resources, reverse states and the repo
layout.

## Release impact

Tick exactly one.

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required. Test and CI configuration
and doc lines; nothing ships.

- **What does a revert leave behind?** Nothing. CI goes back to the
headless shell.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3
Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area area:integrations Company connections and integration implementations area:server Touches the server area area:ui Portal and first-party browser pages, shared rendering and styles size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(serving): Mod+Shift+K never reaches a patch or the browser

1 participant