Skip to content

fix(sidebar): verify a restarted PC's roster that arrived before a move's receipt, once the moves settle - #4315

Merged
devswha merged 5 commits into
mainfrom
fix/reorder-receipt-after-roster
Nov 20, 2026
Merged

devswha merged 5 commits into
mainfrom
fix/reorder-receipt-after-roster

Conversation

@devswha

@devswha devswha commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

What

scripts/workspace-touch-reorder-demo-regression.ts (checkProofGating) timed out now and then in CI browser lane 2/3 (#4309). The cause is in the app (#4316): ReorderCoordinator asked a PC's server for proof of a restart only when a roster of another server lifetime arrived after a move's receipt. Under load the restarted server's roster reached the page while the move was still on its way; with nothing protected yet it was taken as is, and when the receipt landed nothing looked at it again.

Now, once a batch of moves settles (pending reaches zero and the hold stays), the last roster is checked as one arriving then would be, except when:

  • the PC left the roster (it settles through the departure path, no check);
  • its evidence (order_epoch, read_seq) is the one read when the newest move that got a receipt was sent: that roster is older than the receipt, also when an event repeats it;
  • a verification already answered for that same evidence: asking again would spend the PC's verification interval that a real restart needs.

Checking once at settlement instead of on every receipt keeps a proof from landing mid-batch, where a later failing step would drop the verified order and skip the settlement reload.

Closes #4316. The script stays quarantined, now under #4343: of 20 runs in the CI image, one failed in checkPinned's touch pass (a long press that never lifted its row, before any reorder or proof check ran). checkProofGating passed in all 19 runs that reached it.

Out of scope, filed as #4336: a drag queued behind a partly failed batch can stall or falsely succeed after the PC's server restarts. Those schedules fail on main as well; the gate's probes are the repros there.

Tests

src/lib/workspaceOrder.test.ts, each failing before its fix:

  • a restarted server's roster that arrived before the move's receipt is verified (fails on main);
  • a roster read before the move was sent asks nothing;
  • a restarted roster that arrived mid-batch is verified once the batch settles, also after a later step fails;
  • a PC that left before its move's receipt asks no verification;
  • an event repeating the roster read before the move asks no verification;
  • a roster read before a chained batch's move was sent spends no verification the next restart needs;
  • a failed step does not repeat a verification already answered for the same roster.

Reviews

Gate reviewer (GPT-6.2 Astra). Round 1 on the first version found three regressions, fixed in the second commit. Round 2 found two more (chained baseline, answered check), both fixed, plus a queued-recovery case that already fails on main. Round 3 found that the queued-recovery attempt caused new problems, so the lead narrowed the PR to exclude it (#4336). The review of the narrowed head found two more interval regressions against main (a delayed or repeated read of an already-known server lifetime), fixed by comparing lifetimes. The delta review of 6bd77fa0e returned VERDICT: CLEAR. Each round's probes were run on this head and on origin/main: every probe that passes on main passes here.

Validation

  • bun test src/lib/workspaceOrder.test.ts scripts/ci-browser-parallel.test.ts: 75 pass, 0 fail; bun run typecheck: exit 0.
  • bun run check fast on hosthatch: exit 0 at 6bd77fa0e; at 90cd0991c (after the quarantine commit) exit 0 on this PC, because both remote hosts had no free slot.
  • 20 runs of scripts/workspace-touch-reorder-demo-regression.ts in the CI runner image on hosthatch at 6bd77fa0e (ci-browser-parallel.ts, BROWSER_RETRY=0, 6 workers), typecheck and build first: 19/20. The failure is workspace-touch-reorder checkPinned flakes: a long press on a pinned row sometimes never lifts it #4343 (above).
  • Not run: the full browser suite and the Windows install (left to CI).

@devswha

devswha commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Proof at this change (before the rebase onto current main, which touched none of these files): 20/20 passes of scripts/workspace-touch-reorder-demo-regression.ts in the CI runner image on hosthatch (ci-browser-parallel.ts, BROWSER_RETRY=0, 6 workers), bun run typecheck first; bun run check fast exit 0.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • The sidebar now recognizes the restarted server’s workspace order when its update arrives before a workspace move is confirmed, rather than waiting for another update.
    • Older order updates no longer trigger unnecessary verification when a move confirmation arrives.

The coordinator now tracks when roster snapshots arrive relative to workspace move requests. After a valid, non-retired receipt, it checks whether a newer eligible roster needs mismatch verification. Tests cover roster arrival before and after a move request.

Changes: Workspace order reconciliation

Layer / File(s) Summary
Track roster arrivals and move requests
src/lib/workspaceOrder.ts
Roster snapshots record an arrival count. Each move captures that count before sending its request.
Reconcile receipts with newer rosters
src/lib/workspaceOrder.ts, src/lib/workspaceOrder.test.ts, changelog.d/reorder-receipt-after-roster.md
After processing a valid, non-retired receipt, the coordinator checks for a newer roster with non-retired evidence and invokes mismatch verification. Tests cover newer and pre-request rosters. The changelog describes the behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to cc449

This change makes the sidebar check a restarted server's workspace order after a move receipt arrives. No remaining merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title names the main change: verifying a restarted PC's roster that arrived before a move's receipt, once moves settle. The changelog, tests, and code summary all match this. It is specific and co…
Description check Passed The description follows the template's main sections. The 'What' section describes the problem, the cause, and the resulting behavior, which covers the Change section. The 'Validation' section lists t…
Full details: Title check

Explanation

The title names the main change: verifying a restarted PC's roster that arrived before a move's receipt, once moves settle. The changelog, tests, and code summary all match this. It is specific and concise, but it is long at 104 characters, which is within a reasonable limit for a conventional-commit title.

Full details: Description check

Explanation

The description follows the template's main sections. The 'What' section describes the problem, the cause, and the resulting behavior, which covers the Change section. The 'Validation' section lists the commands run with results and states what was skipped, including the full browser suite and Windows install. The description is long and dense, and it references many internal issue numbers and review rounds that a reader outside the team may not follow. It does not link a maintainer-approved issue for a feature, but this is a fix, so that requirement does not apply. It does not mention HTTP/WS contract-test coverage, and the template asks for that only for HTTP/WS changes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 83f99fd and cc44955.

Files selected for processing: 3

  • changelog.d/reorder-receipt-after-roster.md
  • src/lib/workspaceOrder.test.ts
  • src/lib/workspaceOrder.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

@devswha

devswha commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Hold: the gate review reproduced three MEDIUM regressions (a proof landing mid-batch followed by a failed step drops the verified order and skips the settlement reload; a departed PC gets a new check; a compact event reusing the pre-move snapshot spends the verification interval). Written up in #4316 with the likely shape of the fix; the script is quarantined meanwhile.

devswha added a commit that referenced this pull request Nov 20, 2026
…4316 is fixed (#4317)

scripts/workspace-touch-reorder-demo-regression.ts:300
(checkProofGating) flakes in browser lane 2/3 (#4309). The cause is an
app race in ReorderCoordinator, written up in #4316. The fix in #4315
passed 20/20 in the CI image, but the gate review reproduced three
regressions in it, so it does not fit this lane's two-hour limit. Until
it is fixed, a pass on the lane's second run counts, as for the other
entries.

Validation: bun test scripts/ci-browser-parallel.test.ts (30 pass). Not
run: check fast (one entry in a data table that this test covers).
… not per receipt

The gate review of the first version reproduced three regressions (#4316):
a proof landing mid-batch before a failing step dropped the verified order
and skipped the settlement reload; a PC that left between its roster and the
receipt got a new check; an event repeating the pre-move roster spent the
per-PC verification interval. The roster is now re-checked once, when the
batch settles, only for a PC still listed and only when its evidence changed
since the first move went out.

Unquarantines scripts/workspace-touch-reorder-demo-regression.ts.
… move; do not re-ask an answered check

Second gate review (#4316) reproduced two regressions of the settle-time
re-check:
- chained batches compared the last roster with the one read before the
  first batch's move, so a roster read before a later move spent the PC's
  verification interval the next real restart needed. The baseline is now
  the roster read when the newest move that got a receipt was sent.
- a failed step re-asked a verification already answered for the same
  roster: the answered evidence is remembered and not asked again.
…xact read

The gate review of the narrowed head reproduced two regressions against
main: a delayed older read of the lifetime read before the move, and a
later read of a lifetime a verification already answered about, each
started a needless check that spent the PC's verification interval a real
restart then needed. Both are the same server lifetime, so the re-check
now compares epochs only.
20 runs in the CI image passed 19: the one failure is a long press in
checkPinned's touch pass that never lifted its row, before any reorder or
proof check ran. checkProofGating (#4316) passed in all 19 runs that
reached it.
@devswha
devswha force-pushed the fix/reorder-receipt-after-roster branch from cc44955 to 90cd099 Compare November 20, 2026 17:40
@devswha devswha changed the title fix(sidebar): verify a restarted PC's roster that arrived before a move's receipt fix(sidebar): verify a restarted PC's roster that arrived before a move's receipt, once the moves settle Nov 20, 2026
@devswha

devswha commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

The hold above is resolved at 90cd0991c. The three regressions from the first gate review, and the ones found in later rounds, are fixed, each with a test written to fail first. The fix now runs once, when the batch of moves settles: it skips a PC that left, a roster of the server lifetime read when the newest move with a receipt was sent, and a lifetime a verification already answered about.

Gate reviewer (GPT-6.2 Astra): four reviews. The last one, of the delta at 6bd77fa0e, returned VERDICT: CLEAR. All probes from every round were run on this head and on origin/main, and each one that passes on main passes here. Queued-recovery cases that already fail on main are filed as #4336, out of scope on the lead's decision.

20 runs in the CI image on hosthatch at 6bd77fa0e: 19/20. The one failure was in checkPinned's touch pass, before any reorder or proof check ran (filed as #4343), so the script stays quarantined under #4343. checkProofGating passed in all 19 runs that reached it.

@devswha
devswha merged commit c34b00a into main Nov 20, 2026
25 of 28 checks passed
@devswha
devswha deleted the fix/reorder-receipt-after-roster branch November 20, 2026 18:25
@devswha

devswha commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head 90cd0991c. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit finished, with no review that names this head.

CodeRabbit did not review head 90cd099 (rate-limited/skipped; reviewed only the first version). Reviews of record at this code: omo gate reviewer (GPT-6.2 Astra), four rounds, last delta review of 6bd77fa VERDICT CLEAR (90cd099 only adds the quarantine-table entry under #4343); dori review of 90cd099 VERDICT CLEAR. Scope narrowed on the lead's word; deferred pre-existing cases in #4336. Sensitive-area file is only the quarantine table: workspace-touch-reorder stays quarantined, repointed from #4316 to #4343 (19/20 in the CI image; the one failure is checkPinned's touch lift, not the fixed race). On the lead's word (lane reorder-race brief: merge your own PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workspace-touch-reorder checkProofGating flakes: a restarted server's roster that arrives before a move's receipt is never verified

1 participant