fix: harden interaction locks and session routes#415
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughNew route-construction helpers separate project-opening and explicit session navigation. A reusable body interaction lock manages temporary style changes during resize gestures. Layout now uses the new route helpers. E2E and unit tests were added/updated to exercise session routing and resize interaction release behavior. ChangesSession Route Ownership and Interaction Lock Hardening
Sequence DiagramsequenceDiagram
participant ResizeHandle as ResizeHandle
participant Lock as InteractionLock
participant Body as document.body
participant Events as EventStream
participant App as AppCallbacks
ResizeHandle->>Lock: start()
Lock->>Body: set userSelect="none", overflow="hidden"
ResizeHandle->>Events: attach listeners (mousemove, pointerup, blur, etc)
Note over ResizeHandle,Events: user drags resize handle
Events->>Lock: stop/cancel event (pointerup/blur/timeout)
Lock->>Events: remove listeners
Lock->>Body: restore previous userSelect & overflow
Lock->>App: onRelease(reason)
App->>ResizeHandle: finish(collapse) / trigger onCollapse if threshold reached
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related Issues
Possibly Related PRs
Suggested Labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors navigation logic by introducing centralized route helper functions and improves the panel resizing mechanism with a new createBodyInteractionLock utility to manage global styles. E2E and unit tests have been updated to reflect these changes. Feedback suggests increasing the interaction lock's fallback timeout to 30 seconds to avoid premature termination during slow resizes and updating the E2E tests to dispatch mousedown instead of pointerdown to align with the component's event listeners.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/app/e2e/commands/panels.spec.ts (1)
52-52: ⚡ Quick winPrefer a stable semantic selector for the right panel.
Line 52 uses
#right-panel; switch to adata-componentor role-based locator for resilience.As per coding guidelines: Use
data-component,data-action, or semantic roles for selectors instead of CSS class names or IDs.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/app/e2e/commands/panels.spec.ts` at line 52, The test uses a fragile ID selector when creating the locator const rightPanel = page.locator("#right-panel"); update this to use a stable semantic selector such as a data attribute or role (for example use page.locator('[data-component="right-panel"]') or page.getByRole('region', { name: /right panel/i })) so the locator references a data-component or role instead of the hard-coded ID; change the locator expression wherever rightPanel is defined/used to the chosen semantic selector.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/app/e2e/commands/panels.spec.ts`:
- Line 88: Replace the ad-hoc regex URL assertions on lines 88 and 92 with the
shared route helper from ../actions (e.g., sessionRoute or whatever helper
exports the canonical/resolved session path). Import the helper at the top of
the test file and use await expect(page).toHaveURL(sessionRoute(slug)) (or the
equivalent helper call) so routing assertions use the canonical/resolved slug
logic across platforms.
- Around line 41-47: The session creations using stamp and sdk.session.create
(variables one and two) occur before the try/finally, so if a create fails the
first-created session can leak because the finally cleanup won't run; move the
creation of both sessions (the await sdk.session.create(...) calls that assign
one and two) inside the try block, track created session IDs in a local array,
and in the finally only attempt cleanup conditionally for IDs that were actually
pushed into that tracker; apply the same pattern to the other setup block that
creates sessions (the similar code around lines creating one/two at 97-100).
---
Nitpick comments:
In `@packages/app/e2e/commands/panels.spec.ts`:
- Line 52: The test uses a fragile ID selector when creating the locator const
rightPanel = page.locator("#right-panel"); update this to use a stable semantic
selector such as a data attribute or role (for example use
page.locator('[data-component="right-panel"]') or page.getByRole('region', {
name: /right panel/i })) so the locator references a data-component or role
instead of the hard-coded ID; change the locator expression wherever rightPanel
is defined/used to the chosen semantic selector.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: eb455f01-be22-4777-adb1-0de395a94300
📒 Files selected for processing (3)
packages/app/e2e/commands/panels.spec.tspackages/ui/src/components/resize-handle.test.tspackages/ui/src/components/resize-handle.tsx
Summary
Hardens the two runtime boundaries tracked in #413:
ResizeHandlemousedown path and verify body style acquire/releaseWhy
#412 fixed the urgent packaged-app path, but the underlying boundaries were still easy to regress: temporary resize state could leave body-level interaction styles behind, and session/project navigation intent was still encoded as ad hoc route strings in layout code.
This PR keeps the existing route shapes and UI behavior, but makes the ownership rules easier to test and reuse.
Closes #413.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
Please check:
openProjectRoute,newSessionRoute, andopenSessionRoutepreserve the existing route shapescreateBodyInteractionLockreleases body styles reliably without changing normal resize behaviorpointerupandmouseupare treated as completed resize releases soonCollapsesemantics are preservedRisk Notes
Low-to-medium app/runtime risk. This touches shared navigation helper usage and the shared
ResizeHandlecomponent, but keeps behavior intentionally narrow: no route shape changes, no UI redesign, and no data-layer refactor.How To Verify
Screenshots or Recordings
Not applicable. This is runtime hardening and regression coverage with no intended visual change.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Refactor
Tests