Skip to content

Claims: a fencing token per grant, the workspace in the key, and the holder kept across a park - #11

Merged
dittops merged 2 commits into
masterfrom
pact-kernel/claims-fence-holder
Nov 12, 2026
Merged

dittops merged 2 commits into
masterfrom
pact-kernel/claims-fence-holder

Conversation

@jithinAB

Copy link
Copy Markdown
Contributor

Closes three of the reference-adapter gaps docs/98 WP-7 left in claims (claims.py), found while Bud Meta Harness built claim-lasts: on its shared-store ledger (its card PK-4).

What changes

  • Fencing token. Every grant of a key to a holder that does not already hold it is numbered one higher than the key's grant before it (Taken.fence). A renewal by the same holder keeps the number; expiry and release keep the count, so a later grant is always higher. A lease cannot stop a call still running when it ends, and the number is what lets the system that call writes to refuse the stale writer. SqliteClaims keeps expired and released rows for their count (a released row has an empty holder) and adds the fence column to a file written before it. Ledger.fences records the token of each claim a run took, for the host to pass on.
  • Workspace in the key. scoped(…, workspace) namespaces the-workspace by the workspace id a host names (run(…, claims_workspace=…), carried to members by delegate_by_running). Without one the key is exactly as before.
  • Holder kept across a park. Suspension.claim_holder carries Ledger.holder through _park_state, escalate and the JSON form, and run(…, resume=…) comes back under it. A resumed run under a fresh uuid could neither renew nor release what it claimed before the park. A record from before the field resumes under a new name, as today.

Not in this PR

Bud Meta Harness also releases a claim whose call is known not to have happened (its status check says so, or a person does). The reference spends a key on any call that passed hold, deliberately; changing that needs a status check in the reference first, so it is left for a separate proposal.

Tests

  • New tests/test_a_claim_is_fenced_and_kept_across_a_park.py (9): tokens per grant, renewal, expiry and release on both stores; an expired holder cannot release the next holder's claim; an old claims file gains the column; workspace namespacing in scoped and through Ledger.hold; the ledger records the token; claim_holder survives JSON and escalation.
  • test_a_park_carries_everything_a_resume_needs.py holds claim_holder to the same field lists as spent_keys.
  • Counts synced (adapter +9). In this environment, 79 failures and 29 errors come from absent extras (pydantic_ai, the TypeScript port's node toolchain); the same 108 fail identically on master bcd4e63.

🤖 Generated with Claude Code

jithinAB and others added 2 commits November 12, 2026 07:41
…holder kept across a park

A lease (`claim-lasts:`) frees a key a crashed worker held, but cannot stop a
call still running when the lease ends. Every grant of a key is now numbered
one higher than the key's grant before it (`Taken.fence`); a renewal keeps the
number, and expiry and release keep the count, so the system a call writes to
can refuse a writer whose number is stale. `SqliteClaims` keeps expired and
released rows for their count and gains the column on files written before it.
The ledger records the token of each claim it took (`Ledger.fences`).

`the-workspace` claims are namespaced by the workspace id a host names
(`claims_workspace=`), so two workspaces sharing one store do not refuse each
other; without one the key is as before.

A parked run comes back as the holder of the claims it took
(`Suspension.claim_holder`, carried by `_park_state`, `escalate` and the JSON
form): under a new name it could neither renew nor release them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s the claim's holder AND the reactions; counts recomputed (4822)

Both code conflicts were two additions at the same place: Suspension's
escalate copy and harness._park_state each gained a line from this
branch (claim_holder) and a line from master (reactions). Both are kept.
The counts were recomputed by scripts/sync-counts.sh: 1623 Rust + 3199
adapter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@dittops
dittops marked this pull request as ready for review November 12, 2026 10:37
@dittops
dittops merged commit fa1d0fa into master Nov 12, 2026
1 of 2 checks passed
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.

2 participants