feat(devtools): tape v2 sparse touch track#164
Draft
doodlewind wants to merge 1 commit into
Draft
Conversation
Tapes recorded only buttons + analog, and replay force-dropped touch (`touch = undefined`) — touch interactions were unrecordable and unreplayable, which blocks deterministic testing of any touch UX. Tape v2 adds a sparse `touch: [frameIndex, packed[]][]` track (contacts vary per frame mid-drag, so RLE degenerates; idle frames cost zero bytes). The recorder ring allocates lazily on the first frame that has contacts — every touch-free session (all of PSP) records exactly as before and still exports v:1 byte-identical. Replay now owns all three tracks: a v2 tape drives touches() frame-exact, a v1 tape replays every frame as no-contacts, and live hardware contacts never leak into either. hosts/sim: ScriptEvent gains a level-triggered `touch` track (same convention as hold/analog; [] releases), scriptToMasks expands it to packed words, and touchGlide() emits a per-frame linear glide on the 60 Hz grid so a fling is one line in a scenario. runScenario feeds the third frame arg. tools/tape: record grows --touch "f:id,x,y;f:-" (level-triggered); replay and tree now feed all three expanded tracks — this also fixes the analog track being silently dropped in CLI replays. Tests: sparse export shape, v1 byte-stability, v2 replay determinism + live-leak suppression, expandTapeTouch round-trip, script touch levels, touchGlide grid math. Sim suite stays green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3/6 of the touch-input series (stacked on #163).
What
framework/src/devtools.ts): sparsetouch: [frameIndex, packed[]][]track using the__packTouchwire words. Sparse-by-frame beats RLE for drags and costs zero bytes on idle frames.v:1byte-identical to pre-touch tapes.touches()frame-exact, v1 tapes replay as no-contacts, and live hardware contacts are never leaked into a replay (previously guaranteed by force-dropping touch; now guaranteed with the track).hosts/sim/sim.ts):ScriptEvent.touch(level-triggered likehold/analog,[]releases), expansion inscriptToMasks, andtouchGlide(x0,y0,x1,y1,t0,t1)— a one-line per-frame glide on the 60 Hz grid for fling journeys.runScenariofeeds the third frame argument.tools/tape.ts):record --touch "f:id,x,y[+id,x,y];f:-"; replay/tree feed all three expanded tracks — incidentally fixing CLI replays silently dropping the analog track.Tests
6 new devtools cases (sparse export shape, v1 byte-stability, v2 replay + live-leak suppression, round-trip, v1 expansion) + script-expansion/glide cases;
tests/sim.test.tsregression green;tsc --noEmitclean.Unblocks: sim touch journeys for VirtualList/OSK (parts 4–5) and scripted Vita touch goldens (part 6).
🤖 Generated with Claude Code