fix(cache): replay a recorded step that types an empty value
Merged
RA
2mo ago+49+49+01234567890123456789-2-2-0123456789
Fixes #789.
- The recorder writes a
typeortypeTextaction with value""(clearing a field), and the reader rejected it.readInputTextreturnsundefinedfor""(packages/e2e/src/cache/trace.ts), so the entry wasinvalid-entry: the step called the model on every run and failed withREPLAY_STALEunder--strict-cache. - New
readTypedValueallows""for thetypeandtypeTextvalue only.select,text,url, and upload paths still reject it, and a unit case pinsselect. - Replay already handles it: the dispatcher only checks
typeof value === 'string', and theunique()templating passes""through. - Adds a
/clear-fieldfixture page and aclears a fieldflow in the trace cache replay suite: type a draft, then type"".
Verified
Ran it locally: yes
- Built
dist, round-trip of atypeentry through JSON (buildTraceEntrythenreadTraceEntry). tests/integration/trace-cache-replay.test.tsagainst adistbuilt from main's reader and from this branch.
| main | this branch |
|---|---|
value: "nonempty" reads back: true | true |
value: "" reads back: false | true |
replay suite: × replays every step on the second run with zero model calls (AssertionError: expected [ Array(2) ] to have a length of +0 but got 2) | Tests 20 passed (20) |
Also green locally: pnpm check, e2e unit suite (2521 passed), and the other trace cache integration files (42 passed).
Not run: the web benchmark, and a live agent.act against a real model recording a field clear.
apps/testbed tests/speed.e2e.ts (forty taps each cost no more than a few locator reads) failed 3 of 6 runs on this branch at about 102.7 ms against its 100 ms budget, and passed on the others. I ran it twice on main and both passed. That test taps and never reads the trace cache, but two runs is not enough to call it unrelated.