fix(cache): replay a control that leads its row in that row, not by its place
JA
2d ago+201+201+012345678901234567890123456789-25-25-01234567890123456789
What and why
- A control that shares its name with other rows' controls and is the first text in its row (an
Archivebutton in a table's first column) was recorded astap button "Archive" (2 of 5). The row's first text was the button's own name, socontainerKeykeyed nothing, and a replay on a list of the same length in another order pressed another row's button. A glyph button (<button aria-label="Archive">×</button>) did the same within "×" (2 of 5). containerKeytakespastOwnand then reads the row's first text outside the control. The recorder uses that key only when the control has twins and the text tells it from all of them. Relocation accepts either key.- No
REPLAY_POLICY_VERSIONbump, as in #998: entries recorded on main match the same nodes as before. The cost is that an entry already recorded by place replays by place until the step is recorded again. I can bump it if you would rather cold-start. - The row's next text can be data (
Archive | $500 | Acme). The key is then$500, and a changed price hands off where main replayed by place. I did not skip volatile text, sincecontainerKeymatches no patterns today. - Still by place, as on main: rows whose next text is the same in every row (
[Archive] [Edit] Acme, a status column).
Issue
Fixes #2052
Verified
Ran it locally: yes
Real CLI and Chromium, the repro from the issue (sh run.sh, a scripted executor, no model): five rows a page, one new record on top before the second run.
| second run | main (0.24.0 and 0.25.0-nightly-20261121030204) | this branch |
|---|---|---|
| recorded | tap button "Suspend" (2 of 5) | tap button "Suspend" in "Acme Corp" |
| cache | 1 replayed · 1 handed off | 2 replayed |
| invoices archived | Globex, then Acme Corp | Acme Corp |
| account suspended | Globex, and the test passes | Acme Corp |
--strict-cache: main fails the archive test withREPLAY_STALEafter archiving Globex and still passes the suspend test on Globex. The branch replays both on Acme Corp.- The new tests:
5 failed | 27 passedon main's sources,32 passedhere. - main against this branch over 20,000 generated lists, recorded and then replayed after a reorder, a new row, a removed row, or changed data: 2,858 wrong-row replays become right, 1,050 become hand-offs, and no hand-off becomes a wrong row. 175 right replays become hand-offs and 2 land on a wrong row, all keyed by row data that changed. Entries recorded on main relocate to the same node in all 296,229 cases.
- Web benchmark recordings,
CI=1,test:agent --strict-cache, no model key:26 replayed · 3 handed off · 6 missedon main and here, every step the same. The 8 tests that call the model fail on both. - Not run: the mobile benchmark recordings (no emulator),
bench:aband a recording made by a real model (no key). A target that is itself a row or group, as many mobile targets are, takes the old path.
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.