Repository navigation
fix(cache): replay a control that leads its row in that row, not by its place - #2053
JaynouOliver wants to merge 6 commits into
Conversation
…ts place A same-named control that is the first text in its row was recorded by its place among its twins, because the row's first text was its own name. A replay on a list of the same length in another order then acted on another row. Key such a control by the row's first text outside it, when that text tells it from its twins.
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/core/src/cache/relocate.ts">
<violation number="1" location="packages/core/src/cache/relocate.ts:274">
P2: This fallback changes matching for legacy `within` entries too: a candidate whose ordinary key differs can now match through `pastOwn`, so an old trace may replay where it previously handed off. Gate the fallback on an explicit new key mode, or otherwise version the matching behavior to preserve the stated compatibility.</violation>
</file>
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
… recorded that way Relocation accepted either key for every entry, so an entry recorded before this change could match a control that leads its row and replay where it used to hand off. A leading control's entry now carries `leads`, and only such an entry reads a candidate's key past the candidate. Entries without it match as on main.
There was a problem hiding this comment.
All reported issues were addressed across 9 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Reviewed at 078eb7a (main 7e32054, mergeable_state clean, CI green). Read #2052 and the gist flow.
The fix is in the right place. containerKey already keys a repeated control by its row's first text. A control that leads its row made that key its own name (or glyph), so nothing was keyed and the replay went by order. Reading past the control fixes the key inside the existing model. It is not a new rung or a text heuristic, and descriptorTiers is untouched. The leads mark keeps the new reading away from entries recorded on main:
- unmarked entries go through
candidatesWithin(..., false), the same filter as main, so cached keys do not change and nothing cold-starts - for a non-leading control
pastOwnreturns the same key, so recordings of every other control are byte-identical - the uniqueness check (
describePosition(node, outside, nodes, true) === undefined) keeps twins with the same next text (Hold | One day) on the old by-place path
Must fix
- none
Should fix
packages/core/src/cache/trace.ts:140(cubic P3, real): theleadsdoc says it is set whenever the target is its container's first text. The recorder sets it only when the control has twins and the outside text tells it from all of them. Take cubic's suggested wording.
Nits
- Positional booleans at the call sites (
containerKey(id, nodes, parents, true),describePosition(node, outside, nodes, true)) do not say whattruemeans. A named const or an options object would. - The changeset is long and describes internals ("carries a mark"). Something like this is enough: "A repeated control that is the first text in its row (an
Archivebutton in a table's first column) is now recorded with its row instead of its place among its twins, so a reordered list no longer replays it on another row. Entries already recorded by place keep replaying by place until the step is recorded again."
cubic's P2 on 4e1fd9a (the either-key fallback could match legacy entries by the new key) was real, and 078eb7a fixes it by gating on leads.
Verified
tests/unit/relocate-within.test.ts11/11 andtests/integration/trace-cache-replay.test.ts22/22 (real Chromium; the replay renders the offers reversed). oxlint is clean on the touched dirs, andtsc --noEmitpasses for core and e2e.- Mutants, each caught:
- dispatcher leads branch disabled: 3 integration tests fail
- relocation ignores
leads: 2 unit + 2 integration fail pastOwnskip removed: 2 unit fail- container-role guard on the skip removed: 1 unit fails ("row that is itself the target")
- uniqueness check removed: 2 integration fail
trace-readdropsleads: 2 integration fail
- One mutant survived:
leadsignored indescribePosition's by-place branch. It is equivalent, since anonymous controls always get a position on that branch and never reach the leads path. - Checked that
leadssurvives the trace text mapping and redaction (spread),sameTarget, andreadDescriptor(rejected withoutwithin). An older runner reading a marked entry dropsleads, finds no key match and hands off, so it never acts on the wrong row.
…is set Review follow-up: containerKey and describePosition take named options instead of a bare true, the leads doc states the recorder's condition, and the changeset covers only what a user sees.
There was a problem hiding this comment.
0 issues found across 6 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at b9521ee (main 6fdb1c2, mergeable_state clean, CI green). The new commit only does what the last review asked: no behavior change, every earlier ask is done.
trace.ts:140: theleadsdoc now says it is set only for a leading control with same-named twins when the row's outside text tells it from all of them. That matches the recorder inaction-dispatcher.ts:905-909and closes cubic's P3.- The positional booleans are now named options (
containerKey(..., { pastOwn }),describePosition(..., { leads })). Every call site in core and the tests was updated, and the defaults are unchanged, so callers that pass nothing behave as before. - The changeset is now the short, user-facing version.
Must fix
- none
Should fix
- none
cubic: no open findings. Both earlier threads (P2 relocate.ts fallback, P3 trace.ts doc) are fixed and resolved, and cubic reports 0 issues on b9521ee.
Verified
relocate-within,relocate-position,relocate-anonymousandrelocate-minted-test-idunit tests pass (35/35).tests/integration/trace-cache-replay.test.tspasses 22/22 on real Chromium.tsc --noEmitpasses for core and e2e, and oxlint is clean on the touched dirs.- Mutant:
containerKeyignores thepastOwnoption, and 2 unit tests fail. Mutant:describePositionignoresleads, and it survives. That one is equivalent, same as noted last round.
michal-e2e
left a comment
There was a problem hiding this comment.
Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.
Reviewed at b9521eeef (merge base c30354ff8, main).
The fix is in the right place and works for the issue's case. One changeset sentence promises more than the code gives. Two calls about existing recordings are the maintainer's.
Must fix
- Your changeset says "A repeated control that is the first thing in its row, list item, or card ... is now recorded by its row, so a replay on a reordered list no longer acts on another row." That holds only when the text after the control tells the row apart. Your own new flow records the second
Holdby place (position: { index: 1, of: 2 }), and[Archive] [Edit] Acmerows stay by place too, so a reorder can still hit another row there. A user reading the release note would stop guarding against it. Please narrow it, for example: "A repeated control that is the first thing in its row (anArchivebutton in a table's first column) is now recorded by the row's next text when that text tells the rows apart, so a reordered list no longer replays it on another row. Rows the next text does not tell apart are still replayed by place, and entries already recorded by place keep replaying by place until the step is recorded again.".changeset/replay-leading-control-row.md:5
Optional
- Can we add the issue's glyph button (
<button aria-label="Reserve now">×</button>) to the?lead=1rows and assert its recorded target? The recorder replaces a definedwithin("×") with the outside key, and no test reaches that through the recorder. I changed the condition towithin === undefined, so a glyph keepsin "×" (n of m), and thepackages/e2eunit suite andtrace-cache-replay.test.tsstill passed.action-dispatcher.ts:907 - Can we add a reader test for a malformed
leads? Acceptingleadswithoutwithin, orleads: false, also passed the same tests. A case in the trace-read tests with{ leads: true }and nowithin, and one withleads: 1, should both read as an invalid entry.trace-read.ts:385 - Your PR description says "Relocation accepts either key." That was true before
078eb7a. Now relocation reads one key per entry: past the control when the entry hasleads, the row's first text otherwise, which your test "matches an entry recorded without the mark by the row's first text only, as before" pins. Please update the sentence, since the description is what we read later to learn why the code is this way.
Nit
- The doc block that describes
renderRepeats(including the new?lead=1paragraph) now sits onconst LEAD_ROWS.forms.ts:56
Verified
-
The issue's case is fixed. On a clean merge-base build (
c30354ff8) your new tests fail where they should: the leading-row recording (expected [ …(3) ] to deeply equal [ …(3) ]), the name key (expected undefined to be 'Acme') and the glyph key (expected '×' to be 'Acme'). The other three new tests pass on the merge base by design, since they guard behavior you kept. Atb9521eeef,tests/unit/relocate-*andtests/integration/trace-cache-replay.test.tspass, 60 of 60, on real Chromium. -
Older entries: a descriptor without
leadsrelocates the same on the merge base and this head, and a by-place glyph entry (in "×" (2 of 3)) still finds the same button. -
Suites at
b9521eeef, run here:pnpm check, the testbed and the web benchmark passed.pnpm testpassed except one desktop test, "quits the process carrying the launch token of a launch the app list never showed", which failed the same way on a rerun at this head and on the merge base, with this machine under heavy load from other runs. It is not this PR's, and the load may explain it. The web agent suite from its committed recordings with--strict-cacheand no model key gave26 passed, 8 failedand26 replayed · 3 handed off · 4 missedon both the merge base and this head, with the same outcome per test and step. The 8 failures are steps with no recording that call the model (Unauthenticated request to AI Gateway). None failed withREPLAY_STALE. -
New tests: 6 added, 6 fail under at least one mutant. "replays an entry recorded by the glyph and a place as it did before" needed a targeted one (relocation always reading past the control).
-
Mutation testing: 18 places this PR adds or changes a branch, 19 mutants, 13 killed by a failing assertion, run with each mutant applied to
b9521eeef. Survivors, each also run against the wholepackages/e2eunit suite:- the glyph path and the reader checks above;
sameTargetignoringleads(it only decides whether two recorded scrolls merge);- dropping
outside !== within, anddescribePositionignoringleadson its by-place branch, which I could not reach with any input and read as equivalent.
One mutant did not compile as written and was rewritten.
Not run
- The mobile benchmark: no simulator or emulator here.
pnpm test:mobile-benchmark. - The issue's gist on the real CLI: I did not run it. The integration flow covers the same shape on real Chromium.
- An older runner replaying a newer entry through the CLI: checked only through the exported relocation functions on both commits' source.
For the maintainer
- Whether to bump
REPLAY_POLICY_VERSION. Without a bump, two things follow, both checked on the merge base and this head source:- A by-place entry recorded before this change keeps replaying by place, and a replay that passes never records the step again. So a project that already holds the issue's
Suspendrecording keeps pressing the wrong row after it upgrades.npx e2e cache clearis the way out today. - An older runner that reads an entry this head wrote drops
leadsand matcheswithinthe old way. With buttons namedView routethat show the departure city, and the arrival city after them (Albany -> Boston,Albany -> Denver,Boston -> Chicago), the head records the first button as{ within: "Boston", leads: true }. The merge base relocates{ within: "Boston" }to theBoston -> Chicagobutton, on an unchanged screen. It needs a button whose shown text differs from its name and matches another row's key, plus recordings shared across runner versions. A bump fixes both, but it re-keys every entry and means recording both benchmarks again in this PR, which a fork has no model key for.
- A by-place entry recorded before this change keeps replaying by place, and a replay that passes never records the step again. So a project that already holds the issue's
- Keying by row data. When the row's next text is data, the key moves with it. With
[Archive] $500 Acmeabove[Archive] $700 Globexand the prices swapped, rows in place, the merge base replays by place on Acme and this head replaysin "$500"on Globex. The description discloses this. By my reading ofcontainerKey, main already keys a label-first row by its first text the same way ($500 Acme [Archive]keysin "$500"), so I read it as a design limit rather than a defect of this PR.
The findings are mine; the approval is @okwasniewski's.
…changeset Review follow-up: the release note promised row keying everywhere, but rows the next text does not tell apart still replay by place. A glyph button now leads two fixture rows and its recorded target is asserted, and the reader is tested to take leads only as true beside a within.
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 1b3d161 (main c330373, mergeable_state clean, merges into main without conflict, CI green). The two new commits (e1528ab, 1b3d161) only touch the changeset and tests, with no source change since b9521ee.
@michal-e2e's review of b9521ee:
- Must fix, changeset promises too much: done. It now says the row key applies "when that text tells the rows apart" and holds "while that text stays the same", and that rows the next text does not tell apart still replay by place. That also closes cubic's P2 on the changeset.
- Glyph button through the recorder: done.
?lead=1has twoDismiss(×) rows, and the flow asserts{ name: 'Dismiss', text: '×', within: 'Note two', leads: true }. - Reader test for a malformed
leads: done (reads \leads` only as true beside a `within`: nowithin, plus1,false,'true',null`). - The doc block on
LEAD_ROWS: done, the const now sits above therenderRepeatsdoc. - PR description "Relocation accepts either key": not done, see below.
Must fix
- none
Should fix
- PR description: "Relocation accepts either key" is still there. Since 078eb7a relocation reads one key per entry: past the control for an entry with
leads, the row's first text otherwise. Please update the sentence as Michal asked.
Nits
trace-recorder.test.ts:417: the new reader test sits indescribe('TraceRecorder: bare-point drags'). It belongs in its own describe or next to the other reader tests.
Overlap with #2093 (twin control gone): both PRs edit placementOf and readDescriptor. #2093's description records the merge: keep both sides, and whichever PR lands second must also compute twinsWithoutTestId inside this PR's early return for a leading control. Nothing for this PR to change.
cubic: no open findings. All three threads are fixed (P2 relocate fallback, P3 leads doc, P2 changeset).
Verified
trace-recorder,relocate-within,relocate-position,relocate-anonymous,relocate-minted-test-idandtests/integration/trace-cache-replay.test.ts(real Chromium) pass, 86/86.tsc --noEmitpasses forpackages/e2e, and oxlint is clean on the touched dirs.- Mutants on the new tests, each caught:
- Michal's glyph mutant (
within === undefinedin place ofoutside !== withininplacementOf): the lead-row recording test fails withwithin: "×" - reader accepts
leadswithoutwithin: the reader test fails - reader accepts any
leadsvalue: the reader test fails
- Michal's glyph mutant (
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
michal-e2e
left a comment
There was a problem hiding this comment.
Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.
Reviewed 840d373db against c30354ff8. The original reorder works. Replay clicks the wrong record in three other cases.
Must fix
- Keep a sibling button from becoming the target's row key. I recorded
Alphain a group of buttons that all have the accessible nameOpenand showAlpha,Bravo, andCharlie. The new recorder skipsAlphaand usesBravoas the key. After reversing the buttons, replay clickedCharlie. The base handed off without a click. Please require the key to identify the row that owns the control, and hand off when that identity cannot be established.actions.ts:142 - Keep a changing cell value from transferring a recorded click to another customer. I recorded
Archiveon Acme in a table with columnsArchive | Price | Customer. I swapped the prices of Acme and Globex and left the rows in place. The base clicked Acme. The new replay followed the recorded price and clicked Globex. Please use a key that survives changes to the row's data, or hand off before clicking when the recorded row cannot be established.action-dispatcher.ts:907 - Make earlier runners miss recordings that require the new key semantics. With routes Albany to Boston, Albany to Denver, and Boston to Chicago, I wrote a trace for the first route to a shared cache. The new runner clicked the intended route. The base read the same file as a hit, dropped
leads, and completed replay after clicking Boston to Chicago on the unchanged page. The revisions generated identical cache keys. Please make earlier runners reject or miss these entries before dispatch and cover that with a shared-cache regression test.trace-read.ts:384· Cache sharing
Please assert the full click log in these regressions. The end-state check runs after dispatch, so it cannot undo a click on the wrong record. Replay end-state check
Verified
- The focused Chromium probe used the web engine's semantic reader, the pinned recorder and replay code, and the app's click log. It reproduced all three cases above. For the original leading-control reorder, the base clicked Albany to Denver and the head clicked Albany to Boston. The head also replayed the older recording on the unchanged page.
- The head rejected the malformed
leadsvalues and the missingwithincase. The revised changeset says the recorded text must distinguish the rows and remain stable. - GitHub's deterministic web, iOS and Android jobs passed. The spec gate failed after its Node test jobs were cancelled, and the replay-only web agent job was skipped. GitHub checks
Verification gaps
Another review held the local execution lock. The full check, test, testbed, web benchmark, strict-cache web agent, mobile benchmark, and mutation runs are unverified locally at this head. The focused probe exercised actual clicks in Chromium through the replay engine.
|
@okwasniewski I tried a rework and hit the same failure with a status or badge in place of the price, so I don't think a text key is safe here without a design change. e2e-inc/e2e#2052 still reproduces on main. Happy to close this and leave the fix to the cache rewrite |
|
Note This text was drafted with AI and posted after human approval.
Thanks for the fix and for trying the rework, @JaynouOliver. You wrote that a text key is not safe here without a design change and that you are happy to close this and leave the fix to the cache rewrite. This PR also has conflicts with The bug itself is still open and stays tracked in #2052. |
What and why
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.REPLAY_POLICY_VERSIONbump, as in fix(cache): a row of a windowed list is not keyed by its list's first rendered row; mobile benchmark re-recorded, Android strict #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.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.[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.tap button "Suspend" (2 of 5)tap button "Suspend" in "Acme Corp"1 replayed · 1 handed off2 replayed--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.5 failed | 27 passedon main's sources,32 passedhere.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.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
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it..d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures.e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.