Skip to content

test(native-proof): compare the held worktree's own charge across its refused release (#2819) - #4040

Merged
schlessera merged 6 commits into
mainfrom
test/2819-held-release-owner-charge
Nov 16, 2026
Merged

schlessera merged 6 commits into
mainfrom
test/2819-held-release-owner-charge

Conversation

@schlessera

@schlessera schlessera commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #2819

What changed

Native case 17 now checks that a refused poolRelease of a held worktree frees nothing of that worktree by comparing the worktree's own simple-quota owner charge before and after, not the pool's aggregate chargedBytes. The manager reports that charge from its live measurement through an idempotent retry of the worktree's poolCreate (create, packages/ui-sdk/src/server/native-reference-pool.ts:618-627). Both readings come before the worker's read, whose atime update could dirty the worktree's metadata. If the release went through, the retry refuses with released, and that code reaches REFERENCE_ACCESS_HELD_NOT_RELEASED as a value instead of being thrown. A new REFERENCE_ACCESS_HELD_CHARGED check makes sure the compared charge is not a trivial zero. The only file changed is scripts/native-proof/reference-pool.native.ts.

Why this shape

The issue offered two options: settle earlier reclamation before the first reading, or compare the worktree's own owner bytes. Settling would only make a race less likely, because any earlier release can still be reclaimed between the two readings. The owner charge is exactly what the assertion claims to measure, and background reclamation of other roots cannot move it. Release semantics, the #2729 refusal and the other cases are unchanged.

Proof

Native runs need loop devices and root, which the local host does not have, so the native receipts come from draft heavy feedback. Two temporary commits added a receipt driver (scripts/native-proof/receipt-2819.ts) and a two-line runtime_host override in scripts/ci-proof.ts that ran it instead of the three native suites. Both are reverted here (c0081e95b, bfdb0d811), and the final tree is byte-identical to the fix commit 8e14d9f41 (git diff 8e14d9f41 HEAD is empty). Each driver run is the real bun scripts/prove-reference-pool.ts. Values come from each run's command-09.log in the runtime-host-proof artifact.

Round one (run 43756278174, runtime_host job 132945961843, head f77a2dde7):

Variant Exit Result
old-aggregate+reclaim (failing-first: the pre-fix aggregate comparison, with an unrelated 4 MiB staging root released and reclaimed between the readings) 1 in 29.6 s fails REFERENCE_ACCESS_HELD_NOT_RELEASED on charged only: - 4849664 / + 622592; code, state, access and read all held
owner+reclaim (the fix under the same reclamation) 0 in 71.6 s whole proof passed; held owner charge 16384 before and after
owner+no-held-refusal (mutation: #2729's refusal at packages/ui-sdk/src/server/native-reference-pool.ts:718-719 removed) 1 in 29.0 s fails REFERENCE_ACCESS_HELD_NOT_RELEASED: code: "none", state: "reclaimed", access: null, read: "MISSING", charged: "refused: released"
clean+load ×6 (two niced CPU spinners and a continuous 256 MiB dd conv=fsync writer) 1 each, ~140 s all 6 passed REFERENCE_ACCESS_HELD_NOT_RELEASED (held charge 16384 each). Each then failed a later, unrelated load-sensitive assertion: 5 × REFERENCE_EFFICIENCY_LOCAL_COMMIT (manager client 30 s timeout, #4048) and 1 × REFERENCE_ACCESS_CRASH_RECONCILED (transient changing refusal, #4047).

Round two (run 43778088516, runtime_host job 133009087646 passed, checkout ee73f2d62ffe834c533a4fff67055a9056b16d7f): ten consecutive clean runs of the fixed proof under the same parallel load, each stopped by a marker thrown right after the held-release assertion so all ten fit the step. 10 of 10 passed REFERENCE_ACCESS_HELD_NOT_RELEASED (35-41 s each; RECEIPT_2819_SUMMARY {"heldPassed":10,"attempted":10}). Two earlier requests for this round (43760600001, 43766206100) timed out in admission with the heavy-feedback slots full, so they ran nothing.

Acceptance criteria: (1) 16 loaded native runs across the two rounds, including 10 consecutive in round two, passed the assertion. (2) The mutation that removes the held-worktree refusal still fails REFERENCE_ACCESS_HELD_NOT_RELEASED.

Other jobs in those draft runs: every category in round two passed except unit (2). Its only failures, in both rounds, were tests/hosted-proof.test.ts (hosted global commands retain the full local inventory… and native runtime split requires both selected jobs…). Those check the ci-proof command inventory that the temporary override replaced, and that file passes 12/12 locally at the reverted head. Round one's unit (4) failure in packages/ui-sdk/tests/egress-worker-runtime.test.ts:70 is unrelated to this change (#4049).

Local at the final head bfdb0d811: bun run check:pr --base origin/main passed (receipt below); tsc --noEmit -p . passed on the fix commit. Collisions at bfdb0d811 (bun scripts/collisions.ts --json --pr 4040): no path or textual collisions, only 33 closure-only category and workspace overlaps.

{"version":1,"kind":"brain-check-pr-receipt","head":"bfdb0d8112c7410ae3d86306d509a22f6e5a7ff2","base":"origin/main","mode":"focused","startedAt":"2026-11-16T01:23:15.296Z","finishedAt":"2026-11-16T01:24:41.390Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12382.498636999999},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":130.52030100000047},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":111.86908500000027},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":17.562321000001248},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":73425.916032}]}

Checklist

  • Focused local preflight/behavioral receipts and complete selected hosted proof passed; actual head/base/job checkout evidence is in Proof.
  • Acceptance criteria from the issue are all met, or the gap is named below.
  • The PR and completed/advanced issues have verified release milestones under docs/process/github.md.
  • A changeset is included, or this changes nothing a consumer can see. (Proof-only change; nothing a consumer sees.)
  • No personal data anywhere in the diff — the leakage gate covers the whole tree.
  • The integration contract index or relevant component is updated in this same commit, or nothing in the machine surface moved.
  • Docs under docs/ reflect the change, or nothing documented moved.
  • A fail-closed guard added or changed answers the proportionate-containment checklist in this body, or no guard changed.
  • Provider history stays append-only (docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.

Anything left open

Nothing for #2819. The load runs turned up three follow-ups, filed with no milestone: #4047 (case 17 crash-adoption status read refuses a changing pool), #4048 (reference efficiency release hits the client timeout) and #4049 (egress worker runtime test misses its CONNECT record).

🤖 Generated with Claude Code

schlessera and others added 2 commits November 15, 2026 20:05
… refused release (#2819)

Case 17 compared the pool's aggregate allocation before and after the
refused release of a held worktree. Earlier releases in the same proof
still reclaim in the background, so the aggregate can drop between the
two readings while nothing about the held worktree changed; loaded hosts
failed 2 of 6 runs on that field alone.

Compare the worktree's own simple-quota owner charge instead, read from
the manager's live measurement through an idempotent retry of its
create. Both readings precede the worker's read, and a refused retry
reaches the named assertion rather than throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…edback

Reverted before the PR is marked ready; never proof.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schlessera schlessera added this to the 0.45.0 milestone Nov 15, 2026
@schlessera schlessera added type: test Coverage, harness or proof work with no behaviour change. area: ui-sdk Wire protocol, runtime schemas, the server and client SDK surfaces. area: ci CI workflows, the gates they run, release scripts, packaging. labels Nov 15, 2026
@schlessera

Copy link
Copy Markdown
Owner Author

Collisions at head f77a2dde7 (bun scripts/collisions.ts --json --pr 4040): one textual collision with #3806 on scripts/native-proof/reference-pool.native.ts, which edits a different case and leaves case 17's held-release lines alone. The other 19 reports are closure-only overlaps of categories and workspaces with other open PRs, and none of them share a path. I'll rerun the check at the final head after the temporary receipt commit is reverted.

Draft heavy feedback with the temporary receipt driver: https://github.com/schlessera/brain-kit/actions/runs/43756278174

…aded held-release runs)

Reverted before the PR is marked ready; never proof.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
@schlessera
schlessera marked this pull request as ready for review November 16, 2026 02:02
@schlessera
schlessera merged commit 168d525 into main Nov 16, 2026
51 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, the gates they run, release scripts, packaging. area: ui-sdk Wire protocol, runtime schemas, the server and client SDK surfaces. type: test Coverage, harness or proof work with no behaviour change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

native-proof: case 17 compares aggregate charge across background reclamation

1 participant