Skip to content

feat(sdk): patchy/hotkeys gives patches keyboard shortcuts - #1098

Merged
allisonmahmood merged 8 commits into
mainfrom
feat/hotkeys-1092
Nov 1, 2026
Merged

allisonmahmood merged 8 commits into
mainfrom
feat/hotkeys-1092

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

What changed

A patch could only get keyboard shortcuts if its builder's agent hand-wrote keydown code. That code is easy to get wrong in text fields, dialogs, sequences, other keyboard layouts and ⌘ versus Ctrl. Now tier 1 and 2 pages import patchy/hotkeys, Patchy's own API over TanStack Hotkeys, which is bundled inside it, and every tier 1 and 2 repo gets a patchy-hotkeys skill.

import { HotkeyScope, formatHotkey, useHotkey, useHotkeyList } from "patchy/hotkeys";

useHotkey("G H", () => patchy.route.set("/"), { label: "Go home" });
useHotkey("Mod+K", openSearch, { label: "Search" });

Closes #1092. Part of #1086. Stacked on #1087, so keys reach the page without a click.

Rebuilt from the #1052 prototype, with the issue's changes:

  • No Control. A chord is Mod, Alt and Shift.
  • HotkeyScope is always exclusive.
  • Mod+Shift+K is reserved. The types refuse it in either letter case, and a string cast past them is skipped with a console warning.
  • Conflicts warn in Patchy's words. TanStack lets them through. Our warning fires once, naming both labels, after every hook's update in a render has landed.
  • Pins: @tanstack/preact-hotkeys 0.17.1 over @tanstack/hotkeys 0.19.0, exact.
  • Licences: both MIT notices, Hotkeys 2026 and Store 2021, are in dist/licenses.

It costs 13.4 KB gzipped, only in pages that import it: a minimal Preact page goes from 17.9 to 31.4 KB in Vite's production build.

Look at

A string that isn't a hotkey fails pnpm typecheck, saying what to write instead. packages/patchy/src/hotkeys.test.ts asserts these lines exactly, against the published declarations:

consumer.ts(2,11): error TS2345: Argument of type '"Ctrl+K"' is not assignable to parameter of type '"'Ctrl+K' isn't a chord: write 'Mod+K', which is ⌘ on a Mac and Ctrl elsewhere"'.
consumer.ts(3,11): error TS2345: Argument of type '"Control+K"' is not assignable to parameter of type '"'Control+K' isn't a chord: write 'Mod+K', which is ⌘ on a Mac and Ctrl elsewhere"'.
consumer.ts(5,11): error TS2345: Argument of type '"Esc"' is not assignable to parameter of type '"'Esc' isn't a chord: write keys like 'Mod+K', 'Escape', '?' or 'G H', modifiers in the order Mod, Alt, Shift"'.
consumer.ts(7,11): error TS2345: Argument of type '"Mod+Shift+K"' is not assignable to parameter of type '"'Mod+Shift+K' is kept by Patchy for its own shortcuts: choose another chord"'.
consumer.ts(9,11): error TS2345: Argument of type '"G Mod+Shift+K"' is not assignable to parameter of type '"'Mod+Shift+K' is kept by Patchy for its own shortcuts: choose another chord"'.

The test also covers "Cmd+K", "Shift+Mod+K", "Mod+Shift+k" and "Ctrl+Shift+K". "Mod+K", "?", "G H", "Alt+ArrowUp" and a Chord[] built from data typecheck clean.

A published tier 1 page in the shell (test/browser-tier1/hotkeys.spec.ts, Chromium):

  • G H changes the route on the first press, with no click.
  • In a text field, L waits and Mod+Enter fires.
  • On a checkbox, radio or range, L fires, and Space and the arrow keys still work the control.
  • An open HotkeyScope holds back the page's L and its G H, while its own G H fires. useHotkeyList still lists the page's labelled hotkeys.
  • Layouts use trusted key events:
  • On an emulated Mac, formatHotkey("Mod+K") is ⌘ K, and Meta+Enter fires Mod+Enter where Control+Enter doesn't.
  • Two sibling components swap K and L in one state update, and nothing warns. A third component binding K then warns once: "Second" and "Third" both use K.
✓ [chromium] › test/browser-tier1/focus.spec.ts:16:1 › a patch hears the keyboard once its frame loads (166ms)
✓ [chromium] › test/browser-tier1/hotkeys.spec.ts:118:1 › patchy/hotkeys fires in the published frame across fields, scopes, layouts and a Mac (721ms)
✓ [chromium] › test/browser-tier1/hotkeys.spec.ts:227:1 › a conflict warning waits for every hook's update, so siblings swapping keys don't warn (293ms)

TanStack 0.19.0 fixed the checkbox, radio and range case (TanStack/hotkeys#206), so the layer carries no workaround for it.

Fresh agents, pnpm dev trial on Sonnet 5.5, two runs per brief. Before is #1087's head, which has no helper. After is this PR plus one local-only commit, never pushed: a minimumReleaseAgeExclude for the two TanStack versions, so the evidence install gets past the release-age window. That window has since passed, and nothing pushed bypasses the policy.

  • Directed: a task tracker with G H, G D, C T and ?.
    • Run 1: the after agent took the single-file route, with no repo, hand-wrote the keys in one HTML file and published. A single-file page can't import patchy/hotkeys and never sees the project skill. My brief didn't say tasks are saved, which made a static file a fair pick. Choosing the route is the global skill's job, outside this PR.
    • Run 2, adding "Tasks anyone adds should be saved for everyone": the after agent read patchy-hotkeys and built every shortcut with useHotkey, HotkeyScope, useHotkeyList, formatHotkey and hotkeyKeys. Typecheck and lint were clean and patchy dev ran. It stopped before publishing to look for a browser to press the keys in, which is Builders' agents press keys and click in their dev page #1090. It opened type files only to find patchy.route, which docs(sdk): routing is in the skills #1088 adds to the skills.
  • Undirected: a support queue "as fast to work through as possible". Informational.
    • Run 1: the after agent read patchy-hotkeys, and its purpose line says "keyboard-driven triage". The log keeps no file contents, so whether it imported the helper isn't recorded.
    • Run 2: the after agent imported patchy/hotkeys without being asked and published. The before agent's page imported only patchy/preact and the generated client.
Run 2, directed: task tracker

Trial tracker

Make me a task tracker patch for our team. Tasks anyone adds should be saved for everyone. I want to drive it from the keyboard: G then H goes to the task list, G then D shows the done tasks, C then T opens a dialog to create a task, and ? shows a list of every shortcut. Put in a few example tasks. Publish it when it works. Start your reply with one sentence naming what the page imports from patchy.

Before is 9ff46e3 (--base origin/fix/frame-focus-1087) and after is ccaa307 (feat/hotkeys-1092), both on the team scenario, from pnpm dev trial.

Each side gave the task to a fresh agent: after's agent launcher in the side's environment, Claude Code on claude-sonnet-5-5 as the scenario's publisher, with the side's release of the Patchy skill and no personal instructions or settings, run without a person within 60 turns and 20 minutes. The log keeps each tool call, commands with their exit codes, and one line per failure; not the agent's reasoning or what its commands printed. Redacted before writing: email addresses outside the scenarios' example domains; the accounts the run acts as.

One run is a smell test, not a measurement.

Before After
Finished Yes Yes
Commands 14 15
Failures 2 4
Help lookups 0 0
Minutes 1.8 1.5

Before answered: “The page imports render, useState, useEffect, useRef and useQuery from patchy/preact, and its config imports defineConfig, table and t from patchy/config. It's published and company colleagues can open it: <origin>/acme/team-tasks (version 1, tier 1).”

After answered: “The page imports useState, useEffect and useQuery from patchy/preact, useHotkey, HotkeyScope, useHotkeyList, formatHotkey and hotkeyKeys from patchy/hotkeys, and defineConfig, table and t from patchy/config. I haven't published it yet, for two reasons.”

Before's log: 14 commands, 2 failures
skill   patchy
exit 0  $ patchy status --json; patchy whoami --json
exit 0  $ patchy init ./team-tasks --tier 1 --purpose "Shared team task tracker: add tasks, mark them done, and drive it with keyboard shortcuts (G H list, G D done, C T create, ? help)." --json 2>&1 | tail -30…
exit 0  $ cd <env>/workspace/team-tasks && cat AGENTS.md CLAUDE.md patchy.config.ts src/*.tsx; cat .agents/skills/patchy-loop/SKILL.md; cat patchy/_generated/index.json | head -50; ls fixtures helpers
exit 0  $ cat patchy.config.ts src/*.tsx; ls fixtures helpers src; cat .agents/skills/patchy-tables/SKILL.md
exit 0  $ cat .agents/skills/patchy-preact/SKILL.md; sed -n 1,200p .agents/skills/patchy-loop/SKILL.md
exit 0  $ cat src/styles.css | head -40; grep -n -i -A12 fixture .agents/skills/patchy-loop/SKILL.md | head -60
denied  $ cat > patchy.config.ts <<'EOF' …
        Contains brace with quote character (expansion obfuscation)
write   <env>/workspace/team-tasks/patchy.config.ts
write   <env>/workspace/team-tasks/src/App.tsx
exit 0  $ pnpm patchy refresh 2>&1 | tail -5; pnpm typecheck 2>&1 | tail -20; pnpm lint 2>&1 | tail -10
exit 0  $ grep -n -B2 -A8 "Me\b" patchy/_generated/client.ts | head -40; grep -n "Id<" patchy/_generated/client.ts | head -5
exit 0  $ grep -rn "type Me\b\|interface Me\b" node_modules/patchy/dist --include=*.d.ts -A8 | head -20; grep -rn "export type Id\b" node_modules/patchy/dist --include=*.d.ts | head
denied  $ sed -i 's/me?\.name ?? "Someone"/me?.user.name ?? "Someone"/; s/function toggle(id: string, done: boolean)/function toggle(id: (typeof rows)[number]["id"], done: boolean)/' src/App.tsx && pnpm typeche…
        This Bash command contains multiple operations. The following part requires approval: sed -i 's/me?\.name ?? "Someone"/me?.user.name ?? "Someone"/; s/function toggle(id: string, done: boolean)/functio…
edit    <env>/workspace/team-tasks/src/App.tsx
edit    <env>/workspace/team-tasks/src/App.tsx
exit 0  $ pnpm typecheck 2>&1 | tail; pnpm lint 2>&1 | tail -5
exit 0  $ pnpm patchy dev --json 2>&1 | tail -15
exit 0  $ pnpm patchy dev stop 2>&1 | tail -2; pnpm patchy publish --json 2>&1 | tail -20
After's log: 15 commands, 4 failures
skill   patchy
exit 0  $ ls -a && patchy status --json && patchy whoami --json
exit 0  $ patchy init ./team-tasks --tier 1 --purpose "Shared team task tracker: add tasks everyone sees, mark them done, and drive it from the keyboard (G H list, G D done, C T new task, ? shortcuts)." --json …
exit 0  $ cd <env>/workspace/team-tasks && cat AGENTS.md patchy.config.ts src/*.tsx; cat .agents/skills/patchy-loop/SKILL.md .agents/skills/patchy-hotkeys/SKILL.md .agents/skills/patchy-tables/SKILL.md; ls src …
exit 0  $ cat patchy.config.ts; ls src fixtures; cat src/App.tsx src/main.tsx; cat .agents/skills/patchy-hotkeys/SKILL.md; cat .agents/skills/patchy-tables/SKILL.md
exit 0  $ grep -n -i -E "route|dialog|export|import" .agents/skills/patchy-preact/SKILL.md | head -50; cat src/styles.css | head -30; ls fixtures; grep -n -i fixture .agents/skills/patchy-loop/SKILL.md | head
denied  $ cat > patchy.config.ts <<'EOF' …
        Contains brace with quote character (expansion obfuscation)
write   <env>/workspace/team-tasks/patchy.config.ts
write   <env>/workspace/team-tasks/src/App.tsx
exit 0  $ cat >> src/styles.css <<'EOF' …
exit 0  $ grep -n -B2 -A8 "route" .agents/skills/patchy-preact/SKILL.md .agents/skills/patchy-loop/SKILL.md | head -40; grep -n "route" patchy/_generated/client.ts | head
exit 0  $ grep -rn -A12 "interface.*Route\|route:" node_modules/patchy/dist/*.d.ts 2>/dev/null | head -40
exit 0  $ grep -rln "subscribe" node_modules/patchy/ --include=*.d.ts 2>/dev/null | head; grep -rn "route" node_modules/patchy/ --include=*.d.ts 2>/dev/null | head
exit 0  $ grep -n -B2 -A14 "type Route\b\|interface Route\b" node_modules/patchy/dist/_types/config-ihDgouFZ.d.ts | head -40
denied  $ python3 - <<'EOF' …
        grep -n "Id\b" node_modules/patchy/dist/_types/config-ihDgouFZ.d.ts
edit    <env>/workspace/team-tasks/src/App.tsx
edit    <env>/workspace/team-tasks/src/App.tsx
edit    <env>/workspace/team-tasks/src/App.tsx
exit 0  $ pnpm typecheck 2>&1 | tail; pnpm lint 2>&1 | tail; pnpm patchy dev --json 2>&1 | tail -15
denied  $ which chromium chromium-browser google-chrome firefox 2>&1 | head; ls ~/.cache/ms-playwright 2>&1 | head -3; cd <env>/workspace/team-tasks && tail -15 .patchy/dev/*/dev.log
        This Bash command contains multiple operations. The following part requires approval: head; ls ~/.cache/ms-playwright 2>&1
exit 3  $ which chromium chromium-browser google-chrome firefox
        /usr/bin/chromium
Run 2, undirected: support queue

Trial queue

Make me a support queue patch for our team to work through incoming customer tickets. It should be as fast to work through as possible. Put in a few example tickets. Publish it when it works. Start your reply with one sentence naming what the page imports from patchy.

Before is 9ff46e3 (--base origin/fix/frame-focus-1087) and after is ccaa307 (feat/hotkeys-1092), both on the team scenario, from pnpm dev trial.

Each side gave the task to a fresh agent: after's agent launcher in the side's environment, Claude Code on claude-sonnet-5-5 as the scenario's publisher, with the side's release of the Patchy skill and no personal instructions or settings, run without a person within 60 turns and 20 minutes. The log keeps each tool call, commands with their exit codes, and one line per failure; not the agent's reasoning or what its commands printed. Redacted before writing: email addresses outside the scenarios' example domains.

One run is a smell test, not a measurement.

Before After
Finished Yes Yes
Commands 11 16
Failures 2 2
Help lookups 0 0
Minutes 1.5 2.6

Before answered: “The page imports useQuery, useState, useEffect, useMemo, useRef and render from patchy/preact, and the generated patchy table client from patchy/_generated/client.js. The support queue is published at <origin>/acme/support-queue.”

After answered: “The page imports patchy/preact (Preact and the useQuery hook), patchy/hotkeys (keyboard shortcuts), and patchy/config (the table definition at build time). The support queue is published at <origin>/acme/support-queue.”

Before's log: 11 commands, 2 failures
skill   patchy
exit 0  $ ls -a && patchy status --json && patchy whoami --json
exit 0  $ patchy init support-queue --tier 1 --purpose "Support queue for the team to triage and work through incoming customer tickets quickly with keyboard shortcuts: claim, reply, resolve, snooze." --json 2>…
exit 0  $ cat .agents/skills/patchy-preact/SKILL.md .agents/skills/patchy-tables/SKILL.md .agents/skills/patchy-look/SKILL.md; ls fixtures src; cat fixtures/* | head -20; cat patchy/_generated/context/table-not…
exit 0  $ sed -n 40,200p .agents/skills/patchy-preact/SKILL.md; echo =====; cat .agents/skills/patchy-tables/SKILL.md | head -150; ls fixtures src
exit 0  $ grep -n -i -B2 -A12 "fixture" .agents/skills/patchy-loop/SKILL.md | head -90; cat src/styles.css; grep -n "me\b" patchy/_generated/client.ts | head; grep -o "^\s*--look-[a-z-]*" patchy/_generated/look…
exit 0  $ grep -n -i "me\b\|me(" patchy/_generated/client.ts | head; grep -n -A8 "me()" .agents/skills/patchy-loop/SKILL.md | head -30; sed -n 1,40p patchy/_generated/look.css | cut -c1-120
denied  $ cat > patchy.config.ts <<'EOF' …
        Contains brace with quote character (expansion obfuscation)
write   <env>/workspace/support-queue/patchy.config.ts
write   <env>/workspace/support-queue/src/seed.ts
write   <env>/workspace/support-queue/src/styles.css
write   <env>/workspace/support-queue/src/App.tsx
exit 0  $ pnpm patchy refresh --json 2>&1 | tail -3; pnpm typecheck 2>&1 | tail -15; pnpm lint 2>&1 | tail -15
denied  $ sed -i 's/}, \[sel?.id\]);/}, [sel?.id, sel?.reply]);/; s/useEffect(() => setReply(sel?.reply ?? ""), \[sel?.id\]);/useEffect(() => setReply(sel?.reply ?? ""), [sel?.id, sel?.reply]);/' src/App.tsx &&…
        This Bash command contains multiple operations. The following part requires approval: sed -i 's/}, \[sel?.id\]);/}, [sel?.id, sel?.reply]);/; s/useEffect(() => setReply(sel?.reply ?? ""), \[sel?.id\])…
edit    <env>/workspace/support-queue/src/App.tsx
exit 0  $ pnpm typecheck 2>&1 | tail -5; pnpm lint 2>&1 | tail -5; pnpm patchy dev --json 2>&1 | tail -5
exit 0  $ pnpm patchy dev logs 2>&1 | tail -8; pnpm patchy dev stop >/dev/null 2>&1; pnpm patchy publish --json 2>&1 | tail -5
After's log: 16 commands, 2 failures
skill   patchy
exit 0  $ ls -a && patchy status --json && patchy whoami --json
exit 0  $ patchy init ./support-queue --tier 1 --purpose "Support queue for the team to triage and work through incoming customer tickets quickly, with keyboard shortcuts, claim, reply and resolve." --json 2>&1…
exit 0  $ cat .agents/skills/patchy-hotkeys/SKILL.md .agents/skills/patchy-tables/SKILL.md .agents/skills/patchy-look/SKILL.md; ls fixtures src; cat fixtures/* | head -20; cat src/styles.css
exit 0  $ sed -n 40,200p .agents/skills/patchy-hotkeys/SKILL.md | head -90; echo =====; cat .agents/skills/patchy-tables/SKILL.md | head -150; ls fixtures src; cat src/styles.css | head -30
exit 0  $ grep -n -i -B2 -A12 "fixture" .agents/skills/patchy-loop/SKILL.md | head -80; grep -o "\-\-look-[a-z-]*:[^;]*" patchy/_generated/look.css | head -20; ls fixtures; cat patchy/_generated/context/table-n…
exit 0  $ grep -n "me()\|me:" -r .agents/skills/patchy-preact/SKILL.md .agents/skills/patchy-loop/SKILL.md | head; grep -n "useMe\|useQuery" .agents/skills/patchy-preact/SKILL.md | head
exit 0  $ grep -n "me\b" patchy/_generated/client.ts | head -8; grep -n "me" patchy/_generated/README.md | head
exit 0  $ cat patchy/_generated/client.ts | head -40; grep -rn "\.me\b\|me()" .agents/skills/patchy-preact/SKILL.md node_modules/patchy/dist/*.d.ts 2>/dev/null | head
exit 0  $ grep -rn "me:\|me(" node_modules/patchy/dist --include=*.d.ts | head -8
exit 0  $ grep -rn "me\b" node_modules/patchy/dist/_types/*.d.ts | grep -i "viewer\|Promise\|readonly me" | head -8
exit 0  $ grep -n "type Me\b\|interface Me\b" -A6 node_modules/patchy/dist/_types/config-ihDgouFZ.d.ts
denied  $ cat > patchy.config.ts <<'EOF' …
        Contains brace with quote character (expansion obfuscation)
write   <env>/workspace/support-queue/patchy.config.ts
write   <env>/workspace/support-queue/src/styles.css
write   <env>/workspace/support-queue/src/App.tsx
exit 0  $ pnpm patchy refresh 2>&1 | tail -5; pnpm typecheck 2>&1 | tail -20; pnpm lint 2>&1 | tail -10
denied  $ sed -i 's|^  useEffect(() => { setDraft(sel?.reply ?? ""); }, \[sel?.id\]);|  // Reset the draft only when the selected ticket changes, not on every edit to it.\n  // oxlint-disable-next-line react-ho…
        This Bash command contains multiple operations. The following part requires approval: sed -i 's|^  useEffect(() => { setDraft(sel?.reply ?? ""); }, \[sel?.id\]);|  // Reset the draft only when the sel…
edit    <env>/workspace/support-queue/src/App.tsx
exit 0  $ pnpm lint 2>&1 | tail -5; pnpm typecheck 2>&1 | tail -3; pnpm patchy dev --json 2>&1 | tail -5
exit 0  $ pnpm patchy dev stop 2>&1 | tail -1; pnpm patchy publish --json 2>&1 | tail -15

How it was verified

  • pnpm verify, at 13378bf: 9 of 10 suites pass, including browser (the whole tier 1 suite), cli-smoke, install and tier2-smoke. In test, 12 CLI and executor cases failed. Each failure is an unexpected GET / or other stray request on a local stub server, which the T3 Code harness sends to local ports on this machine. None are in a file this PR touches, and the same tests failed or passed between runs.

  • Packed tarball (scripts/packed-preact-e2e.mjs, in cli-smoke). A consumer of the packed patchy installs no @tanstack package. It typechecks patchy/hotkeys with skipLibCheck: false, with a @ts-expect-error on "Mod+Shift+K". A G H hotkey then updates state on the page's own Preact, in optimized dev and in the single-file build:

    [packed-preact] patchy/hotkeys installs no TanStack package
    [packed-preact] JSX, table and hotkey types resolve without a direct Preact dependency
    [packed-preact] optimized dev: signals, hooks, compat, useQuery and SDK debugging share one runtime
    [packed-preact] single-file published artifact runs with no development instrumentation
    
  • Unit tests (hotkeyRules.test.ts):

    • A cast "Mod+Shift+K", "G mod+shift+k" or "Shift+Mod+K" is left out of registration with one warning each.
    • Two enabled Mod+Ks in one scope warn once, naming both labels. A disabled duplicate, or the same keys in another scope, don't warn.
  • Page imports (pageImports.test.ts):

    • patchy/hotkeys builds and runs on the page graph: ⌘ K on a Mac navigator, Ctrl+K on Windows.
    • It is import_refused on the server graph.
    • With the entry point removed, the page case fails at the build.
  • Generation (SdkApi.test.ts):

    • On tiers 1 and 2 the skill installs with patchy-preact, and stays when a repo moves from tier 2 to 1.
    • It is in index.json's skills and capabilities, and in patchy-loop's catalogue.
    • Tier 0 is gone since feat(patches): tier 0 is gone; existing pages are tier 1 #1048, so the issue's "fresh tier 0" and "moves to tier 0" cases no longer exist.
  • Analytics (PatchesApi.test.ts): a publish's patch.created reports patchy/hotkeys among its SDK imports.

Human checks: a merge gate only Allison can clear. Headless browsers can't show these, because synthetic key presses skip the browser's own shortcuts.

  • Done, by Allison on 2026-10-30, recorded on A Patchy-wide switcher on Mod+Shift+K #1091: Mod+Shift+K reached the page, and the browser did nothing of its own, in Chromium and Zen (Firefox-based) on Linux.
  • Edge: Mod+Shift+K reaches the page. Edge uses Ctrl+Shift+K to duplicate the tab.
  • A real Mac, in Safari and Chrome: Mod+Shift+K reaches the page, and the page's shortcuts fire once. The suite runs Chromium on Linux and only pretends to be a Mac.

Preact 11. Main moved to Preact 11.1.0 (#975) while this was open. Preact 11 runs a passive effect's cleanup after the next paint, so the layer now does its work in layout effects. HotkeyScope activates its scope there (c3d82f1), and every hotkey registers and unregisters there (5246547), so nothing is held back or fires a frame late. Three acceptance rounds with fresh agents sharpened the skill's dialog section (9cf8ac9, d168798): a dialog's own keys go inside its scope, the page's hotkeys stay enabled, and a dialog focuses its field from code. The TanStack pins resolve against Preact 11, and CI installs them with the release-age policy on.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required. A new page entry point and a new project skill; nothing that exists changes.

Labelled one-way, so the deploying agent reads this:

  • What does a revert leave behind? Three things:
    • published versions whose page bundles patchy/hotkeys;
    • repos holding .agents/skills/patchy-hotkeys/;
    • repos whose source imports patchy/hotkeys.
  • Does the release before it still work with that?

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

@allisonmahmood allisonmahmood added the one-way Rolling production back past this PR would break the release before it label Oct 30, 2026
@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines labels Oct 30, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Grok review

Reviewed 13378bf against origin/fix/frame-focus-1087 (stacked on #1097), compared with #1092 and the #1086 decisions it cites. The install failure is the day-old TanStack pin under minimumReleaseAge. Not a finding.

Standards

No Effect service findings. The diff adds page helpers and skill wiring. It does not create, move, refactor, or consume an Effect service. ui-consistency does not apply: no served HTML or CSS.

Hard violations: none. The entry point, glossary, product doc, ADR-0004, ADR-0011, skill generation, capabilities, and packed e2e are the surfaces #1092 names.

Judgement calls:

  • Duplicated code in packages/patchy/src/hotkeys.ts. The same TanStack hotkey walk appears in warnDuplicates and useHotkeyList: typeof registration.hotkey === "string" ? registration.hotkey : registration.hotkey.join(" "). One local helper would do.
  • Middle man. definition wraps the callback as (event) => binding.run(event). run is already (event: KeyboardEvent) => void.
  • Feature envy, mild. warnDuplicates and useHotkeyList read registration.options.scope, meta.name, and enabled. That is the cost of hiding TanStack. hotkeyRules.ts already takes a Mounted shape, so the mapping can stay in one place.

YAGNI: the public surface is useHotkey, useHotkeys, HotkeyScope, formatHotkey, hotkeyKeys, and useHotkeyList. No rebinding, no server entry, no plugin hook. conflictBehavior: "allow" is there because TanStack's own conflict warning names options this API does not have. The Hotkey / Refusal types are the feature: a bad string becomes the error text. formatHotkey and hotkeyKeys take string, not Hotkey<S>, so display is not type-checked and registration is. That matches the product doc.

Spec

(a) Missing or partial: none that hold up.

repeat: false looked missing at first. The prototype already defaults repeat to true and sets requireReset only when repeat === false. #1092 says that behaviour stays, and the new skill line is present: repeat only matters for a chord that can be held; a sequence fires once per completion. Default-on is the prototype, not a drift.

Present and matching the issue: exact pin @tanstack/preact-hotkeys 0.17.1 over @tanstack/hotkeys 0.19.0; Chord is Mod, Alt, and Shift; HotkeyScope is always exclusive with no prop; reserved Mod+Shift+K in either case, including a cast skipped with one warning; conflicts allowed through TanStack and warned once in Patchy's words, naming both labels; type and unit tests for the listed strings; browser spec for G H, text fields, checkbox/radio/range, scopes, useHotkeyList, AZERTY ?, Russian J, one #210 Mod punctuation case, and ⌘ via a Mac platform; pageImports; packed tarball with one Preact and no @tanstack/* install; generation on tiers 1 and 2, catalogue and index; docs, glossary, ADRs, README, initProject AGENTS line written once; no oxlint ignore; no stress.mjs; no default shortcuts sheet.

Tier 0 generation cases: on this base Manifest.tier is 1, 2, or 3, and tier 0 is only a refused historical config. Dropping "fresh tier 0" and "moves to tier 0" is faithful. The suite still installs the skill on tiers 1 and 2 and keeps it when patchy-server is removed.

sdkImports in Patches.ts filters analytics. It is not a serving allowlist. Both MIT notices are copied: 2026 for Hotkeys, 2021 for the store package.

(b) Scope creep: none. Extra refusals (Command, Meta, Ctrl+Shift+K) and the packed @ts-expect-error on the reserved chord stay inside the reserved-chord and packaging rules.

(c) Implemented but wrong: none. The Mac formatHotkey check spoofs navigator.platform. A real Mac press, and #1091 in Edge and Firefox, stay human checks, and the PR says they are not run.

Method

TanStack stays inside hotkeys.ts and hotkeyRules.ts. Nothing from @tanstack/preact-hotkeys is re-exported. hotkeyRules.ts is a real seam: pure permitted, duplicateWarnings, and steps, unit-tested without rendering, and not a second export. The browser spec asserts route, field value, scope list text, and CDP layouts. It is not a snapshot. No leftover workaround for TanStack #206. The 0.19.0 pin includes the #209 fix, and the browser step asserts it.

Nit: whileTyping and repeat have no direct test. reservedChord is exported and unused outside its module.

Standards: 3 judgement calls, no hard violation. Worst: the duplicated hotkey-string join.
Spec: 0 findings.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review

Reviewed 13378bf against origin/fix/frame-focus-1087, using #1092 and #1086, with #1052 as the prototype reference. Changes requested on the following points.

Standards

No merge-blocking standards or YAGNI findings. The patchy/csv mirrors are covered, the exact pins and both MIT notices are present in the packed artifact, and the published hotkeys declarations expose no TanStack names or types. The mapped tuple and template-literal validation rejected the additional invalid-array and union cases I tried, without a material typecheck cost.

Spec

  1. [P2] Check conflicts after the registration updates have settled. In hotkeys.ts:168–174, each warning effect follows only its own TanStack update. Other hooks can still have their previous registrations. Reproduced with two sibling components: “First” binds K and “Second” binds L; one state update swaps them. The console incorrectly warns that “Second” and “First” both use L and both fire, although the completed render still has distinct bindings. Coalesce the check until the effect flush has finished updating registrations, and cover this re-render case in a hook-level test. The current pure duplicateWarnings tests cannot catch the ordering bug.

  2. [P2] Make the skill's layout promise match feat(patches): make publishing replay-safe #210 completely. patchy-hotkeys/SKILL.md:44–50 says positional fallback happens “only” for three cases, then says any other symbol with Mod matches only the typed character. TanStack 0.19.0 also falls back for dead keys, non-Latin symbols/Alt output, and shifted ASCII symbols. For example, I reproduced Mod+Shift+/ firing on a Control+Shift event whose key is ? and code is Slash; Mod+Alt+- also fires for key: "–", code: "Minus". Neither is covered by the stated exceptions. Include feat(patches): make publishing replay-safe #210's remaining exceptions and qualify the “any other symbol” sentence so builders receive the actual layout contract.

  3. [P1, merge gate] Complete the required human browser checks. feat(sdk): patchy/hotkeys gives patches keyboard shortcuts #1092 explicitly requires a real Mac press and A Patchy-wide switcher on Mod+Shift+K #1091's Edge/Firefox check before merge. This PR still marks both unchecked. A Patchy-wide switcher on Mod+Shift+K #1091 currently records Chromium and Zen on Linux, with Edge still outstanding. Record the required results before merging; the passing Chromium tests with platform emulation do not establish that the real browsers release the reserved chord to the page.

Validation: 36 focused hotkey/rules/import tests passed; the changed generation test passed; package Effect typecheck passed; the packed consumer script passed from temporary storage. Browser probes covered normalization, sequences, whileTyping, repeat: false, disabled/listed bindings, exclusivity, duplicate updates, and registration/scope cleanup after 20 scope remounts. Both complete MIT notices were inspected inside the tarball. The one-way label and Release impact answers correctly describe the rollback residue and #1089's prior-deployment requirement. The expected minimumReleaseAge install rejection is not a finding. No checkout files were changed.

Standards: 0 blockers. Spec: 3 blockers; the human browser checks are the pre-merge gate.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review round: Sol and Grok on 13378bf

Fixed in d4d2e97.

Fixed

1. False conflict warning when siblings swap keys (Sol P2). Preact runs a commit's effects one component at a time, in one task. Each hook's check ran right after its own TanStack update, so siblings swapping K and L both held L until the second one updated. Now any hook whose bindings changed schedules one check in a microtask. The check is skipped while one is already pending, so it reads the registrations after every effect in the flush has run (packages/patchy/src/hotkeys.ts, checkDuplicates).

Evidence: a new hook-level browser test, a conflict warning waits for every hook's update, so siblings swapping keys don't warn. Vitest has no DOM here, so it runs as a second page in test/browser-tier1/hotkeys.spec.ts. Sibling components "First" (K) and "Second" (L) swap in one state update, and nothing warns. A third component binding K then warns exactly once, naming both labels. On 13378bf it fails with Sol's message:

- Array []
+ Array [
+   "patchy/hotkeys: \"Second\" and \"First\" both use L in the same scope, so both fire on each press.",
+ ]

With the fix:

✓ [chromium] › test/browser-tier1/hotkeys.spec.ts:118:1 › patchy/hotkeys fires in the published frame across fields, scopes, layouts and a Mac (721ms)
✓ [chromium] › test/browser-tier1/hotkeys.spec.ts:227:1 › a conflict warning waits for every hook's update, so siblings swapping keys don't warn (293ms)

2. The duplicated registration join (Grok). One mapping, mounted, turns a TanStack registration or its view into the Mounted shape that hotkeyRules.ts already defines. Both the duplicate check and useHotkeyList use it. The list now filters on enabled instead of status !== "disabled". In TanStack 0.19.0 these mean the same thing: getRegistrationStatus returns "disabled" only when options.enabled === false. This also covers Grok's feature-envy note, because the mapping now lives in one place.

3. The skill's layout promise (Sol P2). patchy-hotkeys/SKILL.md › Keyboard layouts now states #210's whole rule. I checked it against positionStandsIn in the installed @tanstack/hotkeys 0.19.0. A key falls back to its US position for:

  • a non-Latin letter or symbol, or a dead key;
  • anything on the digit row;
  • an ASCII symbol typed with Shift;
  • a non-ASCII Latin letter typed with Alt, or with Mod on a punctuation key.

Anything else matches only what it typed: a named key, a letter A–Z, an ASCII symbol typed without Shift, or German ü on its own. The "any other symbol" sentence now covers only unshifted symbols, and the skill still says to write bare symbols as typed. Each case has an example, including Sol's two: ⌥- typing – fires "Alt+-", and Ctrl+Shift+/ typing ? fires "Mod+Shift+/".

Evidence: the browser spec pins the shifted-symbol case. A trusted Ctrl+Shift press with key: "?" and code: "Slash" fires "Mod+Shift+/", and not "?" or "Mod+/", which are also registered on that page (the first test above).

4. The human checks (Sol P1). The PR body now records Allison's 2026-10-30 check from #1091: Mod+Shift+K reached the page, and the browser did nothing of its own, in Chromium and Zen (Firefox-based) on Linux. Edge and a real Mac (Safari and Chrome) are still open, unticked.

Kept as is

  • definition's callback wrapper (Grok, middle man). TanStack calls back with (event, context). The wrapper passes only the event, so a builder's run never receives a TanStack object. useHotkey("X", console.log) would otherwise log TanStack's context.
  • Direct tests for whileTyping and repeat (Grok nit). Each passes straight through to one TanStack option (ignoreInputs, requireReset). The browser spec covers the default behaviour in text fields, and Sol's browser probes exercised both options. A test of the pass-through would only restate the line.
  • reservedChord is exported but used only in its own module (Grok nit). It wasn't in this round's list. Dropping export is a one-word, behaviour-neutral change if wanted.
  • One narrower timing case remains. If a component renders again before the frame, for example because a layout effect set its state, Preact runs that component's pending effects early. A sibling's effects wait for the frame. A key swap between those two could still warn once. Closing that gap would mean either copying Preact's frame scheduling or keeping a second registry in layout effects. I didn't, since the cost is one console line in that case.

Checks

  • pnpm check: format, lint, typecheck and synth pass. In test, 2,590 pass and 12 fail, in cliPublish, cliLifecycle, cliRepo, LocalTaskProvider and RequestEvents. As in the earlier pnpm verify run, each is a stray GET / or extra request on a local stub server, which the T3 Code harness sends to local ports on this machine. None are in hotkeys code, and the generation and page-import suites pass.
  • vitest run on hotkeys.test.ts, hotkeyRules.test.ts and pageImports.test.ts: 36 passed.
  • effect-tsgo typecheck of packages/patchy, plus Oxlint and Prettier on the changed files: clean.
  • test/browser-tier1/hotkeys.spec.ts in Chromium, under the shared lock: 2 passed.
  • Not rerun: pnpm verify. The PR body's verify line is marked as from 13378bf.

Still waiting on Allison

  • Edge: Mod+Shift+K reaches the page.
  • A real Mac, in Safari and Chrome: Mod+Shift+K reaches the page, and the page's shortcuts fire once.
  • CI fails at install until 2026-10-31 13:21 UTC, on the one-day minimumReleaseAge for the two TanStack releases. That's expected. Re-run the checks after the cutoff.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol re-check

Re-checked 13378bf..99a1429 against the prior Sol and Grok reviews and the author's reply. No merge-blocking findings from this fix round.

  • Duplicate warnings: the coalesced microtask runs after Preact's normal synchronous after-paint effect flush, so it observes both siblings' updated registrations. Independently replayed the new browser regression against each revision: it fails on 13378bf with the reported false “Second”/“First” conflict on L, and passes on 99a1429, including the later real duplicate warning exactly once.
  • The narrower timing case is real, but non-blocking. A layout-effect state update can cause one component's pending effects to run before its sibling's. I reproduced the transient false warning; after settling, K and L each invoke their correct handler once. This remains a console-diagnostic edge, rather than a regression introduced by this round. The warning is not restricted to development builds.
  • Layout guidance: the revised cases agree with fix(hotkeys): Trust the reported character over the key's US position TanStack/hotkeys#210 and the installed 0.19.0 positionStandsIn implementation, including dead keys, non-Latin output, shifted ASCII symbols, and non-ASCII Latin output with Alt or Mod on punctuation. The unshifted-symbol qualification removes the previous over-promise. The new trusted key: "?", code: "Slash", Ctrl+Shift event correctly fires Mod+Shift+/; the browser case passes.
  • Shared mapping: mounted preserves the previous scope, chord/sequence text, label and enabled values. In this pinned TanStack version, getRegistrationStatus returns "disabled" exactly when options.enabled === false, so the list's filter is equivalent and still includes suspended hotkeys.
  • Kept items: the callback wrapper deliberately strips TanStack's second callback argument. Keeping the existing tests for the unchanged whileTyping/repeat forwarding is reasonable. Making reservedChord private changes no behavior. No other blocking regression found in the round's four-file diff.

Validation: both Chromium browser tests pass at 99a1429; the separate early-effect probe confirms the residual console edge and correct settled handlers; 36 focused hotkeys/rules/page-import tests pass; the package Effect typecheck passes. Browser tests were run from temporary copies against each revision's hotkeys source, with the existing published-frame fixtures. No checkout files were changed.

@github-actions github-actions Bot added size:xl Over 1,000 changed lines; review in multiple passes and removed size:l 501-1,000 changed lines labels Oct 31, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Fix: the scope stayed on after it closed, on Preact 11

Fixed in 8de35be.

Cause. Preact 11 changed when useEffect cleanups run on unmount. Preact 10.29.8 ran every hook's cleanup inside the commit. Preact 11.1.0 runs passive cleanups after the next paint (options.unmount in preact/hooks queues them for the after-paint flush). Only layout cleanups still run in the commit. TanStack's HotkeysProvider (@tanstack/preact-hotkeys 0.17.1) activates its scope in a useEffect and releases it in that effect's cleanup. So after a HotkeyScope unmounted, its exclusive scope kept holding the page's hotkeys for about a frame. Keys pressed in that window were lost, and Playwright presses fast enough to hit it every run. The same lag applied on open: a key pressed just after the scope mounted still reached the page for a frame.

The patchy/hotkeys bundle holds a single copy of Preact. preact is external there and resolves to the one the page imports. useId and the store subscription are not involved.

Reproduction. A page renders a HotkeyScope over a page-level L hotkey. Escape closes the scope, and the page then presses L at four moments after the scope's content leaves the DOM:

L pressed Preact 10.29.8 Preact 11.1.0 Preact 11.1.0 with this fix
as the scope's content leaves the DOM fires held back fires
next task fires held back fires
next frame fires held back fires
100 ms later fires fires fires

On open with Preact 11.1.0, before the fix the page's L fired for the first frame. With the fix it is held back from the first commit.

Fix. HotkeyScope activates its exclusive scope itself, through getHotkeyManager().activateScope, in a useLayoutEffect. Preact runs that effect and its cleanup within the commit that mounts or removes the scope. The provider no longer gets a scope prop, so it activates nothing. It gets the scope through defaultOptions.hotkey.scope, so the hotkeys inside it still register in that scope, and nested scopes still find their parent. The scope is still always exclusive, and the public API is unchanged.

This is TanStack's behaviour meeting Preact 11's timing, not a Preact bug. React also runs passive cleanups after paint, so TanStack's React adapter has the same frame of lag. I haven't filed upstream.

Test. The scope step in test/browser-tier1/hotkeys.spec.ts now presses L from a MutationObserver the moment the scope's list leaves the DOM, instead of after Playwright notices it's gone. That is the earliest moment any key can arrive. Without the fix the step fails on every run. Before, it only failed when Playwright happened to beat the frame.

Checks.

  • Clean install on this branch: pnpm install --frozen-lockfile with no overrides passes the supply-chain policy. It is the stack's first clean install under the policy.
  • In Chromium, hotkeys.spec.ts and focus.spec.ts pass: 5 of 5. The full browser suite passes too: 79 of 79.
  • pnpm test:packed-preact-e2e passes.
  • pnpm check passes format, lint, typecheck and synth. Its offline tests fail only in the known local noise: the CLI stub-request tests, from this machine's stray local-port probes, and load timeouts (flake(execution): Supervisor idle-sibling eviction test timed out on Node 22 #665). One of those, a cliRepo init test, passes alone.
  • pnpm verify: postgres-concurrency and install pass. cli-smoke and tier2-smoke failed inside PGlite ("Failed to connect", "Write initial generation failed") with the machine at a load average of about 30. The browser suite had one database-unavailable 503 in a server-subscriptions test, and it passed on its retry above. None of these touch hotkeys; CI is the judge.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol re-check (Preact 11)

Both new fixes are correct. One remaining P2 blocks #1098 and therefore the stack. No separate blocker in #1107.

[P2] Give ordinary bindings commit-time registration and cleanup — packages/patchy/src/hotkeys.ts:184–189. useBindings still delegates to TanStack's passive useHotkeys effects. On Preact 11, an unmounted component's unscoped bindings remain live until the after-paint cleanup. This breaks the documented “while the component is mounted” lifetime and can repeat actions against a view that has already closed.

Reproduced in Chromium with two consecutive trusted keyboard.press("Escape") calls: the first invokes a component's handler and removes it; the second invokes that same handler again after removal. A separate removal-observer probe reproduced stale chord and sequence callbacks through useHotkeys. Component replacement also sends the immediate key to the old callback. This is enough to block a merge. HotkeyScope protects bindings in a scope that unmounts with them, but ordinary page/component bindings have no such protection.

The smallest correct fix belongs in useBindings: retain TanStack's exported createHotkeyBindings() reconciler in a ref, update it in a layout effect, and destroy it in layout cleanup. Carry the existing provider defaults through prepareHotkeyDefinitions, and declare the exact core dependency for the exported @tanstack/hotkeys/adapter import. Keep reconciliation across renders so an unrelated render does not restart a sequence. No second registry or scheduling system is needed. Add one focused browser lifecycle case covering mount, removal and replacement. A callback-only guard leaves stale default prevention and the missing first key unresolved. The passive registration gap on mount predates Preact 11; the newly delayed unmount cleanup is the merge blocker here.

The requested checks on the two fixes pass:

  • Scope ownership and nesting: without a scope prop, the provider activates nothing; its merged defaultOptions.hotkey.scope puts registrations in the manually activated scope and supplies the correct parent to nested scopes. The manager explicitly supports child-first activation through parent. Nested chord/sequence isolation, immediate release to the parent/page, stable activation across rerenders, and 20 nested remount cycles passed. The returned release is activation-specific and idempotent, so cleanup/setup replay is safe. Scoped registrations awaiting passive cleanup cannot fire after their scope is released.
  • API exposure: getHotkeyManager and activateScope are public exports with declarations and documented examples, not private implementation access. The adapter uses the same manager call. TanStack calls this a beta; upgrades still need these lifecycle checks. Exact adapter/core pins prevent a patch release being picked up automatically. This is not a blocker.
  • Sheet timing and focus: both scope activation and showModal() now finish in the synchronous layout commit, before a browser key can interleave. At the opening MutationObserver, page L and Escape callbacks stayed silent; native Escape closed the dialog. Layout cleanup closed it before removal and restored the original focus. Close-button dismissal restored the opener. The earlier P2 remains fixed.

Validation used the installed Preact 11.1.0 / TanStack versions and isolated Chromium bundles of the checkout's source. An in-memory layout-lifecycle probe removed the stale callbacks and immediate-mount gap, preserved an in-progress sequence across a rerender, and retained the passing scope/sheet behavior. No checkout files changed; no dependencies installed or policy overridden. No other merge-blocking intent, standards, method or YAGNI findings.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Re: Sol re-check (Preact 11): [P2] ordinary bindings, fixed in 5246547

  • useBindings now keeps TanStack's createHotkeyBindings() reconciler for the component's lifetime. Each render updates it in a layout effect with prepareHotkeyDefinitions(…, { defaults }), and layout cleanup destroys it. The provider defaults still carry a HotkeyScope's scope. Registrations update in place, so a render doesn't restart a sequence, and there is no second registry. The reconciler is held with useState(createHotkeyBindings), which gives the same stable instance as a ref without the null handling.
  • @tanstack/hotkeys is now an exact 0.19.0 devDependency beside @tanstack/preact-hotkeys 0.17.1, for the /adapter import. It was already bundled through the Preact adapter and shares its MIT notice, so the license copying needs no change.
  • The duplicate check also moved to a layout effect. With registration in the commit, the list settled before an after-paint check ran, so the conflict case read the warnings too early. Its microtask still runs after every sibling's layout effect. As a probe I made the check synchronous, and the swap case failed with the false "Second"/"First" warning, as it should.

Test. a component's hotkeys are live from the commit that mounts it to the one that removes it, in test/browser-tier1/hotkeys.spec.ts. A MutationObserver sends Escape at the moment the panel's DOM changes. The case then checks which handler ran and defaultPrevented:

  • Mount: the first key reaches the new panel.
  • Removal: the old panel isn't called again, and its preventDefault doesn't linger.
  • Replacement: the key reaches only the new panel.

On c3d82f1, each step failed on its own: on mount the key wasn't prevented, on removal the handler fired ["first", "first"], and on replacement the key fired "first" instead of "second".

Verified.

  • hotkeys.spec.ts and focus.spec.ts: 6 of 6 pass.
  • The hotkey*/pageImports unit tests: 36 pass.
  • pnpm check: format, lint, typecheck and synth pass. Its test failures are the local stray-GET / CLI stubs and execution timeouts, and RequestEvents passes when run alone.
  • pnpm test:packed-preact-e2e passes.
  • dist/hotkeys.d.ts exports the same names and still has no TanStack names.

Next, #1107 gets rebased onto this.

@allisonmahmood

allisonmahmood commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner Author

Sol re-check (binding lifetime)

No merge-blocking findings. The previous P2 is fixed on #1098, and #1107 retains the scope/dialog fixes after the rebase.

  • Binding lifetime: registration and destruction now complete in layout commits. Callback/options changes and enabled toggles apply immediately; unchanged sequences retain their registration and progress across rerenders. The useState initializer only creates the reconciler, and its destroy() clears registrations without making it unusable, so cleanup/setup replay works. Keeping upstream's reconciler is appropriately small; no additional registry or abstraction is needed.
  • Scopes: prepareHotkeyDefinitions carries the provider's default scope into both chords and sequences. Nested exclusivity, rerenders, immediate release and unmount ordering pass; repeated nested remounts and cleanup/setup replay leave no stale registrations or active scopes.
  • List and warnings: useHotkeyList follows registration, label, enabled and removal changes, including when called alongside a binding. The layout-effect-plus-microtask check still sees the completed sibling update: swapping keys stays silent, and adding a real duplicate warns once.
  • Packaging: both adapter helpers are public /adapter exports with declarations, and the official Preact adapter uses them itself. The exact core pin agrees with the manifest, lockfile and adapter dependency. The built entry contains one core copy, with Preact external; generated hotkeys.d.ts contains no TanStack names. The existing licence notice covers the added direct import. No API-stability blocker with these exact pins.
  • Sheet: scope isolation holds at the opening MutationObserver; native Escape closes while the page's Escape binding stays silent. Focus restoration, Tab containment, all three close paths and immediate page-hotkey resumption pass. The earlier findings remain fixed.

Validation: 11 focused sandboxed-Chromium probes on #1098 and 14 on #1107, using Preact 11.1.0 and the installed TanStack versions; isolated hotkeys-entry builds, declaration generation and consumer typechecks at both heads. This was a focused re-check, not a full-suite run. No dependencies installed or release-age policy changed. The scratch worktree was removed; no existing checkout files changed.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked d168798 (base 1b2ff25, #1097's head) on team, by Claude Opus 5.5 in Claude Code, through T3 Code.

The autofocus failure from the last verdict is fixed. All three fresh agents focused each dialog's field from useLayoutEffect, as the skill's new example does, and none used autofocus. In every published tracker, a second person drove ?, Mod+K, C T, Escape and the G sequences from the keyboard alone, without clicking into the frame. The task they created from the keyboard showed up for a third person.

What I relied on. Since 5246547, the head changes only packages/sdk/skills/patchy-hotkeys/SKILL.md and one sentence of packages/patchy/README.md (git diff --stat 5246547 d168798). The layer, its types, packaging, generation and specs haven't changed, so I relied on the earlier verdicts' checks of them and didn't repeat them.

Done means

  • A fresh agent asked for a tracker with G sequences, C T and a ? list of shortcuts builds it from the skill alone: passed.
    I gave three fresh Sonnet 5.5 agents the same brief as last time, word for word, through the environment's agent launcher. It asks for G H, G D, a Mod+K search box, C T to open a create dialog and ? for the list. Each agent's repo got a patchy-hotkeys skill byte-identical to the head's, and each agent read it. Each used useHotkey, HotkeyScope and useHotkeyList, passed typecheck and lint, and published. None opened a browser or pressed a key (Builders' agents press keys and click in their dev page #1090).

    How each wrote its dialogs:

    Run Where the scope is Dialog's Escape Page hotkeys Dialog's field
    1 Dialog renders <HotkeyScope><DialogBody/></HotkeyScope> in DialogBody always enabled useLayoutEffect(() => title.current?.focus(), [])
    2 SearchDialog, CreateDialog and HelpDialog each render <HotkeyScope> around a body in each body always enabled useLayoutEffect(() => input.current?.focus(), [])
    3 Shell renders <HotkeyScope><ShellBody/></HotkeyScope> in ShellBody always enabled useLayoutEffect(() => input.current?.focus(), [])

    I opened each tracker as Ben and used only the keyboard, in Chromium and in Firefox. The results were the same in both:

    Run ? lists Escape closes ? Mod+K: focus, then typing C T: focus, typing, Enter Page hotkeys after each close Ben's task shows for Cleo
    1 all 5 page shortcuts and Esc yes field focused, text lands field focused, text lands, Enter saves and closes G D → /done, G H → /, C T reopens yes
    2 all 5, Esc and its own ? to close yes field focused, text lands field focused, text lands, Enter saves and closes G D → Done view, G H → To do, C T reopens yes
    3 all 5 and Esc yes field focused, text lands field focused, text lands, Enter saves and closes G D → /done, G H → /, C T reopens yes
    The sheets and one trace
    run 1  ? → Keyboard shortcuts: Go to the task list G then H · Go to done tasks G then D · Search tasks Ctrl K · Create a task C then T · Show all shortcuts ? · Close Esc
    run 2  ? → Keyboard shortcuts: G H Go to task list · G D Show done tasks · Ctrl+K Search tasks · C T Create a task · ? Show all shortcuts · Esc Close · ? Close shortcuts
    run 3  ? → Keyboard shortcuts: G then H Go to the task list · G then D Show done tasks · Ctrl+K Search tasks · C then T Create a task · ? Show all shortcuts · Esc Close dialog
    
    [firefox run3] Mod+K → dialogs 1; focus INPUT[Search tasks]=""
    [firefox run3]   typed "zzqx" → focus INPUT[Search tasks]="zzqx"
    [firefox run3]   Escape → dialogs 0; focus BODY
    [firefox run3]   then G D → /acme/team-tasks-3/done
    [firefox run3]   then G H → /acme/team-tasks-3/
    [firefox run3] C T → dialogs 1; focus INPUT[Task title]=""
    [firefox run3]   typed "Keyboard task firefox" → focus INPUT[Task title]="Keyboard task firefox"
    [firefox run3]   Enter → dialogs 0; focus BODY
    [firefox run3]   C T again → dialogs 1
    [firefox run3]   Escape → dialogs 0; focus BODY
    [firefox run3]   closed by: Enter; list shows "Keyboard task firefox": true
    [firefox run3] Cleo opens 200 /acme/team-tasks-3; sees "Keyboard task firefox": true
    

    Run 2 keeps its view in component state rather than the route, so its URL doesn't change. Its heading went from To do to Done on G D and back on G H, before and after a dialog.

  • A builder writes "G H", "Mod+K", "?" and a dialog in <HotkeyScope>, and the published patch responds on the first press: passed. In each tracker, the first key, with no click, opened the ? sheet in both browsers. formatHotkey("Mod+K") shows Ctrl+K on Linux. The earlier emulated-Mac ⌘ K check still applies, since the code hasn't changed.

  • "Ctrl+K", "Control+K" and "Mod+Shift+K" fail pnpm typecheck with what to write instead: passed in the earlier verdicts on the same code. Not re-run.

  • A real Mac, and A Patchy-wide switcher on Mod+Shift+K #1091 in Edge: not run, as below.

The skill's new example

  • It compiles in a real patch repo. I ran patchy init for a fresh tier 1 repo on the instance, whose patchy-hotkeys skill matched the head byte for byte. I copied the "Dialogs and scopes" example verbatim, imports included, into src/. pnpm typecheck and pnpm lint both exited 0. Changing its "Escape" to "Esc" failed typecheck with the layer's message, which shows the file was checked.
  • Its new sentence is right. Browsers ignore autofocus in a cross-origin frame, as the last verdict saw. All three agents followed the example's useLayoutEffect focus, and it works in Chromium and Firefox.

Golden journeys

  • Publish a page: passed. Ada's agent published three trackers with her CLI. Ben and Cleo each opened every one with a 200.
  • No other journey is touched by a docs-only commit. CI's browser and tier2-smoke pass on the head.

CI on d168798: every finished check passed, including browser, cli-smoke, install on all three platforms, lint, test (26), tier2-smoke and rollback-rehearsal. When I posted, test (22), test (24), attio-live and pidgeon-suite were still running. test (26) passed, and it runs the same suite on Node 26.

Rollback answers: they match the diff and haven't changed since the last verdict.

Not run

  • The earlier verdicts' code checks (lifetimes, sequences, typing rules, repeat, duplicates, packed package, generation): I relied on them, since the code hasn't changed since 5246547.
  • Mod+Shift+K on a real Mac (Safari and Chrome) and in Edge: these need a person at the keyboard. They're the merge gate in the PR body.
  • The undirected support-queue trial: it's informational in Done means, and the PR body records it.
  • pnpm verify locally: the machine is shared, so CI's suites stand in for it.

Notes

run3-chromium-create

Base automatically changed from fix/frame-focus-1087 to main October 31, 2026 22:50
allisonmahmood added a commit that referenced this pull request Oct 31, 2026
## What changed

This adds release 32's What's new entry, written from `58d94b3`. It
covers everything merged since release 31's `through` (`5888411`). It
also sets the `patchy` release to `0.32.0` in
`packages/patchy/package.json` and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| Fixed: a patch has the keyboard as soon as it opens, so its shortcuts
work, and Space and Page Down scroll it, without a click first | #1097 |
| Improved: agents give a patch pages of its own, each view at its own
address under the patch, with back and forward working; repos pick it up
at their next refresh | #1095 |
| Fixed: a patch that hits Pidgeon's hold on a new message is told
nothing was sent and to reply in the conversation, not to wait and retry
| #1139 |
| Behind the scenes: refresh and `patchy dev` keep working when a repo
holds a skill the instance's release doesn't ship, so a rollback can't
break them | #1099 |

#1138 is a live test tier change with nothing that ships. #1140 is
release 31's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `9e176cb` (release 31) to
`58d94b3`:** #1138, #1139, #1097, #1095 and #1099. None is labelled
`one-way`, and their Release impact answers agree:
  - #1097 changes only the shell's script.
  - #1095 changes only skill text.
- #1139 adds a `details.limit` value and a `details.message` on an
existing refusal.
- #1099 adds no skill, so a repo refreshed on this release holds only
skills release 31 also ships.
  - #1138 is tests only.
- **#1099 has to be live before #1092 (PR #1098, `patchy/hotkeys`)
ships.** That's why this release goes out alone. Once #1098 is live, a
rollback to release 32 or later keeps refresh and dev working for repos
that picked up the new `patchy-hotkeys` skill.

**Rollback line:** If this release misbehaves, roll back to `9e176cb`
(release 31).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `schemas.test.ts` and
`WhatsNewPages.test.ts` pass (21 tests), and prettier passes on the
changed files.
- **The range.**
- #1097, #1095 and #1099 were each reviewed by GPT 6.1 Sol, with every
finding resolved. Each got a fresh acceptance PASS with notes after its
rebase onto Preact 11.
  - Each landed with all 12 required checks green on its final head.
  - #1138 and #1139 were merged from their own thread.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`9e176cb` (release 31). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

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

Text and version numbers only. The `0.32.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

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

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

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood and others added 7 commits November 1, 2026 01:07
Preact runs a commit's effects one component at a time, so each hook's
duplicate check saw siblings halfway through swapping keys and warned
falsely. One check now runs in a microtask after the flush. The
registration-to-Mounted mapping is shared by the check and useHotkeyList.

The patchy-hotkeys skill states TanStack/hotkeys#210's whole layout rule:
dead keys, Alt output and shifted ASCII symbols also fall back to the
key's US position.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preact 11 runs a passive effect's cleanup on unmount after the next paint,
where Preact 10 ran it in the commit. TanStack's HotkeysProvider holds its
exclusive scope in a passive effect, so after a HotkeyScope unmounted the
page's hotkeys stayed held for about a frame, and keys pressed then were
lost. On open the same lag let a key reach the page after the dialog
showed.

HotkeyScope now activates its exclusive scope itself, in a layout effect,
which Preact still runs and cleans up within the commit. The provider gets
the scope through its default options, so its hotkeys land in it without
a second activation. The browser step presses L from a MutationObserver as
the scope's list leaves the DOM, which fails without this change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ts or removes it

TanStack's useHotkeys registers and unregisters in passive effects. Preact 11
runs an unmounted component's passive cleanup after the next paint, so a
removed component's hotkeys took the next key, including one meant for the
component that replaced it, and a new component missed a key pressed before
its first paint.

useBindings now keeps TanStack's own reconciler and updates it in a layout
effect, destroying it in layout cleanup. Provider defaults still carry a
HotkeyScope's scope, and each render updates the registrations in place, so a
sequence in progress survives. The duplicate check runs in the same phase, so
its warning lands in the task that registered the hotkeys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Acceptance gave the hotkeys skill to three fresh agents, and all three
registered a dialog's Escape in the component that renders HotkeyScope,
where the scope holds it back, and disabled the page's hotkeys while a
dialog was open, which took them off the shortcuts sheet. The skill now
says what inside a scope means, shows it, and says to leave the page's
hotkeys enabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Acceptance's second trial found two of three fresh agents putting
autofocus on a dialog's field. A patch's page runs in a cross-origin
frame, where browsers ignore autofocus, so after C T typing went
nowhere. The skill's dialog example now focuses its field from a layout
effect and says why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit 06d89a2 into main Nov 1, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the feat/hotkeys-1092 branch November 1, 2026 00:19
allisonmahmood added a commit that referenced this pull request Nov 1, 2026
## What changed

Agents adding shortcuts each built their own `?` sheet from
`useHotkeyList`: every one looked different, and each cost the builder
time. `patchy/hotkeys` now ships one. `<HotkeySheet />` puts a `?`
button on the page and opens a shortcuts sheet, in the company look,
that lists the patch's labelled hotkeys by group. While it is open the
page's hotkeys wait; Escape, its close button or a tap outside closes
it, and focus goes back.

Closes #1093. Stacked on #1098 (base `feat/hotkeys-1092`).

## Look at

**1. The sheet, direction A from the mock round.** A demo patch
published to a throwaway `pnpm dev up team` instance at this commit,
with `?` pressed. The Patchy look is on an emulated Mac (⌘); the company
look is the dark `linear` fixture, on Linux (Ctrl).

![Patchy look,
desktop](https://github.com/user-attachments/assets/92db8d96-e423-4fdd-9e3f-6d3cfce0eaf5)

<details><summary>Company look, desktop</summary>

![Company look,
desktop](https://github.com/user-attachments/assets/87e5ff74-34d3-4716-830a-b585949df594)

</details>

| Patchy look, phone | Company look, phone |
| --- | --- |
| ![Patchy look,
phone](https://github.com/user-attachments/assets/bdb49849-ec14-4be3-8812-0af188086152)
| ![Company look,
phone](https://github.com/user-attachments/assets/97bf844f-ff29-4827-b9fd-e942edf085e6)
|

At phone width it rises from the bottom edge with its own scroll, and
its close button becomes a 44px "Close". The demo page's own header
wraps the `?` button onto a second row in the Patchy phone shot; that is
the demo's CSS, not the sheet.

**2. Customizing stays two additions.**

```tsx
import { HotkeySheet, useHotkey } from "patchy/hotkeys";

useHotkey("G H", goHome, { label: "Go home", group: "Navigation" });

<HotkeySheet />
<HotkeySheet title="Tracker shortcuts" hotkey="Mod+/" />
```

`hotkey` is checked like `useHotkey`'s: `<HotkeySheet hotkey="Ctrl+/"
/>` fails typecheck with `'Ctrl+/' isn't a chord: write 'Mod+/', which
is ⌘ on a Mac and Ctrl elsewhere`. Named groups list in first-seen
order; ungrouped hotkeys, the sheet's own "Show shortcuts" included,
come last under General; with no groups it is one list with no heading.
Anything else is still a sheet of the builder's own from
`useHotkeyList`, which now carries `group`.

**3. Closing never waits on the dialog's `close` event.** The sheet is a
native `<dialog>` opened with `showModal()`, which brings the top layer,
an inert page and focus restore. The first browser run caught Chrome
firing `close` late: after a click on the close button it arrived only
with the next keydown, so the sheet's `HotkeyScope` stayed mounted and
swallowed that key. Now the sheet's state is the source of truth. The
close button, a click on the scrim and the dialog's synchronous `cancel`
(Escape) close it, and unmounting calls `dialog.close()`, which returns
focus. The browser spec presses a page hotkey right after each way out.

Decisions worth a glance:

- **Escape** closes through the dialog's own `cancel`, with no scoped
Escape hotkey, so it stays out of the list. TanStack's code settles the
two questions this hinged on: a scope holds the page's hotkeys back
whether or not it registers any, and a held-back match doesn't cancel
the key's default. So a page's own `Escape` hotkey waits and the dialog
still closes; the spec has one.
- **Styles.** The SDK ships no CSS files; a page's look reaches it as
`patchy/_generated/look.css`, which the build inlines. So the first
sheet mounted adds one `<style>` to `<head>`, in `@layer
patchy-hotkeys`. It lands after the look's `@layer look`, so it beats
the look's `button` and `h2` styles, and the patch's own unlayered CSS
beats it. `<HotkeySheet />` stays one line with no import to remember,
and the frame's CSP allows inline styles. It reads only `--look-*`
tokens, each with a system colour when a page has no look, and nothing
animates.
- **Tab** stays on the close button, the dialog's only stop; otherwise
it leaves the frame for Patchy's bar.
- **The opener's accessible name** follows `title`, "Keyboard shortcuts"
by default, so it names the dialog it opens.
- A single list narrows the card to one column's width.

## How it was verified

- `packages/patchy/src/hotkeySheet.test.ts`: groups in first-seen order,
ungrouped last under General (joining a named General), one unnamed list
when nothing has a group.
- `packages/patchy/src/hotkeys.test.ts`: the published declarations
accept `group` and `HotkeySheet({ title, hotkey })`, and refuse `hotkey:
"Ctrl+/"` with `useHotkey`'s message. `<HotkeySheet hotkey="…" />` in
JSX was checked by hand against the same declarations: `Mod+/` passes,
`Ctrl+/` and `Mod+Shift+K` are refused.
- `test/browser-tier1/hotkeys.spec.ts` adds the sheet in the published
frame: `?` opens it and focus moves to its close button; the listing by
group with each hotkey's keys; the page's `L`, `G H` and `Escape` wait
while it is open; Tab and Shift+Tab stay inside; Escape, the close
button and a click on the scrim each close it, focus returns to where it
was, and the next page hotkey fires at once. It failed on the late
`close` event above before the fix.
- `pnpm check`: format, lint, typecheck and synth pass. `pnpm test`:
2590 of 2605 pass. The 15 failures are CLI tests whose stub server
received a stray `GET /` from a local port prober on this machine, a
different set on a rerun, plus two load flakes that passed on rerun;
none touch hotkeys.
- `pnpm test:postgres-concurrency`: 28 passed. `pnpm test:browser`, the
full tier 1 suite: 80 passed.
- On Preact 11 (#975), after the stack was rebased: `pnpm
test:packed-preact-e2e` passes. Opening and closing the sheet now run in
a layout effect, so focus returns to the opener on close. The new export
needs no change to the package build: it lives in the existing
`patchy/hotkeys` entry, and its hooks share the page's Preact as
`useHotkey`'s do.

## Release impact

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

Additive: a new export, a new optional hotkey option and a new optional
field on `ListedHotkey`. Nothing server-side.

- **What does a revert leave behind?** Published patches keep working,
since a Helper is bundled into each patch. A repo that uses
`HotkeySheet` or `group` and refreshes to a release without them fails
its build until it drops them.
- **Does the release before it still work with that?** Yes: no schema,
wire or CLI change.

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

---------

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

This adds release 33's What's new entry, written from `d5a7862`. It
covers everything merged since release 32's `through` (`58d94b3`). It
also sets the `patchy` release to `0.33.0` in
`packages/patchy/package.json` and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: patches can have keyboard shortcuts that work as soon as the
patch opens, and `?` opens a sheet listing them in the company's look.
Repos pick it up at their next refresh | #1098, #1107 |

#1146 is release 32's own entry. The shortcuts and the sheet are one
change: the sheet lists the shortcuts and has nothing to show without
them.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `3f4a842` (release 32) to
`d5a7862`:** #1098 and #1107.
  - **#1098 is labelled `one-way`.** Its answers hold:
- Published patches keep working on a rollback, because the helper is
bundled into each page.
- Refresh and `patchy dev` keep working, because release 32 carries
#1099. Generation there leaves out the `patchy-hotkeys` skill it doesn't
know, and the CLI removes the folder.
- A repo whose page imports `patchy/hotkeys` can't build a new version
until production rolls forward.
- **#1107** is additive: a new export and an optional option. A repo
that uses `HotkeySheet` or `group` can't build on the older release
either.
  - This is why #1099 went out alone in release 32 first.

**Rollback line:** If this release misbehaves, roll back to `3f4a842`
(release 32). Published patches keep working; a repo whose page imports
`patchy/hotkeys` can't publish a new version until production rolls
forward again.

## How it was verified

- **Tests.** `whatsNew.test.ts`, `schemas.test.ts` and
`WhatsNewPages.test.ts` pass (21 tests), and prettier passes on the
changed files.
- **The range.**
- **Sol reviews.** #1098 and #1107 were each reviewed by GPT 6.1 Sol,
with re-checks after the Preact 11 fixes. Every finding was resolved.
- **#1098's acceptance passed with notes** on its third round. The first
two failed on the skill: fresh agents misplaced a dialog's Escape, then
used `autofocus`. The third round's agents built trackers that work
entirely from the keyboard.
  - **#1107's acceptance passed with notes.**
- **Checks.** Each landed with all 12 required checks green on its final
head.
- **Not done:** Allison's Edge and real-Mac Mod+Shift+K checks, recorded
as a human gate in #1098's body. CI covers Chromium on Linux and an
emulated Mac.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`3f4a842` (release 32). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

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

Text and version numbers only. The `0.33.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

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

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

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

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area one-way Rolling production back past this PR would break the release before it 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(sdk): patchy/hotkeys gives patches keyboard shortcuts

1 participant