Skip to content

test(browser): the local-hotkeys check reads an isolated patch frame's accessibility tree - #1406

Merged
allisonmahmood merged 1 commit into
mainfrom
t3/2eda6057
Nov 12, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
t3/2eda6057

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

What changed

The tier 1 browser test "local hotkeys: the narrowest place wins" failed in desktop Chromium. Its statuses() helper looked for the patch's frame in the page's frame tree, but desktop Chromium runs the sandboxed patch frame in its own process, so that frame isn't in the page's tree and the helper threw TypeError: Cannot read properties of undefined (reading 'frame'). Main is green only because CI still runs chrome-headless-shell, where the frame shares the page's process.

The helper now opens a CDP session on the patch frame itself (context.newCDPSession(frame)). That works when the frame has its own target, as in desktop Chromium. In the headless shell Playwright refuses a separate session for an in-process frame, so the helper falls back to the page's session as before. Either way it finds the /~content/ frame in that session's frame tree and reads that frame's accessibility tree with Accessibility.getFullAXTree, so the assertions are unchanged.

Once this lands, #1302 can drop its headlessShellOnly hold-out and the headless-shell project that runs it.

Closes #1306

Look at

The one changed line in test/browser-tier1/hotkeys.spec.ts, inside statuses():

const session = await context.newCDPSession(frame).catch(() => context.newCDPSession(page));

To check that each browser takes the path I expected, I ran once with a temporary log, since removed. Each of the three statuses() calls used the frame's own session in desktop Chromium and the page's session in the headless shell.

How it was verified

For desktop Chromium I used a throwaway config outside the repo. It imports playwright.tier1.config.ts and sets channel: "chromium" on its project, and isn't committed. The headless shell runs through the repo's config unchanged.

Before, desktop Chromium: red

✘ [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: the narrowest place wins, ... › over a native modal dialog, the command's announcement is in the accessibility tree

  TypeError: Cannot read properties of undefined (reading 'frame')

    > 1061 |       frameId: content(frameTree)!.frame.id
  1 failed

After, desktop Chromium: green

✓ [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: the narrowest place wins, fields keep their keys, handled keys stand down, and the sheet runs a dialog's commands (2.5s)
  1 passed (10.0s)

After, headless shell (playwright.tier1.config.ts): green

✓ [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: the narrowest place wins, fields keep their keys, handled keys stand down, and the sheet runs a dialog's commands (2.6s)
  1 passed (8.5s)

pnpm typecheck:tests, pnpm lint and bun fmt --check pass. Locally I ran only this test. CI's browser job runs the rest of the tier.

Release impact

Tick exactly one.

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

Only a test helper changed, and no product code.

  • What does a revert leave behind? Nothing. The helper goes back to failing in desktop Chromium.
  • Does the release before it still work with that? Yes. Nothing that ships changed.

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

@github-actions github-actions Bot added area:ci CI, shared testing infrastructure, development scripts and tooling size:s Under 100 changed lines labels Nov 11, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 5a830db645862d44bd203c9d53ba7fe42b465505 (base b9dc456b243559fe5c49e3e758d8cf46167141eb) on the tier 1 harness's own throwaway instance (no scenario), by Claude Opus 5.5 in Claude Code, through T3 Code. Only the one test ran, never the whole tier: -g "local hotkeys: the narrowest place wins", Playwright 1.63.0, Chromium build 1243.

Done means

The test still checks something: passed. I made one temporary, uncommitted change to packages/patchy/src/hotkeys.ts: the announcer now portals to document.body instead of into the open modal dialog. The announcement stays in the DOM, so the earlier toHaveText steps still pass, but the modal makes it inert. With that change the test goes red in both browsers at expect.poll(statuses).toEqual(["Star"]), receiving []. After reverting the change and rebuilding, both browsers are green again.

Golden journeys: none touched. The diff changes 3 lines in one test file and no product code.

Rollback answers: they match the diff. A revert leaves nothing behind except the helper failing again in desktop Chromium. "Not breaking" is right, and no one-way label is needed.

Not run

  • The rest of the tier 1 browser suite: out of scope for this check. CI's browser job covers it.

Notes

Desktop Chromium config (throwaway, outside the repo, not committed)
// Throwaway: the tier 1 config with desktop Chromium (channel "chromium") instead of the headless shell.
import base from "<worktree>/playwright.tier1.config.ts";

const root = "<worktree>";
export default {
  ...base,
  testDir: `${root}/test/browser-tier1`,
  globalSetup: `${root}/test/browser-tier1/setup.ts`,
  outputDir: `${root}/.local/tier1-results-desktop`,
  projects: (base.projects ?? []).map((project) => ({
    ...project,
    use: { ...project.use, channel: "chromium" }
  }))
};
1. Head, both browsers: green

The headless shell, through the repo's config unchanged. DEBUG=pw:browser shows which binary started:

$ PATCHY_TIER1_SKIP_BUILD=1 DEBUG=pw:browser pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium test/browser-tier1/hotkeys.spec.ts -g "local hotkeys: the narrowest place wins"
pw:browser ... ms-playwright/chromium_headless_shell-1243/chrome-headless-shell-linux64/chrome-headless-shell
  ✓  1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: the narrowest place wins, fields keep their keys, handled keys stand down, and the sheet runs a dialog's commands (2.8s)
  1 passed (9.2s)

Desktop Chromium:

$ PATCHY_TIER1_SKIP_BUILD=1 DEBUG=pw:browser pnpm exec playwright test -c <tmp>/desktop.config.ts test/browser-tier1/hotkeys.spec.ts -g "local hotkeys: the narrowest place wins"
pw:browser ... ms-playwright/chromium-1243/chrome-linux64/chrome
  ✓  1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: the narrowest place wins, fields keep their keys, handled keys stand down, and the sheet runs a dialog's commands (1.8s)
  1 passed (6.0s)

The first run at the head, in the headless shell, included the global setup's build and also passed (1 passed (39.1s)).

2. Main, desktop Chromium: red at the native-modal-dialog step

git diff --stat b9dc456b 5a830db6 changes only test/browser-tier1/hotkeys.spec.ts, so the build is the same on both sides.

$ git checkout --detach b9dc456b243559fe5c49e3e758d8cf46167141eb
$ PATCHY_TIER1_SKIP_BUILD=1 pnpm exec playwright test -c <tmp>/desktop.config.ts test/browser-tier1/hotkeys.spec.ts -g "local hotkeys: the narrowest place wins"
  ✘  1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: ... (2.1s)

  1) [chromium] › ... › over a native modal dialog, the command's announcement is in the accessibility tree

    TypeError: Cannot read properties of undefined (reading 'frame')

      1060 |     const { nodes } = (await session.send("Accessibility.getFullAXTree", {
    > 1061 |       frameId: content(frameTree)!.frame.id
           |                                  ^
  1 failed
3. Head with the announcer broken: red in both browsers, then green after reverting
--- a/packages/patchy/src/hotkeys.ts
+++ b/packages/patchy/src/hotkeys.ts
@@ -1048,7 +1048,7 @@ export function HotkeySheet<const S extends string = "?">(props: HotkeySheetProp
         { class: "hotkey-announce", role: "status", "aria-live": "polite" },
         said && createElement("span", { key: said.count }, said.label)
       ),
-      home
+      document.body
     ),

The headless shell, with the global setup rebuilding packages/patchy:

$ pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium test/browser-tier1/hotkeys.spec.ts -g "local hotkeys: the narrowest place wins"
  ✘  1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: ... (15.5s)

  1) [chromium] › ... › over a native modal dialog, the command's announcement is in the accessibility tree

    Error: expect(received).toEqual(expected) // deep equality
    - Array [
    -   "Star",
    - ]
    + Array []
    - Timeout 15000ms exceeded while waiting on the predicate

    > 1424 |     await expect.poll(statuses).toEqual(["Star"]);
  1 failed

Desktop Chromium:

$ PATCHY_TIER1_SKIP_BUILD=1 pnpm exec playwright test -c <tmp>/desktop.config.ts test/browser-tier1/hotkeys.spec.ts -g "local hotkeys: the narrowest place wins"
  1) [chromium] › ... › over a native modal dialog, the command's announcement is in the accessibility tree

    Error: expect(received).toEqual(expected) // deep equality
    - Array [
    -   "Star",
    - ]
    + Array []
    - Timeout 15000ms exceeded while waiting on the predicate

    > 1424 |     await expect.poll(statuses).toEqual(["Star"]);
  ✘  1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: ... (17.0s)
  1 failed

I reverted with git checkout -- packages/patchy/src/hotkeys.ts, after which git status --short printed nothing. I then rebuilt and reran:

headless shell:  ✓  1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: ... (1.7s)   1 passed (30.4s)
desktop:         ✓  1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1025:1 › local hotkeys: ... (1.8s)   1 passed (6.5s)

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol): nothing blocking. It checked Playwright 1.63.0's source and ran both paths. newCDPSession(frame) attaches to an out-of-process frame's own target and is refused for an in-process one, so desktop Chromium takes the frame session and the headless shell falls back. The fallback has no false-pass path: an out-of-process frame is missing from the page's tree, so the lookup still fails, and the tree and accessibility errors that follow aren't caught. The frame and frameId selection are right.

One nit, dismissed: "which has no session for it" means no separate session for the frame. The review found that clear enough in context, and it isn't worth another CI round.

@allisonmahmood
allisonmahmood merged commit 5c76c5f into main Nov 12, 2026
26 checks passed
@allisonmahmood
allisonmahmood deleted the t3/2eda6057 branch November 12, 2026 17:47
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
… 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]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
…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]>
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 size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(browser): the local-hotkeys accessibility check can't find an isolated patch frame

1 participant