Repository navigation
test(room): extract the gesture state machine from Space and unit-test it - #63
Merged
Merged
Conversation
Quest-Claim: 444d5c3f46e35cb8
…t it Space's drag, wheel, touch, pinch, and lock handling moves into room/gesture.ts, which Space feeds canvas-relative points. The suite covers the #51 cases: a drag turning into a pinch keeps its home, a lock ends the gesture and drops its pinch baseline, a rejected move restores the home under the peer's placement, and a re-grab with a move pending keeps the older home. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 26, 2026 07:30
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Collaborator
Author
…e-tests # Conflicts: # app/src/room/space.ts # quest/m1/room-browser-smoke.md # quest/m1/space-gesture-tests.md
Main dropped Bounds.create in the code audit (#54). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
added a commit
that referenced
this pull request
Nov 26, 2026
Streams the drag that #63's Gesture holds (gesture.dragging) instead of Space's removed #dragging, keeps clearing the pointer on mouseleave now that mouseup and mouseleave share a release handler, and takes the live track name beside @moq/room's TRACK and PRIORITY constants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
added a commit
that referenced
this pull request
Nov 26, 2026
Move the located check into Gesture.locked(), which main's gesture extraction (#63) took from Broadcast.locked(), so a tile from OBS or the CLI still drags locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 26, 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.
Finishes quest/m1/space-gesture-tests.md.
Problem
app/src/room/space.tsmixed DOM events, WebGL, and peer moves in one 869-line class that no suite could load. As a result, the drag, pinch, and lock fixes from #51 were covered only bytscand Biome.Approach
A pure refactor plus tests:
room/gesture.ts(new):Gestureowns the gesture state. That covers the held tile, the touch IDs, the pinch baseline, and each remote tile's remembered home. It also owns the peer-move requests that fix(room): make Remote Control stop others from moving you #51 fixed: grab, publish, settle, and revoke on lock. It works on a structuralTiletype thatBroadcastalready satisfies, so tests build tiles from plain signals.Stack(new, ingesture.ts): holds the shared stacking counter that used to beSpace.#maxZ, soSpaceandGestureraise tiles from the same counter.Spacekeeps the DOM wiring, hover, and cursor. It converts client coordinates to canvas coordinates and callsGesture. The file shrinks by about 470 lines.room/gesture.test.ts(new): 9 tests (~100 ms), no WebGL, audio, relay, or clock reads. Gestures read no time, so nothing needs a mocked clock. Covered:Mutation check: reverting each #51 fix one at a time made exactly one test fail. The fixes reverted were: always re-grab on pinch (with and without publishing), keep the pinch baseline on lock, keep dragging on lock, ignore pending moves when remembering a home, ignore the peer's published placement on restore, and restore without a pending move.
Decisions (taken while the maintainer was away; each is easy to undo)
Gesturewrites the tile's signals directly and keeps the peer-move carrier inside. Every fix(room): make Remote Control stop others from moving you #51 case depends on whether a move is pending, so returning effects would leave the logic under test split across the two classes.Broadcast.locked()removed. It was used only bySpace, so it is replaced byGesture.locked(tile), which checksrole === "watch"without a handle. This is the same test as the oldinstanceof WatchBroadcastcheck.#touchesstored coordinates that nothing read, so it is now aSetof IDs.canvas.relativescales both axes by the same factor except for a bordered canvas (the About demo), where the two factors differ by the border's share of the size, so a two-finger rotation there can drift the scale by a fraction of a percent. Not worth passing client distances throughGesturefor (review note, round 1).mouseupandmouseleaveshare one handler. #54 landed first with the same merge and the dropped?? 1scale fallbacks; the merge of main keeps this PR'sGesture-based handlers, chore: run the m1 code audit #54's comment placement, and chore: run the m1 code audit #54'srendercall without thehoveringoption. Main also droppedBounds.create, so the tests usenew Bounds.just dev. Another session'sjust devheld the hard-coded API, relay, and auth ports (3000, 4443, 4440), plus 1420. I ran this worktree's Vite on 1421 instead (see Validation).Impact
appis not a published package. Inside the app,Broadcast.locked()is gone (no other caller).bun test.Validation
quest gate just check: passes (quest check,tsc, Biome, API, app, and media tests), on the merge with main too, including the room-canvas browser smoke from #62.FakeRoomharness in the page from the dev server's/src/room/*.tsmodules. Real DOMMouseEvent,WheelEvent, andTouchEventevents drove the realSpace, and I read the tile positions directly:grabbingthendefaultdeltaY−500 → scale 1.5, cursorzoom-inFollow-ups
None.
Models
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high; merge of main by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.Head: f3bb9c0
Base: origin/main at 405221c
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Risk file: none
Reviewer: Codex, gpt-6.2-sol, high effort
Session:
01a219b4-837a-7633-81b8-5d7ea6ed09cf, round 1Score: 9/10,
The extraction preserves the lock, stacking, and move-publication contracts, with a minor pinch-zoom regression when the canvas scales its axes differently.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none
Notes, the author's to take or leave:
app/src/room/space.ts:154:Measure pinch distance in client coordinates