Skip to content

test: characterize set_widget LWW gate - #161

Merged
benceruleanlu merged 1 commit into
mainfrom
christian-byrne/cmp-sw-lww-characterization
Sep 2, 2026
Merged

benceruleanlu merged 1 commit into
mainfrom
christian-byrne/cmp-sw-lww-characterization

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor

Summary

  • Add permanent characterization coverage for the top-level set_widget LWW gate.
  • Verify lower keys are dropped, higher keys and first writes apply, and equal counter/actor keys resolve by op_id.

Contract corrections

The queue row expected two behaviors that the protocol does not provide:

  1. A different op_id cannot produce an equal full stamp key. Ordering is [counter, actor, op_id], so this test covers the real tie case: equal counter and actor, resolved by op_id.
  2. lww-dropped consumes the losing op_id in __applied. Therefore the contested widget value and stamp remain unchanged, but the full Yjs document encoding changes due to bookkeeping.

No production behavior or outcome strings change.

Invariants

  • KA-2: ordering and identity travel inside the operation.
  • KA-4: deterministic, idempotent application.
  • FC-7: retry identity preserves op_id and conflict ordering uses stamps.

Verification

  • npm test -- test/set-widget-lww-gate.test.ts — 4 passed
  • npm test — 69 files, 855 passed
  • npm run typecheck — passed
  • npm run lint — 0 errors (1491 existing warnings)
  • required repository checks and corpus verification — passed

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 114 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: bac91f57-f669-4680-97fa-bf85b94caf48

📥 Commits

Reviewing files that changed from the base of the PR and between 52d659b and 5088a5a.

📒 Files selected for processing (1)
  • test/set-widget-lww-gate.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the risk:R1 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026

@benceruleanlu benceruleanlu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Review findings

suggestion: In test/set-widget-lww-gate.test.ts, the op_id tiebreak case applies the higher ID before the lower one, so this file remains green if the top-level gate compares only the counter. The broader suite already kills that mutation across the LWW, KA-2, convergence, replay, and property coverage, so this is not a repository safety gap. For stronger standalone characterization, consider adding the reverse op_id arrival order and an equal-counter/different-actor case (KA-2, FC-2, FC-7).

@benceruleanlu
benceruleanlu merged commit 459ccb5 into main Sep 2, 2026
7 checks passed
@christian-byrne

Copy link
Copy Markdown
Contributor Author

Follow-up PR addressing the review item: #176 (assigned to christian-byrne per quiet-week contact rules; approver named in the PR body).

Full context for agent readers

Both requested cases landed in test/set-widget-lww-gate.test.ts: the reverse op_id arrival order (lower first, higher must apply) and an equal-counter/different-actor case in both arrival orders. Mutation check recorded in the PR body: under a counter-only gate the original 4 tests stay green and both new tests fail, so the file now kills that mutation standalone. Focused 6/6 green; typecheck and lint clean; the 8 check-import-graph.test.ts failures in the full run reproduce on pristine main and are unrelated. Filed by fleet lane lane-act-cmp-161-followup-1709 for row act-cmp-161-followup.

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

Labels

risk:R1 PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants