Repository navigation
fix(serving): in Firefox, Patchy's shell controls hand focus back to the patch - #1407
Conversation
|
Review (GPT 6.1 Sol), two rounds. Round 1, at 6a44579: nothing blocking.
Round 2, at f13a3fe: nothing blocking.
|
Acceptance: PASS with notesChecked Done means
What
Golden journeys
Rollback answers: they still match the diff. The delta adds no migration, API, CLI or infrastructure change, so no Not run
Notes
|
…the patch Co-Authored-By: Claude Opus 5.5 <[email protected]>
f13a3fe to
7297a58
Compare
… its own process (#1302) ## What changed CI's browser tier ran Playwright's `chrome-headless-shell`, which keeps a patch's sandboxed frame in the shell's process. Desktop Chrome gives it its own process. That's how #1299 shipped: in desktop Chrome a patch didn't hear the keyboard until clicked, while CI was green. #1298 fixed #1299 on `main`. This PR moves the tier 1 suite's `chromium` project to desktop Chromium, so a focus or keyboard bug that only Chrome shows fails CI. It no longer holds anything back: every test in the suite runs in desktop Chromium. #1407's `firefox` project still runs `focus.spec.ts` alone. Closes #1299 ## Look at **`playwright.tier1.config.ts`.** The `chromium` project sets `channel: "chromium"`, the full build in new headless mode, and #1407's `firefox` project sits beside it unchanged. The headless-shell hold-out is gone. #1406 fixed the local-hotkeys test's accessibility helper, which couldn't read an out-of-process frame, and the test now passes in desktop Chromium. `pnpm test:browser` runs `chromium`, as on `main`, so `package.json` doesn't change. **What landed first.** In desktop Chromium on CI, `switcher.spec.ts` failed often (#1402). #1412 fixed that on `main`, with one real desktop-Chrome focus race fixed in the shell's broker and switcher tests that acted too early. One of #1412's tests, the tab switch in `switcher.spec.ts`, skips in the headless shell, which keeps every tab focused. It starts running on CI with this PR. **The frame really is out of process.** CDP's `Target.getTargets` lists it as its own `iframe` target in desktop Chromium, and not in the headless shell. ## How it was verified - **On CI at this head, `a92a7f1`:** the `browser` job passed twice in a row. Each time desktop Chromium passed 180 and Firefox 8, with none failed or skipped. The local-hotkeys test and the tab-switch test ran in desktop Chromium. - **Locally:** the local-hotkeys test passed 3 of 3 in desktop Chromium, and the Firefox project 8 of 8. - **Earlier heads, stacked on #1412 before it merged:** - Five passes in a row at its first head, and two or three at each later one. - One failure was the #1377 flake, since fixed on `main` by #1414. - One `test (bun)` failure was a `Fleet.test.ts` clock-step case, which passed on rerun. - The other failures were gaps in #1412's own fix, each fixed in #1412. - **CI cost.** No new download. `playwright install chromium` without `--only-shell` already puts both Chromium builds in Chromium's cache entry, and the action's comment says why it stays that way. - **Not checked:** headed Chrome on a real display. New headless is the same browser build and runs the frame out of process, as the target count shows. Hit every surface: - **Dev loop docs:** `docs/DEVELOPMENT.md` says the browser job runs desktop Chromium with `focus.spec.ts` also in Firefox, and that a script launching its own browser for a focus check passes the same channel. The CI job's and the Playwright action's comments say the same. - **Doesn't apply:** served pages, the wire contract, the CLI, vocabulary, migrations, company resources, reverse states and the repo layout. ## Release impact Tick exactly one. - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required. Test and CI configuration and doc lines; nothing ships. - **What does a revert leave behind?** Nothing. CI goes back to the headless shell. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
…ey shortcuts (#1421) ## What changed This adds release 42's What's new entry, written from `1cd6d12`. It covers everything merged since release 41's `through` (`a25a9c5`), and sets the `patchy` release to `0.42.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | New: Tell Patchy what it's missing | #1217, #1218, #1219, #1227, #1228 | | New: Turn off single-key shortcuts | #1276, #1279, #1301 | | Fixed: Typing reaches the patch again | #1407, #1412 | | Fixed: Dialogs in patches keep your place | #1420, #1255 | | Behind the scenes: plainer facts for agents building patches | #1249, #1256, #1297, #1418 | | Behind the scenes: Patchy stores teams and audiences ahead of teams | #1416 | | Patch changes: Mod+/ and `client.close()` in patchy/hotkeys; single-key shortcuts can be off; Tab wraps in plain modal dialogs | #1279, #1301, #1420 | #1376 is release 41's own entry. #1400, #1406, #1414, #1415, #1302, #1413 and #1419 are test, CI and dev tooling and need no line. The teams bridge (#1416) ships alone in this release so teams (#1417) can follow in the next one with a release to roll back to that reads its data closed. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `7f93b91` (release 41) to this PR's merge.** No PR in the range is labelled `one-way`, and every Release impact answer says release 41 still works: - **#1217** adds migration `0037_feedback`, a schema release 41 never reads. **#1227** and **#1228** write into it. - **#1276** adds migration `0038_single_key_shortcuts`, a column with a default that release 41 never selects. - **#1416** adds migrations `0039_company_teams` to `0041_connection_audiences`, which hold tables that stay empty until teams ship, and widens one scope check. Its CI rehearsal ran `7f93b91 → head → 7f93b91 → head` on one set of data, and all four steps passed. - **#1279**, **#1301**, **#1255** and **#1420** change the SDK and the shell. Patches built on this release carry a `shortcutSetting` manifest field that release 41 reads without refusing, and its shell names no frame, so every shortcut stays on. - **#1218** and **#1219** add CLI commands and an optional `feedbackHint` in `--json` failures. A CLI from this release refuses to publish to an older instance before sending anything, as any mismatched release does. - Everything else is skill text, docs, tests and CI. If this release misbehaves, roll back to `7f93b91` (release 41). Written by Claude Opus 5.5 in Claude Code, through T3 Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
In Firefox, pressing a button on Patchy's own shell controls with the keyboard left focus on the shell's page, outside the patch. That covers the new-version bar's Not now and Hide, a download card's Download, Not now and Dismiss, the single-key shortcuts dialog's Cancel, and Dismiss on the note an older version shows. The patch's keys and hotkeys then went nowhere until the person clicked. Several of those controls could also pull focus off another shell control the person was on. Now the next key reaches the patch in Firefox, as it already did in Chromium, and focus comes back only from the control itself or from nowhere. CI runs the focus tests in Firefox too, so losing that fix can't pass on Chromium alone.
Closes #1124
Look at
The cause is keyboard activation. Firefox won't hand a frame focus during the key event that pressed a button (Enter presses on keydown, Space on keyup), so the shell's
frame.focus()was dropped and focus stayed onbody. A mouse click already handed focus back. The switcher's close works around the same Firefox behaviour inpackages/core, which this PR leaves alone. On main, where the next key went:With this PR, every cell is "patch". A click on the dialog's backdrop doesn't close it; focus moves onto the dialog, and the next Escape hands it back.
The fix is one helper,
handBackFocusinpackages/serving/src/hand-back-focus.ts, which the bar (stream-status.ts), the cards (downloads.ts), the dialog and the note (shortcuts.ts) all call:body, as after a click on a button that takes no focus).body. If the person moved focus somewhere in between, it stays there.frame.focus()unconditionally after a press. That could pull focus off another shell control, such as another card.The bar's passive redraws, such as a new version arriving, still hand focus back only when it was on the bar. The dialog still leaves focus in a switcher opened over it.
The tests are in
test/browser-tier1/focus.spec.ts. They press every button clicked, with Enter and with Space, then send one ArrowDown that must reach the patch:For the bar, the cards and the note, a last step checks that a press that moves no focus leaves it on the shell control that has it. For the dialog, it checks that a save answering under the switcher leaves focus in the switcher. The dialog is modal, so the switcher is the only place outside it that focus can be.
Red on main's
stream-status.ts,downloads.tsandshortcuts.ts(steps stop at the first failure):Green with this PR, the whole
focus.spec.tsin all four setups:CI now guards the Firefox half. Chromium hands focus back on the first try, so before this, CI stayed green with the second try deleted. Two guards now cover it:
firefoxproject that runsfocus.spec.tsalone, withfission.webContentIsolationStrategy: 1. Thebrowserjob runs it after the Chromium suite (pnpm test:browser:firefox), and so doespnpm verify.frame.focus()miss in any browser. It checks that the second try hands focus back, and that focus moved to another shell control between the two tries stays there. That runs in the Chromium project too.With the second try deleted from
hand-back-focus.ts, both projects go red:With the second try made unconditional, ignoring where the person moved focus:
Each next-key check now first waits for focus to be back on the frame. Chromium runs input ahead of the second try's task, so an immediate key could otherwise arrive first. On main or without the second try, focus never comes back, so those checks still fail.
The
browserjob's time (this branch, the Chromium suite unchanged):browserjob6a44579f13a3feFirefox adds 34 s, its download included on this first run, which also saved it to the cache. The Chromium suite's own time varies from run to run, which is why the total fell.
How it was verified
focus.spec.tspasses in the tier 1 config'schromiumandfirefoxprojects (16 tests). Through a throwaway config kept outside the repo, it also passes in desktop Chromium (channel: "chromium", where the frame has its own process) and in Firefox with Playwright's default isolation.browserinput. Chromium keeps its cache key and path, so the other jobs' caches stay warm, and Firefox gets an entry holding onlyfirefox-*.docs/DEVELOPMENT.mdsays which spec runs in Firefox and why. It and the README install Firefox beside Chromium, sincepnpm verifynow needs it.package.jsonand the docs cleanly. It conflicts only insideprojects: [...]inplaywright.tier1.config.ts, where the fix is to keep its two Chromium projects and add thefirefoxentry.shortcut-setting.spec.tspasses in all four setups, 54 passed and 2 skipped (the tier 2 case skips outside Chromium). Those tests pin the dialog's abuse contract: one dialog at a time, and a fresh press after any close.downloads.spec.tsand the bar'sstream.spec.tstests pass in Chromium.pnpm format:check,pnpm lintandpnpm typecheckpass.patchy-hotkeysskill now names Hide beside Not now. Its line, "A download card's buttons and the new-version bar's Not now and Hide hand focus back themselves", reads true. Patch code has nothing to do about the dialog, whose closing the page's sheet already follows.Release impact
Tick exactly one.
Breaking — requires action from anyone already running this
Not breaking — no action required. The shell's own script and one project skill line change, with no API, schema or CLI change.
What does a revert leave behind? Nothing. The shell script and the skill are served with each release.
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.