Skip to content

test(browser): the shortcuts sheet's ask is waited for, not read once - #1415

Merged
allisonmahmood merged 1 commit into
mainfrom
test/hotkeys-sheet-ask-poll
Nov 12, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
test/hotkeys-sheet-ask-poll

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

What changed

A tier 1 test of the shortcuts sheet failed on CI now and then: "the sheet's row asks Patchy, waits past the reply deadline, then comes back on its row with the answer", in test/browser-tier1/hotkeys.spec.ts. It failed on #1412's browser job, which doesn't touch the sheet or its stand-in shell:

Expected: [{ "args": {}, "op": "shortcuts.setting" }]
Received: []
> 1673 |   expect((await stubbed(page)).asked).toEqual([{ op: "shortcuts.setting", args: {} }]);

The sheet asks over a MessagePort, so the stand-in shell records the ask when the message arrives. That can be after the sheet has hidden. The test read the stand-in's list once, straight after toBeHidden(). Now it polls the list until the ask is there.

No issue was filed for it. It's a test-only fix.

Look at

The change at hotkeys.spec.ts:1673. The assertion is the same; it now waits for the message instead of racing it.

How it was verified

Locally, in the repo's config (headless shell), running only this test:

main, --repeat-each=20 --max-failures=0     3 failed, 17 passed   (all three at line 1673)
this branch, --repeat-each=20 --max-failures=0   20 passed

oxlint and bun fmt --check are clean on the file. CI runs the rest.

Hit every surface: none apply. It's a test-only change.

Release impact

Tick exactly one.

  • Breaking — requires action from anyone already running this

  • Not breaking — no action required. Test only.

  • What does a revert leave behind? Nothing; the test goes back to racing the message.

  • 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:ci CI, shared testing infrastructure, development scripts and tooling size:s Under 100 changed lines labels Nov 12, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 18f6fbc91f91adeba2d69b2d1c03049a14c4c51b (base b9dc456b243559fe5c49e3e758d8cf46167141eb) on the tier 1 Playwright harness's own isolated instance (no scenario), by Claude Opus 5.5 in Claude Code.

No issue closes this PR, so the claim checked is its What changed: the test used to race the stand-in shell's record of the ask, and now waits for it, with the same assertion.

Done means

  • The test no longer races the ask, in the repo's config (headless shell): passed. Main failed 9 of 20, every failure at line 1673 with Received: []. The head passed 20 of 20.
  • It still asserts the same thing: passed. The poll compares the whole asked array with toEqual, as the old read did. Details are in Review below.
  • Desktop Chromium: passed. The head passed 20 of 20. Main also passed 20 of 20 there, so the race shows up in the headless shell, which is what CI runs.
Failure rate, the repo's config (headless shell), only this test
# main (b9dc456b), which differs from the head only in this spec, so the head's build is reused
PATCHY_TIER1_SKIP_BUILD=1 pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium \
  test/browser-tier1/hotkeys.spec.ts -g "the sheet's row asks Patchy" --repeat-each=20 --max-failures=0
  ✓   1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (271ms)
  ✘   2 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (283ms)
  ✘   3 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (281ms)
  ✘   4 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (328ms)
  ...
  ✘  19 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (349ms)
  ✓  20 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (360ms)
  9 failed
  11 passed (1.4m)

    Error: expect(received).toEqual(expected) // deep equality
    - Expected  - 6
    + Received  + 1
    > 1673 |   expect((await stubbed(page)).asked).toEqual([{ op: "shortcuts.setting", args: {} }]);

All 9 failures are at line 1673. The machine was under load from other suites, which likely explains why this rate is higher than the PR's 3 of 20.

# head (18f6fbc9), global setup builds the server
pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium \
  test/browser-tier1/hotkeys.spec.ts -g "the sheet's row asks Patchy" --repeat-each=20 --max-failures=0
Running 20 tests using 1 worker
  ✓   1 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 › the sheet's row asks Patchy, … (2.0s)
  ...
  ✓  20 [chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 › the sheet's row asks Patchy, … (477ms)
  20 passed (5.5m)
Desktop Chromium, through a throwaway config outside the worktree, never committed

channel: "chromium" runs the full Chromium build in its new headless mode, not the headless shell:

// <tmp>/desktop.config.mjs, beside a package.json of {"type":"module"}
import { defineConfig, devices } from "<worktree>/node_modules/@playwright/test/index.mjs";
import base from "<worktree>/playwright.tier1.config.ts";
export default defineConfig({
  ...base,
  testDir: "<worktree>/test/browser-tier1",
  globalSetup: "<worktree>/test/browser-tier1/setup.ts",
  outputDir: "<tmp>/results",
  projects: [{ name: "desktop-chromium", use: { ...devices["Desktop Chrome"], channel: "chromium" } }]
});
PATCHY_TIER1_SKIP_BUILD=1 pnpm exec playwright test -c <tmp>/desktop.config.mjs hotkeys.spec.ts \
  -g "the sheet's row asks Patchy" --repeat-each=20 --max-failures=0
head:  ✓   1 [desktop-chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (752ms)
       ...
       ✓  20 [desktop-chromium] › test/browser-tier1/hotkeys.spec.ts:1657:1 (463ms)
       20 passed (1.5m)
main:  20 passed (1.4m)

Review

  • Does the poll prove exactly one shortcuts.setting ask with {}? Yes. expect.poll(...).toEqual([...]) compares the whole array, so it passes only while the list holds that one entry, with that op and those args. If a duplicate or wrong ask lands before the first matching read, the list never matches and the poll fails at the 15 s expect timeout. Each click sends one ask: the sheet's ask() calls askShell(), which calls transport.call synchronously. The transport never retries this op (clientTransport.ts:290).
  • Could it pass with a wrong second ask arriving later? Yes, but main has the same gap, so the PR doesn't weaken anything. An ask that lands after the passing read goes unseen, because nothing reads asked again. Messages on a MessagePort stay in order, but each one is its own task in the stand-in shell. The page's evaluate can run between two of them, so a duplicate from the same click could also slip by. See the first note.
  • Fake clock. No bad interaction. page.clock.install() without pauseAt() leaves page time flowing at the real rate: Playwright's _replayLogOnce ends in _innerResume(). So the poll's real-time wait does move the page's clock, but by 15 s at most. That can't change the outcome:
    • shortcuts.setting has no reply timer (clientTransport.ts:290, "A shell-local offer or question waits for the person").
    • The stand-in's answer timer is 40 s.
    • The fastForward("00:40") that follows passes that 40 s answer on its own.
    • The poll's own intervals run on Node's real timers.
    • Port messages are tasks, not timers.
  • Other one-shot reads of stubbed(page) in this file: none. Line 1673 was the only one. The other four reads (lines 1579, 1648, 1664, 1695) already poll ready. The one-shot sheetRows(frame) reads after the sheet reappears read the frame's own DOM after a locator wait (toBeFocused, toBeVisible), so they don't cross the port. firedNext already polls.
  • oxlint and bun fmt --check are clean on the file.

Golden journeys: none touched. This is a test-only change.

Rollback answers: they match the diff. A revert leaves nothing behind but the race, and no one-way label is needed.

CI: every required check passed on 18f6fbc9, including browser. imap-live and attio-live were skipped, as they are for unrelated changes.

Not run

  • The rest of hotkeys.spec.ts and the browser suite, locally. This run was limited to the one test on a shared machine. CI's browser job ran them green on the head.

Notes

  • Optional, not a regression: to catch a stray extra ask, assert asked once more at the end of the test, after Escape and a. By then any ask from the click has long since landed.
  • Desktop Chromium didn't reproduce the race on main (20 of 20 passed), so it shows up in the headless shell. The fix holds in both.
  • The local failure rate on main was 9 of 20 against the PR's 3 of 20. The machine was busy with other suites, which widens the gap between the sheet hiding and the message landing.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

The acceptance note's optional suggestion was to check the ask list once more at the end, to catch a late duplicate. I'm leaving it out. Main has the same gap, one click sends exactly one ask, and the SDK never retries it, so it would guard a path the code doesn't have.

@allisonmahmood
allisonmahmood force-pushed the test/hotkeys-sheet-ask-poll branch from 18f6fbc to a577e25 Compare November 12, 2026 17:10
@allisonmahmood
allisonmahmood merged commit e1f32ca into main Nov 12, 2026
26 checks passed
@allisonmahmood
allisonmahmood deleted the test/hotkeys-sheet-ask-poll branch November 12, 2026 17:21
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.

1 participant