Skip to content

feat(sdk): hotkey labels say Enter, not ↵, off a Mac, and refuse misspelt keys - #1177

Merged
allisonmahmood merged 1 commit into
mainfrom
hotkeys/format-words-1160
Nov 4, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
hotkeys/format-words-1160

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

What changed

On Windows and Linux, formatHotkey and hotkeyKeys drew Delete, Backspace, Enter and Space as ⌦ ⌫ ↵ ␣, which are Mac conventions: a hint read "Ctrl+↵" where "Ctrl+Enter" is clearer. Both helpers also took any string, so formatHotkey("Mod+Entr") typechecked. Now those four keys are words off a Mac, while a Mac keeps its symbols. A misspelt literal fails typecheck the way it does for useHotkey, and modifier-only labels such as "Mod" and "Mod+Shift" still work.

Closes #1160

Look at

  • Words off a Mac. TanStack's display keyLabels override supplies the four words whenever the platform isn't a Mac. A new runtime test fakes the navigator for Windows, Linux and a Mac. On main it fails at the first assertion:

    AssertionError: expected 'Ctrl+↵' to be 'Ctrl+Enter'
    

    On this branch it passes:

    formatHotkey("Mod+Enter") hotkeyKeys("Space Shift+Backspace Delete")
    Windows, Linux Ctrl+Enter [["Space"], ["Shift", "Backspace"], ["Delete"]]
    Mac ⌘ ↵ [["␣"], ["⇧", "⌫"], ["⌦"]]
  • The input is checked. Both helpers take Shown<S>: a hotkey checked like useHotkey's, modifiers alone, or a string that isn't a literal. That last case keeps hotkeyKeys(row.hotkey) working for rows from useHotkeyList, as custom sheets and HotkeySheet itself use it. On main the new typecheck test reports no errors. On this branch it reports exactly these two:

    consumer.ts(11,14): error TS2345: Argument of type '"Mod+Entr"' is not assignable to parameter of type '"'Mod+Entr' isn't a chord: write keys like 'Mod+K', 'Escape', '?' or 'G H', modifiers in the order Mod, Alt, Shift"'.
    consumer.ts(12,12): 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"'.
    

    "Mod", "Mod+Shift", "Mod+Alt+Shift", sequences, Chord values and useHotkeyList rows all still typecheck in the same file.

How it was verified

  • pnpm exec vitest run src/hotkeys.test.ts in packages/patchy: the two new tests fail on main and pass here.
  • pnpm verify: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser pass. The browser suite includes formatHotkey("Mod+K") in the published frame on Linux and on an emulated Mac. test and test (bun) failed only in suites this change doesn't touch: stray GET / requests to the CLI's local stub servers, timeouts and Vitest worker crashes on a heavily loaded shared machine. LocalTaskProvider.test.ts fails the same way on clean main here. No hotkeys test failed.
  • The skill's "Showing hotkeys" section says what the helpers accept and how each platform shows the four keys. The package README says the same in brief.

Release impact

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

Patch-side SDK display only. A patch that passes a misspelt literal to formatHotkey or hotkeyKeys fails typecheck after patchy refresh, which is the point; a string variable is still accepted.

  • What does a revert leave behind? Nothing: no schema, data or contract. Patches already built keep the SDK they bundled.
  • 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.

@github-actions github-actions Bot added area:server Touches the server area area:cli Touches the cli area area:docs Touches the docs area size:s Under 100 changed lines labels Nov 1, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol, xhigh) on ec6593d: approve, no findings.

  • Accepted: both helpers accept valid chords, sequences, ordered modifier-only combinations and runtime strings.
  • Refused: invalid literals get actionable errors, and the skill and README match that contract.
  • Platforms: runtime checks cover Windows, Linux and Mac.
  • Tests: the new formatting and type expectations fail on the base.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked ec6593d2f28868ee36302b58501df48e71818ef5 (base 1f187a92b2c20da81e8a1d647ea28a60a075d6ef) on team (the shot on main's SDK on brightline), by Claude Opus 5.5 in Claude Code, through T3 Code.

Done means

  • Off a Mac, Delete, Backspace, Enter and Space show as words, a Mac keeps its symbols, and runtime tests cover each platform: passed. In a team environment at the head, Ada's CLI published a tier 1 patch that calls formatHotkey and hotkeyKeys, including on useHotkeyList rows. Ben opened it with the browser reporting Linux, Windows and a Mac (user agent and navigator.platform, which TanStack's detectPlatform reads). The patch showed:

    Linux Windows Mac
    formatHotkey("Mod+Enter") Ctrl+Enter Ctrl+Enter ⌘ ↵
    formatHotkey("Shift+Backspace") Shift+Backspace Shift+Backspace ⇧ ⌫
    formatHotkey("Delete") Delete Delete ⌦
    formatHotkey("Space") Space Space ␣
    formatHotkey("Mod"), a hint Ctrl scroll to zoom Ctrl scroll to zoom ⌘ scroll to zoom
    hotkeyKeys on the "Delete everything" row (Mod+Alt+Shift+Delete) Ctrl Alt Shift Delete Ctrl Alt Shift Delete ⌥ ⇧ ⌘ ⌦

    Other keys are unchanged off a Mac (Alt+↑, Esc, ⇥, Ctrl+/), and none of the three loads had a browser error. Published with main's SDK, the same patch shows Ctrl+↵, Shift+⌫, ⌦ and ␣ on Windows. The PR's runtime test fails over main's hotkeys.ts (expected 'Ctrl+↵' to be 'Ctrl+Enter') and passes at the head, 5 of 5.

    Windows, main's SDK Windows, this head Mac, this head
    Windows on main Windows Mac
  • A misspelt key fails typecheck, while modifier-only labels and every valid hotkey still typecheck: passed. In the published patch's own repo, pnpm typecheck refuses formatHotkey("Mod+Entr") and hotkeyKeys("Ctrl+K") with the two TS2345 messages the PR quotes, while formatHotkey("Mod+Shift") beside them passes, and so does the page itself ("Mod", "Mod+Shift", "G H", useHotkeyList rows). Beyond the PR's cases, "Shift+Mod", "Ctrl", "Mod+", "" and the union "Mod+K" | "Mod+Entr" are refused. A string variable, a union of valid literals, Chord values and point-free rows.map(formatHotkey) are accepted. Over main's hotkeys.ts, the PR's typecheck test reports no errors.

  • The skill states what they accept: passed. The patchy-hotkeys skill that patchy init installed from this head's release has both new lines under "Showing hotkeys", and the package README says the same.

Golden journeys

  • Publish a page (team, Ada and Ben): passed, as part of the setup above. Ada's environment CLI built and published the patch with the head's release, and Ben opened it at its address (200). The change is patch-side SDK display only, so it can't reach the other journeys.

Rollback answers: they match the diff. Nothing is stored. Published patches keep the SDK they bundled, and a repo refreshed back to the older SDK goes back to string parameters, which accept everything the new types accept. No one-way label is needed.

Not run

  • Real macOS and Windows machines: the platforms were emulated in Chromium, as described above.

Notes

  • A hotkey written as a template string, such as formatHotkey(`Mod+${n}`), now fails typecheck with "'Mod+${number}' isn't a chord", where it compiled before. useHotkey refuses the same string, and the skill's Chord advice fixes both. But the skill's new line, "A string that isn't a literal, such as a useHotkeyList row's hotkey, isn't checked", reads as if a template string were let through.
  • Tab still shows ⇥ off a Mac. That's outside Done means, which names four keys. I mention it in case words were meant for Tab too.
  • CI is green on the head.

@allisonmahmood
allisonmahmood force-pushed the hotkeys/format-words-1160 branch from f5b9c73 to e896b12 Compare November 4, 2026 02:31
@allisonmahmood
allisonmahmood merged commit a225331 into main Nov 4, 2026
24 checks passed
@allisonmahmood
allisonmahmood deleted the hotkeys/format-words-1160 branch November 4, 2026 02:43
allisonmahmood added a commit that referenced this pull request Nov 4, 2026
…1182)

## What changed

Agents moving patches onto `patchy/hotkeys` read the compiled bundle to
answer questions the skill should answer: what counts as a text field,
whether an extra modifier still matches, where propagation stops, why
Ctrl+K reaches the address bar with a dialog open, why a native
`<dialog>` stops closing on Escape, and how to type a table of bindings.
The `patchy-hotkeys` skill now answers each of these, the package README
mirrors the parts it covers, and the Preact skill's imports name
`patchy/hotkeys`.

Closes #1161

Stacked on #1177 (#1160), which also edits the skill's "Showing hotkeys"
section.

## Look at

Each item in the issue, and where it now lives. Every claim was checked
against the pinned TanStack 0.19.0 code (`_event-target.js`,
`_match.js`, `hotkey-manager.js`, `_registration.js`):

| Issue item | Skill | README |
|---|---|---|
| Fields | When it fires: a text `<input>` or `<textarea>` that isn't
read-only, `<select>`, contenteditable, `role="textbox"` /
`role="searchbox"` | points to the skill |
| Strict modifiers | Writing a hotkey: an extra modifier stops a match;
a symbol's own Shift (`"?"`) isn't extra | "match exactly, so `"J"`
doesn't fire on Shift+J" |
| Propagation | When it fires: bubble-phase listener on the document;
`window` never sees a fired key; earlier listeners and other document
listeners do; a field that stops propagation hides the key from every
hotkey | points to the skill |
| Held keys reach the browser | Dialogs and scopes: a held hotkey
doesn't block its keys (Ctrl+K reaches the address bar); one registered
inside the scope does | "A held hotkey doesn't block its keys" |
| Native `<dialog>` | Dialogs and scopes › Native `<dialog>`: a live
Escape hotkey prevents `cancel`; wrap the dialog in a `HotkeyScope` and
close one way, from `onCancel` with no Escape inside, as `HotkeySheet`
does, or from an Escape hotkey's `run`; worked example | points to the
skill |
| Tables of bindings | Writing a hotkey: `HotkeyBinding<Chord>[]`, and
`HotkeyBinding<Chord \| "G H" \| "G T">[]` for sequences | same |
| `enabled` and the sheet | When it fires, beside `enabled`: tying it to
a button's state makes the row come and go; check in `run` to keep it
listed | — |
| Preact skill imports | `patchy-preact` › Imports and rendering names
`patchy/hotkeys` and its skill | — |

The table types are the one claim a compiler can hold the skill to, so
the typecheck test now declares a `HotkeyBinding<Chord | "G H">[]` table
and passes it to `useHotkeys`. A table typed `HotkeyBinding<Chord>[]`
with `"G H"` in it is refused with `Type '"G H"' is not assignable to
type 'Chord'`, as the skill says.

## How it was verified

Locally, with CI on this PR as the judge for the full suite:

- `pnpm check`: format, lint, typecheck and synth pass. Its offline
tests failed only in suites this change doesn't touch: stray `GET /`
requests to the CLI's local stub servers and timeouts on a heavily
loaded shared machine.
- Re-run on their own: `SdkApi.test.ts`, which packs and serves the
project skills, `initProject.test.ts`, which reads the Preact skill's
lint block, and `hotkeys.test.ts`, with the new table line. 42 of 42
pass.
- Not run locally: `pnpm verify`, which the machine's load ruled out.
- Not run: a `pnpm dev trial` asking a fresh agent these questions. One
trial run is a smell test, and acceptance is run separately.

## Release impact

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

Docs and one typecheck line. Patches receive the skill text through a
release and `patchy refresh`.

- **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 added a commit that referenced this pull request Nov 4, 2026
…ges publish (#1241)

## What changed

This adds release 36's What's new entry, written from `1acc968`. It
covers everything merged since release 35's `through` (`dd0e2ec`), and
sets the `patchy` release to `0.36.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| Improved: shortcuts work where you use them (keys for one part of a
patch, the closest wins, text boxes keep their typing keys) | #1231 |
| Improved: the shortcuts sheet shows what works where you are (Ctrl+/
and ⌘/ open it, its commands run, it opens from a patch's menu and in
view on a narrow screen, keeps the look, spells keys out away from a
Mac) | #1231, #1181, #1178, #1180, #1177 |
| Fixed: keys pressed while a patch opens reach it | #1183 |
| Fixed: pages styled with Tailwind 4 publish, and a look with the same
rule saves | #1191 |
| Fixed: an old copy of a patch no longer replaces newer work
(**Breaking** for such a copy: it needs `patchy pull` or one
`--allow-behind` publish) | #1179 |
| Improved: your agent can check a publish before sending it | #1188 |
| Improved: your agent hears what changed when it updates a patch |
#1186, #1185 |
| Fixed: your agent stops chasing false alarms (`pnpm install` exit
codes, `manifest.json` bytes, the description notice, a copied dev
record) | #1176, #1174, #1175 |
| Behind the scenes: fuller hotkeys instructions for agents; fewer
redraw costs for patches with many shortcuts | #1182, #1187 |

`patchChanges` has three sentences for the agent refreshing a patch
across this release:
- #1231's, from its PR: text fields keep their keys, `preventDefault()`,
and the sheet's Mod+/ and `.hotkey-row` buttons.
- The sheet's dialog renders in `document.body`, and element-only page
rules don't reach it (#1178, #1180). Its own row lists last (#1181). The
hotkey label helpers take only valid literals (#1177).
- Publish's `unknown_base_version` (#1179).

It also rewords release 33's "Press ? to see every shortcut a patch
has". That was true only for a patch that mounts the shortcuts sheet, so
it now says a patch *can* list its shortcuts.

The rest get no line:
- #1206, #1207, #1209 and #1220 are `pnpm dev eval` tooling.
- #1222 is release 35's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`, and release 33's reworded line.
- **Rollback safety, from the live commit `d28fdd0` (release 35) to
`1acc968`:**
- #1191 is labelled `one-way`. Its Release impact: a company look
published after this release with a nested `@supports` condition stays
stored after a revert. Release 35 refuses any bundle carrying it, so
repo publishes in that company would fail until an admin runs `patchy
look restore` to an earlier revision. Pages and Tailwind 4 repos already
published stay published.
- #1183 is the only change to what the server serves browsers: the
shell's script, under a digest-named URL. Its revert leaves nothing
behind.
- The hotkeys PRs change `patchy/hotkeys`, which patches bundle when
they are built. Published patches keep their copy.
- The CLI PRs change what a CLI writes and refuses. Release 35 reads
everything they leave behind: #1176's `allowBuilds` entry, #1174's
indented `manifest.json`, and the `version` recorded by an
`--allow-behind` publish.

**Rollback line:** If this release misbehaves, roll back to `d28fdd0`
(release 35). First check that no company's look has a nested
`@supports` condition, and `patchy look restore` an earlier revision
where one does (#1191).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (22 tests), and `bun fmt` passes on the changed
files.
- **Facts.** The sheet's new `document.body` home and its element-rule
reset were checked against `hotkeys.ts` and `hotkeySheet.ts` on main.
- **Deploy state.** I pinned the live commit from `/healthz/deep`:
`d28fdd0` (release 35). 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. Like every release, the `0.36.0` bump
tells CLIs and patch repos installed before this deploy to upgrade.

- **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:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

formatHotkey and hotkeyKeys: words for Delete, Backspace, Enter and Space off a Mac, and a checked input

1 participant