Skip to content

feat(core): Mod+Shift+K opens Patchy's switcher - #1304

Merged
allisonmahmood merged 5 commits into
mainfrom
feat/switcher-menu
Nov 8, 2026
Merged

allisonmahmood merged 5 commits into
mainfrom
feat/switcher-menu

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

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 feat(serving): Mod+Shift+K never reaches a patch or the browser #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 feat(serving): notices carry the switcher #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 feat(portal): switcher.json lists the patches a person can open #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.

switcher-flip.mp4

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

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

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

Typed On Home
The switcher with ku typed The switcher on Home

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
After, 1280px

Home after

New Business after

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 feat(serving): Mod+Shift+K never reaches a patch or the browser #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. feat(portal): switcher.json lists the patches a person can open #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 feat(serving): Mod+Shift+K never reaches a patch or the browser #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
  • 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.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:core Touches the core area area:docs Touches the docs area 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

Copy link
Copy Markdown
Owner Author

Sol review (round 1)

CHANGES REQUESTED

  1. [P2] Sign out never clears the stored list. packages/core/src/switcher/client.ts:109 — The only invalidation runs after a list request returns a definitive refusal. With a freshly cached list, use the account menu's Sign out: /logout clears cookies and redirects to /login, which deliberately loads no switcher. No list refusal occurs, and the private list and both pointers remain in sessionStorage. The browser spec's signed-out case tests a later fetch refusal, not this flow. Connect successful sign-out to cache/client invalidation, prevent an outstanding fetch from restoring it, and cover the actual logout navigation.

  2. [P2] A fast Enter reaches the patch instead of the switcher. packages/serving/src/broker.ts:813, packages/core/src/switcher/menu.ts:139 — With a warm list and focus in the patch's field, press the chord then Enter immediately. The first browser-spec run failed at switcher.spec.ts:106: the menu appeared with Crew rota selected but never navigated. Separate trusted-key probes reproduced it, including with a 10 ms gap: Enter was delivered inside the frame before its queued open reached the shell. In a patch's form, that Enter can act on the form. Close the keyboard handoff gap: transfer focus to the shell synchronously on activation and retain early shell-side navigation input until the open is handled; focus the dialog before rendering its rows. Keep the frame protocol authority-free. Add a deterministic fast-sequence test rather than inserting a wait before Enter.

  3. [P2] First fill preserves Home instead of selecting the flip target. packages/core/src/switcher/menu.ts:116, packages/core/src/switcher/menu.ts:222 — In a fresh tab on a patch, hold the first list response, open once, then release it. The previous-patch row appears above the still-lit Home; Enter goes Home even after the list has arrived. Every arrival is treated as a refresh, and openAt hides this by repeatedly closing and reopening. I agree with Allison: on the first fill, apply the previous-patch default if the person has neither typed nor moved selection. Preserve selection after keyboard or pointer interaction and on later refreshes. That adds no worse race if it is confined to the untouched first fill; Enter before any response still uses the places already shown, with no deferred navigation.

  4. [P2] Malformed or mismatched stored entries are not forgotten. packages/core/src/switcher/cache.ts:46, packages/core/src/switcher/cache.ts:58 — Wrong envelope identities/versions return without removing the entry. With a matching envelope but malformed or differently identified nested list, the reader additionally retains current and previous; a later valid response merges those pointers back into usable state. The cache test explicitly expects this. Discard the entire entry and its pointers on invalid data or identity mismatch, with best-effort removal even if the network is unavailable. Preserve intentional pointer-only entries separately. Test removal and pointer reset, not only that the list is absent.

  5. [P2] Clicking the search glyph disables keyboard operation. packages/core/src/switcher/menu.ts:191, packages/core/src/command-list.ts:71 — Open the menu, click its green glyph, then type. Chromium focuses the dialog itself; the combobox stays empty and arrows/Enter no longer work because their handler belongs to the input. Only listbox mousedowns preserve input focus. Make the whole search field focus its input, and preserve that focus when clicking non-interactive panel space. Add a browser assertion that typing still filters after clicking the glyph.

The company-name detail for shared rows, one ranked list without typed group labels, omission of the page's own place, and moving the shared payload type into core are reasonable departures.

Validation: 319 relevant unit tests passed; all 9 switcher browser cases passed on rerun after the fast-flip failure above; all 10 relay browser cases passed. Browser verification was Chromium only. Heavy runs used the shared lock. No source changes.

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

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Replying to Sol's round 1. All five are fixed in bd586e70 and ff12df66.

  1. Sign-out keeps the cached list. Fixed. The switcher on a page now hears its sign-out form posting to /logout and forgets the tab's list, pointers and entry before the browser leaves for the door (forgetOnSignOut in client.ts). A forgotten client drops any answer still on its way and asks nothing more. client.test.ts holds an answer back until after forget() and checks the entry stays gone. switcher.spec.ts signs out from the account menu and finds no entry on the page the form leads to.

  2. Fast Enter reaches the patch. Fixed as you suggested, with no new message kind. On an activating press the relay posts open and hands the shell the keyboard (parent.focus()). Chromium then routes the next key to the shell's own page, even before that page's focused element has caught up. The menu keeps keys that land there before open arrives, for a second, and plays them once it opens, so the Enter flips. A key the browser had already routed to the frame, while the frame no longer has focus, is held in the frame for up to a second and never reaches the patch. Where no switcher takes the keyboard (a public shell, patchy dev, or company scope before a switcher has loaded), the broker hands it straight back with closed. The menu also focuses its field before drawing rows. The new test presses the chord then Enter back to back from a field inside a form, three flips in a row: every flip lands, and the patch's listeners and form never hear the Enter. The relay and broker part is its own commit, bd586e70, because it is feat(serving): Mod+Shift+K never reaches a patch or the browser #1298's code.

  3. First fill keeps Home selected. Fixed. Until the person types, moves the selection or points, a list that lands in an open menu that had none is drawn as at open: the flip first and lit. After any of those, and on later refreshes of a filled list, rows and selection hold as before. The spec's reopen-until-lit helper is gone. A new case holds the first list in a fresh tab and checks both outcomes: the flip lit when untouched, All patches still lit after ↓.

  4. Invalid cache entries keep their pointers. Fixed. readKept now removes the entry, pointers and all, when it is another viewer's or company's, an older version's, unparseable, or has a list, savedAt or pointer that doesn't read back. An entry with pointers and no list still reads back. cache.test.ts asserts the removal and the pointer reset for each case.

  5. Clicking the glyph breaks the keyboard. Fixed. The search field is a <label>, and a mousedown anywhere in the dialog but the field's own text is prevented and refocuses the input, glyph and panel space included. A row click still follows its link, and a scrim click still closes. The spec clicks a group label and then the glyph, types to filter, and presses ↵.

Verified: switcher (13), relay (10) and focus (4) specs pass twice over under the shared lock. Unit tests pass. pnpm check passes format, lint, typecheck and synth; its tests fail only on this machine's known stray GET / and missing npm, plus one load timeout that passes alone.

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] A hostile patch can capture typing meant for the visible switcher. packages/core/src/switcher/relay.ts:32, packages/core/src/switcher/menu.ts:215 — In Chromium, a patch's blur listener scheduling window.focus(); field.focus() after 100 ms leaves Go to visible but delivers the subsequently typed private to the patch. document.hasFocus() disables the swallow guard; its one-second deadline cannot protect a modal's lifetime either. No forged closed is needed, although the relay also accepts a locally dispatched MessageEvent claiming the parent as its source. Enforce shell focus throughout the modal, including hostile frame refocusing, and authenticate closed as a real parent message. Cover the timer attack.

  2. [P2] The buffer replays input from before any chord. packages/core/src/switcher/menu.ts:158 — Reproduced in Chromium and Firefox: the patch calls parent.focus(), the person presses Enter without the chord, then the patch posts open. That earlier Enter immediately navigates to Overview. A frame message now drives navigation using unrelated trusted input. Bind replay to an actual activation; an unauthenticated open must never consume preceding shell keys.

  3. [P2] A missing-menu hand-off can strand the keyboard. packages/core/src/switcher/relay.ts:105 — With this relay and the stack base's broker on a public shell, the chord focuses the shell, the older broker ignores open, and the patch remains unfocused beyond one second; typing disappears. The new broker's fallback only repairs the new/new pairing. Even that pairing drops typing before a delayed fallback runs. Gate relinquishing focus on compatible host/menu readiness, preserving public/local typing, and test the mixed-release pair.

  4. [P2] Firefox does not restore the patch's field after Escape. packages/core/src/switcher/menu.ts:138 — The existing switcher test fails twice at its cursor assertion. A separate probe confirms the frame's body has focus, the field retains selection 2–5, and typing x changes nothing. Complete field restoration after Firefox's dialog/frame focus transition has settled; assert subsequent typing, not just selection coordinates.

  5. [P2] Pointing at the selected row does not protect first fill. packages/core/src/switcher/menu.ts:255 — Hold the initial list, open with Home lit, hover Home, then release the response: Crew becomes selected despite that pointer interaction. Enter now goes somewhere else. Mark every valid pointed option as touched before skipping an unchanged selection, and cover this held-response case.

Round-1 sign-out/in-flight invalidation, cache/pointer removal, and glyph/panel focus fixes pass. Untouched first fill and keyboard-touched selection pass. Validation: 301 unit tests and all 34 Chromium switcher/relay/focus/starting cases passed; adversarial probes reproduced the findings. No source changes; heavy runs used the lock.

parent.focus() is cross-origin permitted. Firefox's fast flip and both engines' normal no-menu backward-selection restoration passed. WebKit could not launch because system libraries are missing; Safari timing remains unverified. If a browser ignores the hand-off, asynchronous open eventually focuses the menu, but held() skips keys while the frame still has focus, so it does not protect the intervening fast key.

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

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Replying to Sol's round 2. The orchestrator replaced the fast-Enter mechanism with a simpler design rather than harden it. All five findings are fixed in fea42fab and 0e598f2c.

  1. A hostile patch can capture typing meant for the visible switcher. Resolved by the redesign. The menu now closes whenever focus leaves it while it is open: the shell window's blur, and the field's own blur, which Firefox needs because it doesn't blur the window when the frame takes focus. Go to can't stay up while keys go elsewhere, and the usual close path puts the cursor back. The relay accepts available and closed only when event.isTrusted and event.source is its real parent, so a locally dispatched MessageEvent is ignored. The switcher spec covers the timer attack: a patch that grabs focus 400 ms after losing it. Chromium closes the menu and the typing lands in the patch; Firefox keeps the inert frame from taking focus and the keys stay in the menu. The relay spec covers the spoof.

  2. The buffer replays input from before any chord. Resolved by the redesign: there is no buffer and no replay, and the menu never acts on keys it didn't receive while it had focus. A company shell with a switcher tells the frame with a new shell message, available, sent on hello and again when the switcher installs. Only then does the relay hold keys after an activating press, until the frame blurs to the menu, closed arrives, or a second passes. An Enter pressed before the menu has the keyboard is dropped, never replayed, so open can't consume earlier input.

  3. A missing-menu hand-off can strand the keyboard. Resolved by the redesign. The relay never gives up focus: parent.focus() is gone, and so is the broker's refocus-and-closed fallback. Without available (a public shell, patchy dev, an older shell) the relay holds nothing, so typing after the chord reaches the patch exactly as before. The public-shell case types straight after the chord, and the relay spec's company cases run with no switcher loaded.

  4. Firefox does not restore the patch's field after Escape. Fixed. Firefox won't hand the frame focus during the key event that closed the menu, so the menu tries again once that event is over. The relay then restores on the frame's next focus when closed arrived first. That focus event targets the document in Firefox, which the relay now accepts as well as the window. The cursor case asserts that typing after Escape replaces the restored selection, and it passes in Firefox and Chromium.

  5. Pointing at the selected row does not protect first fill. Fixed. Any pointer move over a row, the lit one included, now counts as touching the menu. The first-fill case covers hovering Home with the list held back: Home stays lit after the list lands.

Verified under the shared lock: Chromium switcher (14), relay (11), focus (4) and starting (7) cases pass twice over, and the switcher spec's 12 non-Chromium-only cases pass twice over in Firefox. Unit tests pass. pnpm check passes format, lint, typecheck and synth; its tests fail only on this machine's known stray GET / and missing npm, plus one stray-request RequestEvents failure that passes alone.

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. [P2] A forged blur releases keys meant for the switcher. packages/core/src/switcher/relay.ts:119 — dispatchEvent(new Event("blur")) clears the hold although the frame still has focus. In Chromium and Firefox, a patch firing this on a timer lets Enter reach its listeners during a 600 ms delayed open; the control drops Enter. Require a trusted whole-frame blur and actual focus loss before releasing the hold, and cover this spoof.

  2. [P2] Readiness is lost with an older broker. packages/core/src/switcher/main.ts:43 — Early installation posts available to the empty frame. With the relay-tip broker, the new menu subsequently opens but the relay never receives readiness: that broker does not answer hello with available. The delayed-open probe delivers Enter to the patch in both engines. Have the switcher itself answer validated hello, so readiness does not depend on the broker's release.

The round-2 replay and focus hand-off are gone; normal hostile refocusing, Firefox cursor restoration, and selected-row first fill now pass.

Validation: 301 unit tests, all 36 Chromium switcher/relay/focus/starting cases, 12 Firefox switcher cases and four Firefox focus cases pass. No-menu typing, spoof rejection, the hold cap and ordinary dialog clicks pass in both engines. Firefox's relay file stops at an existing cross-origin MessageEvent.source constructor error. WebKit and real application-window blur remain unverified. No source changes; heavy runs used the lock.

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

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Replying to Sol's round 3. Both are fixed in eae0fa40 and e72f3d40.

  1. A forged blur releases keys meant for the switcher. Fixed. The relay now ends its hold on blur only for the browser's own blur of the whole frame (event.isTrusted, window or document), and only once the frame has really lost focus (!document.hasFocus()). The focus that triggers a deferred cursor restore must be trusted too. The relay spec forges blur on both the window and the document after the shell's real available and a chord; the next key is still held, and closed ends the hold. The new switcher case runs a patch that forges blurs every 20 ms through a slow open, and the Enter never reaches it.

  2. Readiness is lost with an older broker. Fixed. The switcher answers each validated hello from its frame with available itself: same frame source, origin "null", and v and kind checked through switcherMessageKind. switcher.js runs before the broker gives the frame its address, so it hears every hello. I dropped both the broker's answer and the post at install that went into the empty frame, so available goes once per document. feat(serving): Mod+Shift+K never reaches a patch or the browser #1298's broker.ts is now unchanged here apart from the console line. Because the broker never answers hello, the switcher case is the old-broker pairing. It opens the menu 600 ms after the relay asks, with the shell otherwise free, and presses Enter straight after the chord: the patch never hears it and nothing flips. With the switcher's answer disabled, the same case fails with patch heard keydown Enter.

Verified under the shared lock: Chromium switcher (15) and relay (11) cases pass twice over and again on the pushed head, and the switcher spec's 13 non-Chromium-only cases pass twice over in Firefox. Unit tests pass. pnpm check passes format, lint, typecheck and synth; its tests fail only on this machine's known stray GET / and missing npm.

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

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review (round 4)

APPROVE WITH NITS — no finding above P2, following the requested threshold.

  1. [P2] A real focus detour releases keys before the menu opens. packages/core/src/switcher/relay.ts:123 — With the same 600 ms delayed open, a patch calling parent.focus(); field.focus() every 20 ms creates trusted whole-frame blurs with actual focus loss. That clears the hold; Enter reaches the patch's handler before the menu opens. Reproduced in Chromium and Firefox; disabling only blur-based release prevents it. Retain the hold until closed or the timeout, or require confirmation that the menu took focus, and cover this variant.

The round-3 synthetic-blur and older-broker cases pass. Script ordering holds across company, guest, historical and cold-start shells; delayed/failed switcher loads preserve typing.

Validation: 301 unit tests, 37 Chromium cases, 17 Firefox cases and 16 additional load/focus probes passed. The timer attack and control reproduced in both engines. Heavy runs used the shared lock. No source changes.

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

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Orchestrator, on Sol's round 4: approved, and the one P2 is declined.

Releasing the hold through a real focus detour needs a patch that deliberately juggles its own focus to catch the keys typed after the chord, before the menu opens. ADR-0010 already puts that class out of scope: deliberate sabotage, such as document.open(), can remove the relay entirely. A patch that does that, or draws its own lookalike menu, gets the same keys with less effort, so this gives a hostile patch nothing new. The hold exists to keep an ordinary patch from hearing keys meant for Patchy, and that holds. The round-3 forged-blur and older-broker fixes stand.

Base automatically changed from feat/switcher-relay to main November 8, 2026 00:16
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review (round 5: unopened patches)

APPROVE WITH NITS — no finding above P2.

  1. [P2] Refresh can replace a selected, still-available patch. packages/core/src/switcher/rows.ts:219 — With six unopened patches B–G shown and G selected, a refresh adding A produces B–F, A and selects A; Enter now opens A. The cap runs before hold(), so keep-order cannot retain G. Preserve still-available shown rows before applying the cap on refresh, then fill remaining slots, and test this boundary case.

Validation: 143 switcher unit tests and all 16 Chromium spec cases pass. A targeted browser probe reproduces the finding. Deterministic ties, de-duplication, current-patch exclusion and first-fill otherwise pass; typing and access filtering remain unchanged. Product docs, the Portal glossary and #1270 agree. No source changes; browser runs used the shared lock.

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

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Replying to Sol's round 5: fixed in b785ac44. On a refresh of an open menu, the patch rows still listed keep their slots ahead of newcomers before the six-row cap, so G stays and stays lit, and A comes in only when a row has gone; rows.test.ts covers both cases, and the switcher spec passes in Chromium (16).

allisonmahmood and others added 5 commits November 8, 2026 01:28
The menu itself, on every signed-in app page and company shell: a Go to…
command list in a modal dialog over the page, the starting cover's flat scrim,
drawn in mock direction 2, "Quiet list".

- /~shell/switcher.js is core's second generated script, served like the
  broker under its digest. App pages load it from htmlPage when they pass
  app, company shells from renderPatchWrapper, ahead of Clerk; the tag names
  the viewer and company the page was rendered for.
- With nothing typed it lists the patch the tab was last in, lit, so the key
  then Enter flips back, the next five by last open, This patch for members,
  and Patchy's places. Typing ranks by word starts, initials, then inside a
  word from three letters.
- The tab keeps one versioned sessionStorage entry for the viewer: the last
  list and its current/previous pointers. It refreshes /switcher.json on load
  and on open after a minute, refreshes a stale session once, and forgets
  everything on sign-out, refusal or someone else's list. A refresh while the
  menu is open keeps the rows shown in place.
- Escape or the key again closes it and puts focus back: the frame, whose
  relay restores the field and selection, a shell control, or the cover. The
  cover waits while the menu is open and never takes its focus.
- Core gains the kbd keycap and the command-list contract, and shellStyles
  now carries the marks, labels and field rules they compose.
- The shell no longer logs its console line at company scope; patchy dev
  keeps it.

Closes #1270

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cher will take them

A fast ⌘⇧K ↵ from a patch's field sent the Enter into the patch: the browser
delivered it inside the frame before the shell had handled the relay's open,
so a form's Enter could act.

- A new shell message, available, tells the frame its shell has a switcher
  that takes the keyboard when it opens.
- Only after available does the relay hold every keydown, keypress and keyup
  that follows an activating press: until the browser blurs the frame and it
  has really lost focus to the menu, closed arrives, or a second passes. A key
  in that moment is dropped, never replayed. 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, and focus and blur only as the browser's own, so a page can't
  dispatch any of them to change what it does.
- On closed, the relay restores the cursor at once if the frame has focus,
  otherwise when it gets it: Firefox returns focus after the message, and aims
  that focus event at the document rather than the window.

The frame still never gives up focus or drives the menu. The broker is
unchanged: the switcher answers hello with available itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… it, and keeps its field

Sol's findings on the menu, rounds one to three:

- Signing out on a page posts its form to /logout, and the switcher forgets the
  tab's list and pointers as it goes; an answer still on its way is dropped.
- 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 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: the flip first and lit. After any of those, and on later
  refreshes, rows and selection hold as before.
- The switcher answers each validated hello from its frame with available,
  itself, so the relay's hold never depends on the broker's release. It runs
  before the broker gives the frame its address, so it hears every hello.
- The menu takes focus before drawing rows, and closes when focus leaves it,
  to the patch, another window or the browser, so it never shows while typing
  goes elsewhere.
- Closing over a patch hands the frame focus again once the key event that
  closed it is over, which Firefox needs to put the cursor back.
- The search field is a label, and a press anywhere in the dialog but its text
  leaves focus in it, so a click on the glyph or the panel keeps the keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t yet opened

A new member saw only Patchy's places until they typed, and a guest saw the
patches shared with them only by typing. Decided by Allison on 2026-11-08:

- With nothing typed the patch rows stay six at most: the patch to flip back
  to, lit, then those opened last; any slots left go to patches this viewer
  has never opened, the company's live ones before those shared with them,
  each by title, then id. Guests record no opens, so shared patches count as
  never opened.
- With nothing to flip back to, no patch is lit: the first row after them is,
  as before, so ⌘⇧K ↵ never opens a patch the person hasn't been to.
- An unopened company patch shows no detail; a shared one its company's name.
  The patch on screen is still never a row, typing is unchanged, and the
  first-fill and keep-order rules apply as before.

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

With six never-opened patches B–G shown and G lit, a refresh bringing A, which
sorts first, capped the rows to A–F before keep-order ran: G dropped out and
the selection moved to A, so Enter opened something else. On a refresh of an
open menu, the rows it shows that are still listed now keep their slots before
the cap, and a newcomer takes one only if a row has gone.

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

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Re-check of the new head. Checked 2a2935d7 (base e1f4e3b2, main after #1295) on brightline and guests, by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code. Driven in Playwright Chromium as each scenario's people.

This narrow re-check covers what changed since the full run at e72f3d40, which is folded in at the end:

The head moved from 6c7ea353 to 2a2935d7 while this ran. Every check below ran again on 2a2935d7, and the results matched 6c7ea353.

To go past six patches, and to give a guest patches of their own, I added scenario data:

  • Allison published four more pages: Atlas notes, Budget board, Studio calendar and Zine archive. Brightline then has eight live patches.
  • Allison shared Spend with Taylor.
  • A CLI logged in as Taylor published two Cedar Works pages: Cedar ledger and Yard plan.

The rule, with nothing typed

  • At most six patch rows: passed. With eight live patches, Jordan, Priya, Marcus and Sofia each see six.
  • The previous patch first and lit, then opened patches by last opened: passed.
    • Jordan opened Kudos, New Business, Spend and Zine archive, in that order.
    • Over Zine archive, the rows are Spend Requests (lit), New Business and Kudos. Then come the never-opened Atlas notes, Budget board and Kickoff brief.
    • ⌘⇧K ↵ lands on Spend. There, Zine archive is lit and the rest keep their order.
  • Then patches never opened, the company's live ones before shared ones, each by title: passed.
    • Over New Business after Kudos: Kudos (lit), then Atlas notes, Budget board, Kickoff brief, Spend Requests and Studio calendar. Never-opened company rows show no detail.
    • Taylor works at Cedar Works and is a Brightline guest. On Home, Taylor sees Cedar ledger and Yard plan, then Kudos and Spend Requests, each marked "Brightline Studio". The shared patches come after the company's even though "Kudos" sorts before "Yard plan".
    • Live patches only: with Atlas notes retired, Priya's rows start at Budget board, and Studio calendar takes the sixth slot.
  • A brand-new member: passed. Jordan, who hadn't opened anything, gets the six patches by title, none lit. The first place is lit: All patches on Home, Home on All patches. ⌘⇧K ↵ on Home lands on All patches, not a patch. Ben on guests gets Site notes and Visit log, none lit.
  • A guest: passed.
    • Jo on guests: Site notes and Visit log, each marked "Harbor Works", none lit, with All patches lit.
    • Over Visit log after Site notes: Site notes lit, no This patch, and ⌘⇧K ↵ flips to it.
    • Taylor over Spend after Kudos: Kudos lit (marked "Brightline Studio"), then Cedar ledger and Yard plan.
  • A refresh that brings a patch sorting first (2a2935d7): passed.
    • With Sofia's list held back and the menu open, she presses ↑ to Spend Requests. Allison publishes Aardvark plan, then the list lands.
    • The six rows stay, Spend Requests stays lit, and ↵ opens Spend.
    • On the next load, Aardvark plan comes first among the never-opened patches.

Unchanged

  • The current patch is never a row: passed. Checked over New Business, Zine archive, Spend, Atlas notes and Studio calendar, for Taylor over Kudos and Spend, and for Jo over Visit log and Site notes.
  • Another company's public patch never appears: passed.
    • Taylor opened the kickoff brief once it was public. It isn't in Taylor's rows, and "har" and "kick" find nothing.
    • Made public, Site notes drops out of Jo's rows and Jo's search. It comes back when it returns to company.

Core flows on the new head

  • ⌘⇧K ↵ flips back: passed. Six flips in a row between Atlas notes and Budget board, each started from the patch's field.
  • Escape restores the cursor in a patch's field: passed.
    • Atlas notes' field, with characters 2–5 selected, keeps focus and that selection after Escape, and typing x gives "hex world".
    • Jo in Visit log's field: characters 1–4 stay selected, and x replaces them.
  • Enter straight after the chord never reaches the patch: passed. Ten times from Atlas notes' field, which sits inside a form, its capture listeners heard no Enter, the form never submitted, and the page stayed put.

Tests

  • switcher.spec (16), switcher-relay.spec (11), focus.spec (4) and starting.spec (7) in Chromium: 38 passed on 6c7ea353, and again on 2a2935d7.
  • Core's switcher and command-list unit tests: 150 passed.
  • CI on 2a2935d7 when this was posted: 18 checks pass, none failed. browser, test (22), test (24), test (26) and pidgeon-suite were still running, and attio-live and imap-live skip.

Rollback answers: they still match the diff.

  • 09ff40e1 and 2a2935d7 change only which rows the menu draws, plus docs and tests. The stored entry (cache.ts), /switcher.json, the relay and the script routes are unchanged.
  • Against main, the diff touches no migration, packages/api, CLI or apps/infra, so no one-way label is needed.
  • fix(patches): reopens within 10 minutes count once #1295 is now on main, under this head. The Release impact says it must ship first.

Not run

  • Real Mac browsers (Safari, Chrome, Firefox, Zen): Allison's hand test.
  • Firefox and WebKit: this re-check ran Chromium only. The new commits change which rows the menu shows, not focus or key handling. The full run's Firefox results are below. WebKit doesn't run on this machine.
  • Golden journeys: not re-run, because the new commits only change the menu's rows. CI's tier2-smoke and rollback-rehearsal pass on this head. Logging Taylor's CLI in passed Log a machine in's confirmation on the way: whoami named the machine.

Notes

  1. A flip target that disappears while the menu is open can leave a never-opened patch lit. By the rule, ⌘⇧K ↵ never opens a patch the person hasn't been to. But when the lit row disappears in a refresh, the menu keeps the old row number, and that row is now the first never-opened patch. Before 09ff40e1, the same row number fell on Overview. Seen on brightline, on both heads:

    • Marcus opens Budget board, then Studio calendar, where Budget board is lit.
    • Budget board is retired. Studio calendar reloads with /switcher.json held back, and ⌘⇧K draws from the tab's copy, with Budget board lit.
    • The list lands. Atlas notes, which Marcus never opened, is now lit, and ↵ opens it.

    It is rare. The person's only flip target has to be retired, unshared or made public between the tab's copy and a refresh that lands while the menu is open. Even then, it opens a patch the person is allowed to open. Falling back to litAtOpen(next) when the lit row is gone would keep the rule.

  2. The Release impact is slightly stale: it says fix(patches): reopens within 10 minutes count once #1295 is "still open", but fix(patches): reopens within 10 minutes count once #1295 has merged.

  3. 09ff40e1 resolves the full run's note 3: a new member and a guest now see patches with nothing typed.

Screenshots (on 2a2935d)
Jordan, new to Brightline, on All patches Taylor on Cedar Works' Home: company, then shared
Jordan's switcher with six never-opened patches Taylor's switcher with Cedar Works patches, then Brightline's shared ones
Jordan over Zine archive: flip, opened, then never opened Jo, a guest, on Home
Jordan's switcher over Zine archive Jo's switcher with Harbor Works' shared patches
The full run at e72f3d4 (PASS with notes)

Checked e72f3d40 (base 66997dd, #1298's head) on brightline and guests, by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code. Driven in Playwright Chromium and Firefox as each scenario's people.

Done means (#1270)

  • From inside any company patch or portal page, Mod+Shift+K opens the switcher at once: passed. The menu was open 6–27 ms after the key, Playwright's own overhead included. Tested as Jordan (member), Allison (admin), Taylor (guest at Cedar Works) and Jo (guest at Pine Studio), from:

    • fields in Kudos (its message) and Visit log, both tier 2;
    • the kickoff brief (single-file tier 1, with a field added to its frame) and Site notes (tier 1 repo);
    • Home, All patches, Your agents, People, Integrations, Agent access, What's new and Kudos's card page.

    A page's own place is never offered.

  • ⌘⇧K ↵ flips back to the previous patch: passed, in both engines.

    • Kudos ⇄ New Business six times running with 150 ms between the chord and ↵, then four more at 60 ms.
    • A guest flips too: Kudos ⇄ Spend as Taylor, Visit log ⇄ Site notes as Jo.
  • Escape puts the cursor back where it was: passed, in both engines.

    • Selection 2–5 in Kudos's message comes back after Escape, and typing replaces it.
    • The same after the chord again and after a scrim click.
    • The same for Jo in Visit log, and in the single-file page's added field.
  • It lists the company's and shared patches, never another company's public one, and a revoked one goes on the next refresh: passed.

    • Taylor's list has Kudos and Spend, each with the detail "Brightline Studio", and no This patch.
    • With the kickoff brief made public and Taylor having opened it, "har" finds nothing, and it never shows as the flip.
    • A shared patch made public (Site notes) drops out of Jo's list and stays in Ben's.
    • share --remove drops the row on the next load (Taylor's Spend, Jo's Site notes). It also drops from a menu already open when its held refresh lands, and the menu stays open.
  • The Mac hand test in Safari, Chrome, Firefox and Zen: not run (below).

Beyond Done means

  • No leak: ⌘⇧K then ↵ with no pause, 10 times from Kudos's message field, where ↵ sends. The patch's own capture listener never heard the Enter, the text stayed, and nothing was sent. Chromium dropped the Enter every time; Firefox's menu already had focus and flipped every time (note 2).
  • Typing:
    • Word starts in any order: "new" and "bus new" find New Business.
    • Initials: "nb" finds New Business, "sr" Spend Requests.
    • Inside a word from three letters: "usi" finds New Business, "ver" finds Versions then Overview. "us" doesn't match inside a word.
    • No results: "zzqx" shows "No patches match “zzqx”" and one All patches row.
  • Rows:
    • The patch on screen is never a row.
    • This patch is Overview and Versions for Jordan, plus Log and Settings for Allison. Taylor and Jo never get it.
  • Mouse:
    • Hover lights a row and a click opens it.
    • Ctrl-click and Ctrl-↵ open a new tab; after a Ctrl-click the menu steps aside and the tab stays put.
    • A click on the glyph or the panel leaves focus in the field.
  • Sign-out: signing out from the account menu leaves no patchy.switcher entry on /login. Priya, signing in next in that tab, gets none of Jordan's pointers.
  • Public pages and patchy dev open nothing: checked on public patch pages as a member and as a guest in both scenarios, and on patchy dev's owner and guest URLs. None loads switcher.js and the chord opens nothing. Text typed straight after the chord lands in the patch's field. patchy dev logs its one console line.
  • The look matches the PR's screenshots (attached). Nothing in the dialog has an animation, transition, filter or backdrop-filter in its computed styles. Rows are 34 px, the placeholder is "Go to…", and there is no helper text.
  • The CSS moved into shellStyles (.field, mono, tag and the rest): pnpm dev compare as Allison against origin/feat/switcher-relay. /company, /company/connections, /machines, /patches/kudos/settings, /patches and /whats-new, at 1280 and 390 px, are pixel-identical apart from the instance's host name and one "Used just now" line.
  • Console: no CSP or script error on any page I visited in either engine. The only error lines were the signed-out door's own 401 and Site notes' own /api/runtime/call 403 on its public page. Every viewer gets that 403; it isn't the switcher.

Tests

  • CI on the head: every check passes, browser, clerk-live, tier2-smoke and rollback-rehearsal included.
  • Chromium, run locally: switcher (15), switcher-relay (11), focus (4), starting (7) and hotkeys (6). 43 passed.
  • Firefox, run locally:
    • switcher.spec's 13 cases and focus's 4 pass; the two starting-cover cases skip, by design.
    • 9 of switcher-relay's 11 pass; two stop at setup (note 1).

Golden journeys

  • Sign in: passed. Signed out, /brightline/kudos answers 401 with the door, which loads no switcher and opens nothing on the chord. Signing in returns to Kudos.
  • Find and open a tool: passed. All patches lists the three tools, the search finds Kudos, and it opens in its frame.
  • Use a tool live: passed in both engines. Jordan's kudos appears on Priya's open page without a reload.
  • Use a tier 2 tool: passed for opening; New Business opens with its sample deals. Moving a deal and Spend's self-approval weren't run here; CI's tier2-smoke and rollback-rehearsal pass.
  • Share and unshare: passed. After share … public the kickoff brief answers 200 signed out, and after share … company it answers 401 again.
  • Log a machine in, Invite and join: not run. The diff doesn't touch the CLI, login or invitations.

Rollback answers: they match the diff.

Not run

  • Real Mac browsers (Safari, Chrome, Firefox, Zen): Allison's hand test after deploy.
  • WebKit: not runnable on this machine.
  • The starting cover on scenario data: covered only by the spec's two Chromium cases, which pass.
  • Clerk sign-in locally: CI's clerk-live passes on the head.

Notes

  1. Two switcher-relay cases can't run in Firefox. They stop at setup because Firefox won't construct a MessageEvent whose source is the cross-origin parent ("'source' member of MessageEventInit could not be converted…").

    CI runs Chromium only, so nothing is red. In Firefox the forged-blur behaviour is still covered by switcher.spec's slow-open case, which passes, and page code can't build that forgery this way there at all.

  2. The instant ↵ ends differently by engine. Chromium drops it and leaves the menu open; Firefox flips. The patch never hears it in either. The PR body describes only the drop.

  3. With nothing typed, a patch shows only once it has been opened. Before opening any patch, Jordan saw only Patchy's places. Guests record no opens, so Taylor's and Jo's shared patches appear without typing only as the flip target. This follows feat(core): Mod+Shift+K opens Patchy's switcher #1270's "next five by last opened". Whether a guest should see their shared patches with nothing typed is a product call.

Screenshots
Allison over New Business, Chromium Taylor, a guest, over Kudos, Firefox
The switcher over New Business A guest's switcher over Kudos

@allisonmahmood
allisonmahmood merged commit f2b5716 into main Nov 8, 2026
25 checks passed
@allisonmahmood
allisonmahmood deleted the feat/switcher-menu branch November 8, 2026 00:44
allisonmahmood added a commit that referenced this pull request Nov 8, 2026
## What changed

When Patchy stops a patch, it shows a notice: a revoked version, a
document another tab replaced, a patch that needs a rebuild. A person
stopped there had no way out but the address bar. Notices ran no script
but the switcher relay, so Mod+Shift+K was claimed and nothing opened.
Now a signed-in person opens **Go to…** on any notice and leaves. A
signed-out person sees the notice as before.

How:

- **Optional admission** (`Door.noticeViewer`): `/~shell/notice/:code`
reads the session but never answers for the page. An active member or
guest gets the notice with their switcher tag, then the session's
scripts, so Clerk keeps the cookie fresh, plus any cookies Clerk set on
the way. A handshake Clerk verified on the way back is admitted the same
way, with the cookies that complete it, and without Clerk's cleanup hop;
`Session` now returns a verified return's claims. Everyone else gets the
notice with no viewer: signed out, a stale session Clerk would want to
start a handshake for, signed in without a membership, deactivated, or
the sign-in service down. The notice never redirects. The cookies of a
handshake Clerk wants to start belong to its redirect, so they're
dropped.
- **Needs-rebuild at a patch address** already has its viewer, because a
company address admits before it serves. It now passes that viewer to
the notice. The notice's switcher tag also names the patch
(`data-patch`), which the menu treats as the one on screen, as over a
company shell: never a row, the flip goes to the patch before it, and
This patch is offered by the same rule. A public patch's notice stays
viewer-free, and so does a framed notice (needs-rebuild at a content
URL), which keeps the relay alone.
- **The notice CSP** (`noticeContentSecurityPolicy`) is the notice's own
policy plus `'self'` script and connect, Clerk's Frontend API host for
both, and `worker-src blob:`. Only a viewer's notice gets it; everyone
else's keeps the relay-only policy.
- **Caching:** every notice is still `private, no-store`, so one
viewer's notice never reaches anyone else.
- **The menu** is #1304's. Its entry script now reads the patch from the
tag when there's no frame. A stopping notice names no patch, so it shows
no **This patch** and lists every place.

Closes #1271

## Look at

**A notice as a signed-in person**, on `brightline` as Allison. She was
in Spend Requests, then a notice says another connection replaced New
Business's document. On #1304's head (`ab55b42`), ⌘⇧K is claimed and
nothing opens. Now **Go to…** opens over the notice with Spend Requests
lit and every place listed. There's no This patch, since no patch is on
screen, and ↵ goes back.

![Go to… open over the "This document was replaced"
notice](https://github.com/user-attachments/assets/ee8b43ab-ac49-4b54-8361-5f17d506d6f2)

<details><summary>Before: the same notice after ⌘⇧K</summary>

![The notice with nothing
open](https://github.com/user-attachments/assets/cf83b442-3362-4818-81b9-fe2aa20bdc4e)

</details>

The flow on both sides, before on the left. Before stops where the menu
should open:


https://github.com/user-attachments/assets/9121dcf1-461c-47ec-b8e6-5377dc220ec5

## How it was verified

- **`Pages.test.ts`**, two new cases. "As anyone" means byte-for-byte
the notice rendered with no viewer, under the relay-only CSP.
  - `/~shell/notice/:code`:
    - A fresh session gets the switcher.
- An expired session that Clerk refreshes on the way (refresh cookie,
stubbed backend) gets the switcher and keeps Clerk's new cookies.
- Expired with nothing to refresh it, as a browser navigation: Clerk
wants a handshake. The notice is as anyone sees it, with no `Location`
and no cookies. A mutant that passes the handshake's cookies through
fails this.
- Signed out, signed in without a membership, and deactivated: as
anyone.
- A handshake Clerk verified, returning to the notice, gets the switcher
and exactly the handshake's cookies, with no redirect. Treating the
completion like an initiation fails this.
- A changed account: the notice names only the account signed in now.
    - `principal_changed` keeps its Sign in link for a viewer.
  - Needs-rebuild at a patch address:
- A member, and a Clerk-refreshed session, get the switcher, naming the
patch. A guest's switcher keys their own company.
- The frame's notice at the content URL is relay-only, under the content
policy.
- Signed out gets the door (401), and a deactivated colleague the
deactivated page (403), as before.
- A public patch's notice is as anyone, with no cookies, for a member, a
stale session and the signed out.
- **`shell-headers.test.ts`**: the viewer's notice CSP admits `'self'`,
Clerk and the relay. Apart from script, connect and worker, it is
exactly the notice policy. **`render.test.ts`**: the switcher tag comes
before the session's scripts, with no new inline script.
- **`test/browser-tier1/switcher.spec.ts`**, two new cases, and all 11
pass:
- On a stopping notice, a signed-in person's switcher keeps the list,
⌘⇧K opens the menu with Spend Requests lit and every place, Enter
leaves, and the page logs no CSP violation. Signed out, the same notice
claims the key and loads neither `switcher.js` nor `/switcher.json`.
- The person visits Crew rota, then Sales HQ, and Sales HQ's wire
retires. On its needs-rebuild notice, Crew rota is lit, Sales HQ isn't a
row, This patch offers Overview, Versions, Log and Settings, and Enter
lands on Crew rota. Without the patch in the tag, it fails: "Sales HQ is
lit, not Crew rota".
- **Rebased onto main after #1304 merged** (only the docs wording in
`docs/product.md` and the Portal glossary needed merging by hand; CI is
the check on the rebased head). **Earlier, on the head rebased onto
#1304's `e72f3d40`:**
- The `switcher` and `switcher-relay` browser specs pass under the
shared lock, 28 of 28, both notice cases included.
- The affected unit suites (auth Session and RequireSession, serving,
core html and switcher, portal) pass, 353 of 353.
- `pnpm verify` under the shared lock, with mise's Node 24 first on
PATH: format, lint, typecheck, synth, postgres-concurrency, cli-smoke,
install, tier2-smoke and browser pass. Browser is the whole tier 1
suite, 113 of 113.
  - test and test (bun) fail only in this machine's known places:
- CLI stub servers, and `LocalTaskProvider`'s, heard a stray `GET /`
from a local port probe.
- `Supervisor`'s "does not reap active calls" times out at 20 s. That
case answers the last request its local listener heard, so a stray
request leaves the real call waiting. Alternating three runs alone on
#1304's tip and on this head, it failed the same on both, 3 of 3, at a
load average near 1.
- **Not checked:** real browsers on a Mac. The browser suite is Chromium
only, and blocks Clerk's real script, so the Clerk worker allowance is
checked by policy, not by Clerk running on a notice.

Hit every surface:

- **Served pages:** the `ui-consistency` spec says which notices load
the switcher and the session's scripts, and what their CSP admits.
- **Vocabulary and product shape:** Portal's **Switcher** and
`docs/product.md` include notices. ADR-0006 says a notice reads the
session but never redirects: it never starts a handshake, and takes a
verified return without the cleanup hop.
- **Not touched:** the wire contract, the CLI, the dev loop, migrations,
company resources and the repo layout. Reverse states: no new way in.

## Release impact

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

Notices gain scripts and a wider CSP for a signed-in viewer only. No
API, CLI, schema or configuration change.

- **What does a revert leave behind?** Nothing stored. A tab already
showing a notice keeps its switcher until it reloads.
- **Does the release before it still work with that?** Yes. Its notices
render as they did. A `patchy.switcher` entry a notice wrote to
`sessionStorage` is the one #1304's pages already write.

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
…1336)

Stacked on #1332; part of #1315. Merge the stack together, not alone.

## What changed

Every first-party page drew from one stylesheet with 27 font sizes,
weights from 450 to 900, capitals in labels and hard shadows on things
that don't float, so pages looked assembled rather than designed. Now
every page reads in the overhaul's tokens and seven type roles, without
any page's markup changing. This is the first of two PRs for #1317: this
one is the tokens and the restyle; the next adds the typed helpers, five
templates, the enhancer and the `/~ui` gallery.

Part of #1317

## Look at

- **One token block, named chunks.** `packages/core/src/styles/` holds
`appStyles` as named chunks composed from one list in `index.ts`:
`fonts`, `tokens`, `base`, `type`, then one chunk per family (`marks`,
`buttons`, `fields`, `status`, `notices`, `containers`, `tables`,
`navigation`, `menus`, `dialogs`, `steps`, `tiles`, `appShell`, `doors`,
`whatsNew`, `switcher`). The switcher (#1304) draws on app pages from
its own chunk in the app's tokens, and over a running patch from
`servedStyles` as before; `command-list.test.ts` checks both carry its
anatomy. A later lane adds a family as a new file and one line in the
list. `tokens.ts` holds colour, the seven type roles in four weights,
spacing, control heights (36/32, and 44 with 16px field text on a coarse
pointer), radii 6/10/12 and the lift/float/modal shadows. Legacy token
names (`--white`, `--line-strong`, `--paper-blue` …) map onto the new
values for page CSS that still names them.
- **Native anatomy kept** (plan review finding 12). Inputs, textareas
and selects stay native at button height with 1px ink edges;
`.field-prefix` stays a label fused into its group; menus stay top-layer
popovers with their anchor positioning; the Final step's modal panel and
its phone sheet keep their geometry. The prototype's drawn fields and
absolutely positioned menus are not copied.
- **Rules the spec sets**: ink focus ring everywhere (never blue); hover
only under `(hover: hover)`; the hard shadow only on the primary button,
the glyph, hero marks, menus, dialogs and doors; badges in sentence case
(no `text-transform` anywhere, tested); flat paper in the app, the grid
and gradient only behind doors.
- **Deliberately unchanged here**: markup, classes and page CSS (each
page lane rebuilds its page on the templates and deletes its CSS); the
sidebar's 900px fold, because Home's own CSS relies on it (the sidebar
lane moves both to the spec's 1024px together); titles in Geist 800, as
Cabinet Grotesk waits on ticket X.
- **Dropped:** legacy classes with no caller (`panel`, `grid`, `task`,
`num`, `foot` and the old `flow` diagram).

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

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

Before is `cd908ee` (where this branch left ui/f1-fonts) and after is
`67e5911` (ui/f2-tokens), both on the `brightline` scenario, from `pnpm
dev compare`.

Every page answered 200 with no browser errors.

##### `/`

**1280px, after**

![After: / at
1280px](https://github.com/user-attachments/assets/ed762a85-a70a-4be3-8833-f66bc1174b1b)

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

![Before: / at
1280px](https://github.com/user-attachments/assets/0d3641b7-a24b-48c4-a53b-26edceeba5bf)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: / at
390px](https://github.com/user-attachments/assets/1d20e209-366a-45c4-82ba-1b3135f65d39)
| ![After: / at
390px](https://github.com/user-attachments/assets/556485fb-47d3-40be-bb06-c418499fbc5c)
|

##### `/patches/new-business/delete`

**1280px, after**

![After: /patches/new-business/delete at
1280px](https://github.com/user-attachments/assets/2175b979-ada8-46e9-9bed-8011a3101797)

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

![Before: /patches/new-business/delete at
1280px](https://github.com/user-attachments/assets/4d7c4ba8-7707-41d5-9af1-215d897b29da)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /patches/new-business/delete at
390px](https://github.com/user-attachments/assets/382eb382-6715-4eb3-b9e3-798d75173327)
| ![After: /patches/new-business/delete at
390px](https://github.com/user-attachments/assets/1f40ac44-24e0-40e9-8601-c59bb9937050)
|

##### `/company`

**1280px, after**

![After: /company at
1280px](https://github.com/user-attachments/assets/9a09f56b-603f-4244-a6e7-3de647ad6239)

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

![Before: /company at
1280px](https://github.com/user-attachments/assets/b2818e71-f749-427f-9e05-7bff086dffad)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company at
390px](https://github.com/user-attachments/assets/8f03dc19-287d-4821-88ee-b5d45ad8b65a)
| ![After: /company at
390px](https://github.com/user-attachments/assets/7c30b0dc-4fa0-4dc3-81f5-67cc399d843e)
|

##### `/company/connections/connect/postgres`

**1280px, after**

![After: /company/connections/connect/postgres at
1280px](https://github.com/user-attachments/assets/49d5f613-82b2-47c0-804c-35b4ebdadef6)

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

![Before: /company/connections/connect/postgres at
1280px](https://github.com/user-attachments/assets/4e7692d4-0eb0-448f-a6d7-b4fe204cd51a)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company/connections/connect/postgres at
390px](https://github.com/user-attachments/assets/15e09139-126b-4820-b4c5-318d0390b96f)
| ![After: /company/connections/connect/postgres at
390px](https://github.com/user-attachments/assets/ba684bc3-83f8-40de-bd63-1551b8e44eb9)
|

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

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

#### Before and after, as Priya Shah (member)

Before is `cd908ee` (where this branch left ui/f1-fonts) and after is
`67e5911` (ui/f2-tokens), both on the `brightline` scenario, from `pnpm
dev compare`.

Every page answered 200 with no browser errors.

##### `/company/agent-access`

**1280px, after**

![After: /company/agent-access at
1280px](https://github.com/user-attachments/assets/468df01b-4d30-4f90-8ab0-757ce0584b8f)

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

![Before: /company/agent-access at
1280px](https://github.com/user-attachments/assets/8c49cd1b-f8a6-45d3-96b7-f85bea211592)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company/agent-access at
390px](https://github.com/user-attachments/assets/2e575ea4-954a-4adf-9976-29a555327dda)
| ![After: /company/agent-access at
390px](https://github.com/user-attachments/assets/aa53ff24-fbc6-44a3-916d-37753d39fd3a)
|

##### `/company`

**1280px, after**

![After: /company at
1280px](https://github.com/user-attachments/assets/f84c9c78-eccd-4ff7-bff4-2b57b0eceba2)

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

![Before: /company at
1280px](https://github.com/user-attachments/assets/2061b6ad-2250-4397-8d64-f4ddfab5fcb6)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company at
390px](https://github.com/user-attachments/assets/9553a535-5684-4c86-a42d-f5009c5bac6a)
| ![After: /company at
390px](https://github.com/user-attachments/assets/ae004f5e-3350-43a4-a494-296e88eda087)
|

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

## How it was verified

- `styles.test.ts`: `appStyles` is its chunks in order, every `var(--…)`
it uses is defined in the token block, and nothing is set in capitals.
The served-styles pin from #1332 still holds.
- Typecheck, lint, and the core, serving, portal, auth, companies,
integrations and server suites (1285 tests) pass locally.
- Looked at every first-party surface on `pnpm dev up brightline` at
1280px and 390px (touch): Home, All patches, a patch's Overview, Log,
Versions and Settings, Retire and Delete, the Share dialog, Your agents,
People, Integrations and the catalogue, Postgres and Pidgeon connect,
Agent access, What's new, Priya's Final step (desktop and the phone
sheet), the switcher open over All patches, the persona picker, sign-in
door, 404 and a stopping notice. One fix came out of it (a list link
holding a line break stays a block).

## Release impact

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

Styles only; no schema, API, CLI or configuration change.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

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

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]>
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:core Touches the core area area:docs Touches the docs area 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(core): Mod+Shift+K opens Patchy's switcher

1 participant