Repository navigation
fix(root): judge the document after the drag ends, not in the same tick - #891
Conversation
|
@codex please review this PR |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 5 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
What
Two canvas assertions read state in the same tick as the action they observe. One is a false green and is the reason for this PR; the other is a false red that would survive the feature arriving.
The false green —
acceptance.spec.ts, "leaves the document and the editor intact when Escape cancels"An unpolled read asserting the absence of change. Reading early guarantees the assertion passes, whether or not a mutation lands a commit later — so a canvas that corrupts the document on Escape passes this test. It carries no
test.fail, so it is an active, passing test nobody is looking at, and it is the guard for the exact property its own title claims.Measured: it is the only read-and-assert-in-one-tick site in the suite —
grep -c "expect(await driver\.\|expect(await chrome\."givesacceptance.spec.ts:1and0inscenarios. An outlier, not a house style.expect.pollcannot fix it, which is the trap: polling retries until a condition becomes TRUE, and "unchanged" is already true at t=0, so a poll returns immediately having waited for nothing. What is needed is a barrier, and the drag ending is the right one — a property of the system rather than a duration someone guessed.The barrier is load-bearing rather than decorative. Measured on this canvas: immediately after
cancel()the source still reportsaria-grabbed="true", and it clears by +100ms. So the assertion now waits out a window the old code read straight through.What it does not close, stated rather than implied: a mutation arriving well after the drag has ended is still outside this barrier. It closes the window where a commit from the drag itself is in flight, which is the case that produced the false green.
The false red —
scenarios.spec.ts, scenario 5 (keyboard move)A reorder lands on a React commit after the drop resolves.
readTreeShapeis already polled after an asynchronous mutation in three other places in this suite, one of them spelling out the reason. Now waits, ending early the moment the tree differs.Measured before changing it, and the marker is honest: with focus asserted on the target first (
nx-flat-0,tabindex=0,role=button), the tree is byte-identical at 0, 100, 300, 1000 and 2000ms. B-14 is genuinely unbuilt. The change is so the case reports the arrival — as written it would keep saying "no keyboard move path at all" after keyboard dragging landed.Notes
Test-only, so no changeset.
tsc --noEmitclean; both suites 21 passed.Local canvas e2e on current
mainneedspnpm --filter @nextlyhq/builder... buildfirst —plugin-page-builder's dist imports@nextlyhq/builder/shellsince #865, and a stale builder dist throws atdist/admin/index.js:1134with every case timing out onmountTree. It reads exactly like a broken canvas.