Skip to content

test(lock): make stress assertions deterministic - #106

Merged
steipete merged 1 commit into
mainfrom
fix/lock-stress-determinism
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/lock-stress-determinism

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • gate the intentional throwing holder so its acquisition and cleanup path always run
  • assert mutual exclusion, balanced critical-section entry/exit, clean timeout failures, and complete manager/sidecar cleanup
  • remove the timing-dependent exact rejection count while retaining all 40 in-process contenders and all 8 child processes

The 16 child-process events remain exact by protocol: the parent only inspects the log after all eight children exit successfully, and each successful child writes one enter and one exit event.

Testing

  • 20/20 consecutive runs of pnpm exec vitest run test/file-lock-concurrency-stress.test.ts --reporter=dot
  • pnpm check
  • pnpm test:security
  • git diff --check
  • Codex autoreview: clean, no accepted/actionable findings

No changelog entry because this is test-only.

@steipete
steipete requested a review from a team as a code owner August 2, 2026 23:53
@steipete
steipete merged commit 947fa83 into main Aug 2, 2026
24 checks passed
@steipete
steipete deleted the fix/lock-stress-determinism branch August 2, 2026 23:58
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 7:57 PM ET / 23:57 UTC.

ClawSweeper review

What this changes

The PR replaces a timing-dependent file-lock stress assertion with a gated throwing holder and explicit checks for mutual exclusion, lifecycle balance, timeout failures, lock-file removal, and manager cleanup.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 2 items remain

Keep this PR open: it is not on current main, and the focused test change appears correct, but the PR body provides claimed test runs rather than inspectable after-fix runtime evidence. Likely related people: steipete is the high-confidence routing candidate from the original lock-stress coverage and current patch history.

Priority: P3
Reviewed head: 9ef2390512f32c97a4ab3b90b91445baa56bbda4

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and consistent with the current lock-manager cleanup contract, but merge confidence is capped by missing inspectable after-fix proof.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body lists focused test and check runs but has no inspectable after-fix terminal output or artifact; add a redacted terminal transcript of the stress test before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body lists focused test and check runs but has no inspectable after-fix terminal output or artifact; add a redacted terminal transcript of the stress test before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Focused branch diff: The PR changes one stress-test file, replacing the timing-dependent exact rejection count with deterministic entry, exit, timeout, and cleanup assertions.
Lock-manager cleanup contract: The file-lock manager delegates withLock to the sidecar manager, whose finally releases the acquired lock; the PR's empty heldEntries() assertion therefore directly checks the intended cleanup state after the forced throw.
Current-main provenance: The existing stress test was introduced by the lock-hardening commit, which records that the 40 in-process contenders and eight child processes verified mutual exclusion; the PR preserves those scales while making the in-process throw path deterministic.
Findings None None.
Security None None.

How this fits together

The file-lock subsystem coordinates exclusive access to filesystem paths via sidecar lock files and in-process manager state. Its stress tests start many local contenders and child processes, then verify that critical sections do not overlap and all lock state is released.

flowchart LR
  A[In-process contenders] --> C[File lock manager]
  B[Child processes] --> D[Sidecar lock files]
  C --> D
  D --> E[Exclusive critical section]
  E --> F[Entry and exit events]
  F --> G[Cleanup assertions]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body lists focused test and check runs but has no inspectable after-fix terminal output or artifact; add a redacted terminal transcript of the stress test before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The PR body reports repeated runs but provides no inspectable after-fix terminal output, runtime log, recording, or linked artifact, so the claimed stress-test stability cannot be independently assessed from the discussion alone.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Test surface 1 file changed; 64 added, 25 removed The branch is limited to lock concurrency-test assertions and does not change production code, dependencies, or package metadata.
Contention coverage 40 in-process contenders and 8 child processes retained The revised test preserves the original concurrency scale while removing the exact timing-dependent rejection expectation.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the deterministic lifecycle assertions and add a redacted terminal transcript showing the focused stress test completing successfully after this patch.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the deterministic lifecycle assertions and add a redacted terminal transcript showing the focused stress test completing successfully after this patch.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR improves deterministic regression coverage rather than reporting a separate user-facing failure. The source clearly establishes the in-process and cross-process contention paths it exercises.

Is this the best way to solve the issue?

Yes: gating one deliberate throwing holder makes its acquisition and cleanup path deterministic while retaining checks for mutual exclusion, timeout shape, sidecar deletion, and manager cleanup.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 94d76c315247.

Labels

Label changes:

  • add P3: This is a focused, low-risk test reliability improvement with no demonstrated direct user-facing regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists focused test and check runs but has no inspectable after-fix terminal output or artifact; add a redacted terminal transcript of the stress test before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a focused, low-risk test reliability improvement with no demonstrated direct user-facing regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists focused test and check runs but has no inspectable after-fix terminal output or artifact; add a redacted terminal transcript of the stress test before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Focused branch diff: The PR changes one stress-test file, replacing the timing-dependent exact rejection count with deterministic entry, exit, timeout, and cleanup assertions. (test/file-lock-concurrency-stress.test.ts:90, 9ef2390512f3)
  • Lock-manager cleanup contract: The file-lock manager delegates withLock to the sidecar manager, whose finally releases the acquired lock; the PR's empty heldEntries() assertion therefore directly checks the intended cleanup state after the forced throw. (src/sidecar-lock.ts:227, 94d76c315247)
  • Current-main provenance: The existing stress test was introduced by the lock-hardening commit, which records that the 40 in-process contenders and eight child processes verified mutual exclusion; the PR preserves those scales while making the in-process throw path deterministic. (test/file-lock-concurrency-stress.test.ts:78, 396504baee7f)
  • Current-main and release check: The PR head has current main as its parent and is not an ancestor of main; no release tag contains the PR head, so the proposed deterministic assertions are neither on current main nor in the v0.5.1 release. (test/file-lock-concurrency-stress.test.ts:90, 9ef2390512f3)
  • Repository policy: The full repository policy calls for focused lock regression coverage and treats filesystem-lock behavior as security-sensitive; this single-test-file patch is consistent with that boundary and does not alter public or production code. (AGENTS.md:18, 94d76c315247)

Likely related people:

  • steipete: Current-main blame and history attribute the affected lock-concurrency test to the lock-hardening commit, and the same contributor authored the focused deterministic test update. (role: introduced affected stress coverage and recent area contributor; confidence: high; commits: 396504baee7f, 9ef2390512f3; files: test/file-lock-concurrency-stress.test.ts, src/file-lock.ts, src/sidecar-lock.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted terminal transcript showing the focused stress test completing after the change; updating the PR body should trigger a fresh ClawSweeper review, or a maintainer can comment @clawsweeper re-review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

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

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant