Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6b4ce85
Add a sealed held-session store op and named k=2 hold-slot reads.
Oct 8, 2026
0af5c2e
Measure hold-slot advance from after open, not from zero.
Oct 8, 2026
b55f08d
Read hold-slot head from one root listing, like the other wet controls.
Oct 8, 2026
bfbcfe3
Enroll the held-session wet claim as a DirWithTemplate hermetic gap.
Oct 8, 2026
f209e9f
Delete the listing-based windowed hold observe/release this PR replaced.
Oct 8, 2026
94f20a7
Bound windowed slot observation so a successor-present retry cannot r…
Oct 8, 2026
32a76a0
Stop windowed reclaim at the first failed generation so it cannot pun…
Oct 8, 2026
6a4621c
Add the leaked-hold inhabitance control for partial window reclaim.
Oct 8, 2026
28c4fc8
Name the reclaim stop as the hole-freedom for named hold verify.
Oct 8, 2026
054db53
Walk windowed reclaim over one sorted eligible list.
Oct 8, 2026
6b39172
Assert leaked-hold refusal is named-window Unsettled, not occupancy-f…
Oct 8, 2026
d901050
Delete lookup/commit aliases on the typecheck store session.
Oct 8, 2026
2ecde15
Call gen-1500 a termination regression, not the hang's red.
Oct 8, 2026
a7900ee
Derive the window Unsettled attempt count from the fold roster.
Oct 8, 2026
1d8f95b
Classify window exhaustion as BoundExceeded and named G+1 as head-moved.
Oct 8, 2026
b99601f
Keep named-head-moved off BoundExceeded and delete the unused CAS obs…
Oct 8, 2026
662ca06
Give named-head-moved its own release and recovery refusals.
Oct 8, 2026
f96456d
Make named-window verify realization-private and drop it from hold ob…
Oct 8, 2026
b5fa4c5
Delete the typecheck_module_store_session forwarding alias.
Oct 8, 2026
0325b48
Drop CasReclaimProgress.stopped; the failed list already stops the walk.
Oct 8, 2026
caae496
Keep named-window head-moved off the generic hold protocol.
Oct 8, 2026
e14bd75
Render BoundExceeded as a unit-neutral observation budget.
Oct 8, 2026
014baad
Match leaked-hold red to NamedWindowHeadMoved.
Oct 8, 2026
42d93b7
Drop the ioctl leaked-hold reclaim claim from the floor.
Oct 8, 2026
3b015d6
Declare the ioctl leaked-hold claim as DirWithTemplate debt.
Oct 8, 2026
af71b94
Keep the ioctl debt annotation at module-item grain.
Oct 8, 2026
d0f99d9
Decline the ioctl leaked-hold claim as DeclinedNoCiWetLane.
Oct 8, 2026
b272d5e
Close floor_route_gap chunk_09 after the dropped Cons identity.
Oct 8, 2026
121565a
Attach the BoundExceeded field comment to CasUnreadableSlot.
Oct 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions dag/extdeps/realization/materialization_store_local.dag
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ import std.durable_exclusive_hold {
import gunbc.durable_exclusive_hold_file_store {
file_hold_acquire_windowed, FileHoldAcquireOutcome, FileHoldAcquired, FileHoldOccupied, FileHoldAcquireLost,
FileHoldAcquireStoreUnavailable, FileHoldSlotUndecodable, FileHoldKeyNotSlotAddressable,
file_hold_release_assess_windowed, FileHoldReleasePlanned, FileHoldReleaseNotEligible,
file_hold_release_assess_windowed_at, FileHoldReleasePlanned, FileHoldReleaseNotEligible,
file_hold_release_commit, FileHoldReleased, FileHoldReleaseLost, FileHoldReleaseStoreUnavailable, FileHoldReleaseKeyNotSlotAddressable,
file_hold_recovery_assess_windowed, FileHoldRecoveryPlanned, FileHoldRecoveryNotEligible,
observe_file_hold_windowed,
observe_file_hold_windowed_at,
}
import gunbc.process_hold_identity {
process_hold_text, process_hold_marker, process_hold_decode, ProcessHoldHolder,
Expand Down Expand Up @@ -1033,6 +1033,18 @@ fn local_store_write_index_settled(held: LocalStoreFamilyHeld, expected: CasExpe
// on this host, and only a holder observed dead is recovered through file_hold_recovery_assess. An
// unobservable holder stays held -- a family that cannot be shown free is not written. The hold slot
// is windowed like the occupancy index (k = 2), so its bookkeeping does not grow with commits.
//
// HOLD CHECK AND RELEASE READ THE SLOT BY NAME. The windowed verify step is: generation G present
// and G+1 absent. LocalStoreFamilyHeld already names G, so those two reads are cas_file_slot_path
// Filesystem.Read -- O(1) in the number of objects in the store root. That preserves the existing
// argument (a head is never guessed; a successor present means the slot moved; an absent G is not
// this hold).
//
// ACQUIRE STILL LISTS. Windowed presence is not a prefix: generations at or below head-k are
// deleted, so a named gallop from generation 1 would read NotFound and treat a live head at 100 as
// an empty slot, then create-new generation 1 beside it. Listing the root to discover this key's
// generation files is the unknown-head observation cas_observe_window already uses. A held session
// pays that list once, not once per commit.

data local_store_hold_owner_prefix: String = "materialization-store"

Expand Down Expand Up @@ -1196,7 +1208,7 @@ fn local_store_hold_check(held: LocalStoreFamilyHeld) -> LocalStoreHoldCheck
decl_ref(module_path: "extdeps.realization.materialization_store_local", decl_name: "local_store_commit_verified"),
]
{
let observed = observe_file_hold_windowed(root: materialization_store_root_path(root: held.binding.root) as NonEmptyStr, key: local_store_hold_key(family: held.family), window: held.window)
let observed = observe_file_hold_windowed_at(root: materialization_store_root_path(root: held.binding.root) as NonEmptyStr, key: local_store_hold_key(family: held.family), window: held.window, generation: held.generation)
match observed {
HoldSlotHeld { generation: g, owner: o } =>
if cas_generation_count(g: g) == cas_generation_count(g: held.generation) && durable_hold_owner_equal(left: o, right: held.owner) { LocalStoreHoldCurrent } else { LocalStoreHoldNotCurrent { observed: observed } }
Expand All @@ -1223,6 +1235,7 @@ fn local_store_with_family_of<T>(binding: LocalStoreBinding, family: ArtifactKin
admit_callers: [
decl_ref(module_path: "extdeps.realization.materialization_store_local", decl_name: "local_store_with_family"),
decl_ref(module_path: "extdeps.realization.materialization_store_local", decl_name: "local_store_record_recency"),
decl_ref(module_path: "extdeps.realization.materialization_store_local", decl_name: "local_store_held_session"),
]
{
match local_store_acquire_family_hold(binding: binding, family: family, recovered: false) {
Expand All @@ -1234,6 +1247,25 @@ fn local_store_with_family_of<T>(binding: LocalStoreBinding, family: ArtifactKin
}
}

// A HELD SESSION: acquire the family once, run many lookups and commits under LocalStoreFamilyHeld,
// release once. Distinct from local_store_commit, which still brackets every write; this operation
// does not change that signature. Sealed to gunbc.typecheck_module_store (and the inhabitance
// witness that proves N commits acquire once).
//
// DEADLINE AND RENEWAL follow std.durable_exclusive_hold, not a clock. That protocol recovers a
// hold only when its holder is OBSERVED dead -- there is no timestamp, duration or silent expiry.
// This process is the holder (gunbc.process_hold_identity). Renewal is the named re-observation
// local_store_hold_check performs before every mutation: the slot must still be held at the
// generation and by the owner the session recorded, or the mutation refuses as stale. A session
// whose process has died is recovered by the next writer's liveness observation, never by age.
fn local_store_held_session<T>(capability: LocalStoreCapability, family: ArtifactKindId, run: fn(LocalStoreFamilyHeld) -> T) -> LocalStoreBracket<T>
admit_callers: [
decl_ref(module_path: "gunbc.typecheck_module_store", decl_name: "typecheck_module_store_session"),
]
{
local_store_with_family_of(binding: capability.binding, family: family, run: run)
}

// The release is reported, never fatal to the write it closes: a hold that could not be freed stays
// held by this process, and once this process is gone the next writer recovers it by observation.
type LocalStoreHoldRelease
Expand All @@ -1250,7 +1282,7 @@ fn local_store_release_family_hold(held: LocalStoreFamilyHeld) -> LocalStoreHold
decl_ref(module_path: "extdeps.realization.materialization_store_local", decl_name: "local_store_acquire_all"),
]
{
match file_hold_release_assess_windowed(root: materialization_store_root_path(root: held.binding.root) as NonEmptyStr, slot_key: local_store_hold_key(family: held.family), owner: held.owner, acquired_generation: held.generation, released_by: local_store_hold_release_ref, window: held.window) {
match file_hold_release_assess_windowed_at(root: materialization_store_root_path(root: held.binding.root) as NonEmptyStr, slot_key: local_store_hold_key(family: held.family), owner: held.owner, acquired_generation: held.generation, released_by: local_store_hold_release_ref, window: held.window) {
FileHoldReleaseNotEligible { slot_key: _, refusal: r } => LocalStoreHoldReleaseNotEligible { refusal: r }
FileHoldReleasePlanned { plan: pl } =>
match file_hold_release_commit(plan: pl) {
Expand Down
48 changes: 48 additions & 0 deletions dag/gunbc/durable_cas_file_store.dag
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,54 @@ fn observe_cas_slot_state_windowed(root: NonEmptyStr, key: NonEmptyStr, window:
observe_cas_slot_state_retained(root: root, key: key, retention: KeepGenerationWindow { window: window })
}

// A WINDOWED HEAD READ BY CONSTRUCTED NAME, NOT BY LISTING THE SLOT ROOT.
//
// cas_observe_window finds the head by listing every name under the store root and keeping this
// key's generation files. That is the correct discovery when the generation is unknown, because a
// windowed slot is NOT a presence prefix: generations at or below head-k are deleted, so galloping
// from generation 1 would read NotFound and report an empty slot while the live head sat at 100.
// Listing is therefore retained for unknown-head observation (cas_observe_window).
//
// When the caller already names the generation it believes is head -- a hold it just acquired, a
// release at the generation the protocol recorded -- the existing correctness argument does not
// need the listing. The windowed contract's verify step is: the named generation reads present and
// its successor reads absent. Those two reads are Filesystem.Read of cas_file_slot_path, O(1) in
// the store's object count. A successor that is present means the head moved; an absent named
// generation is not this head. The observation is never guessed.
fn cas_verify_named_window_head(root: NonEmptyStr, key: NonEmptyStr, generation: CasGeneration) -> CasSlotProbe
admit_callers: [
decl_ref(module_path: "gunbc.durable_cas_file_store", decl_name: "observe_cas_slot_state_windowed_at"),
]
{
match cas_read_generation(root: root, key: key, generation: generation) {
GenerationRefused { probe: p } => p
GenerationAbsent => ProbedAbsent
GenerationPresent { content: c } =>
match cas_generation_successor(g: generation) {
CasSuccessorExhausted { head: _ } => ProbedHead { generation: generation, value: c }
CasSuccessorGeneration { generation: next } =>
match cas_read_generation(root: root, key: key, generation: next) {
GenerationRefused { probe: p } => p
GenerationAbsent => ProbedHead { generation: generation, value: c }
GenerationPresent { content: _ } => ProbedWindowHeadUnsettled { attempts: 1 }
}
}
}
}

fn observe_cas_slot_state_windowed_at(root: NonEmptyStr, key: NonEmptyStr, window: CasGenerationWindow, generation: CasGeneration) -> CasSlotObservation<NonEmptyStr>
admit_callers: [
decl_ref(module_path: "gunbc.durable_exclusive_hold_file_store", decl_name: "observe_file_hold_windowed_at"),
]
{
let _window = window
if !cas_key_is_slot_addressable(key: key) {
CasObservedUnreadable { cause: CasUnreadableReadRefused { detail: cas_key_not_slot_addressable_detail } }
} else {
cas_probe_as_observation(probe: cas_verify_named_window_head(root: root, key: key, generation: generation))
}
}

data cas_key_not_slot_addressable_detail: NonEmptyStr = "key is not slot-addressable: it carries a path separator"


Expand Down
41 changes: 38 additions & 3 deletions dag/gunbc/durable_exclusive_hold_file_store.dag
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ import std.durable_exclusive_hold {
DurableHoldHolderReport, DurableHoldRecoveryRefusal, HoldRecoveryEligible, HoldRecoveryRefused,
durable_hold_recovery_assess,
}
import gunbc.durable_cas_file_store { KeepAllGenerations, CasSlotRetention,
DefaultAccessCreateOnly, DerivedPayloadAdmitted, DerivedPayloadKeyNotSlotAddressable,
admit_cas_attempt_for_derived_payload, file_compare_and_set, observe_cas_slot_state,
import gunbc.durable_cas_file_store { KeepAllGenerations, KeepGenerationWindow, CasSlotRetention,
CasGenerationWindow, DefaultAccessCreateOnly, DerivedPayloadAdmitted, DerivedPayloadKeyNotSlotAddressable,
admit_cas_attempt_for_derived_payload, file_compare_and_set, file_compare_and_set_retained,
observe_cas_slot_state, observe_cas_slot_state_retained, observe_cas_slot_state_windowed_at,
}

// THE TAGS ARE NAMED ONCE AND THE BODY IS DERIVED FROM THE TAG THAT MATCHED.
Expand Down Expand Up @@ -163,6 +164,15 @@ fn observe_file_hold_windowed(root: NonEmptyStr, key: NonEmptyStr, window: CasGe
observe_file_hold_retained(root: root, key: key, retention: KeepGenerationWindow { window: window })
}

fn observe_file_hold_windowed_at(root: NonEmptyStr, key: NonEmptyStr, window: CasGenerationWindow, generation: CasGeneration) -> DurableHoldObservation
admit_callers: [
decl_ref(module_path: "extdeps.realization.materialization_store_local", decl_name: "local_store_hold_check"),
decl_ref(module_path: "gunbc.durable_exclusive_hold_file_store", decl_name: "file_hold_release_assess_windowed_at"),
]
{
hold_observation_of_cas(observed: observe_cas_slot_state_windowed_at(root: root, key: key, window: window, generation: generation))
}

// EVERY EFFECTFUL HOLD WRITE IS LIVE READ -> SEALED PLAN -> CAS COMMIT, AND NO
// WRITER ACCEPTS AN OBSERVATION FROM ITS CALLER.
//
Expand Down Expand Up @@ -375,6 +385,31 @@ fn file_hold_release_assess_windowed(root: NonEmptyStr, slot_key: NonEmptyStr, o
file_hold_release_assess_retained(root: root, slot_key: slot_key, owner: owner, acquired_generation: acquired_generation, released_by: released_by, retention: KeepGenerationWindow { window: window })
}

fn file_hold_release_assess_windowed_at(root: NonEmptyStr, slot_key: NonEmptyStr, owner: DurableHoldOwnerRef, acquired_generation: CasGeneration, released_by: DurableHoldReleaseRef, window: CasGenerationWindow) -> FileHoldReleaseAssessment
admit_callers: [
decl_ref(module_path: "extdeps.realization.materialization_store_local", decl_name: "local_store_release_family_hold"),
]
{
match durable_hold_release_assess(
observed: observe_file_hold_windowed_at(root: root, key: slot_key, window: window, generation: acquired_generation),
owner: owner,
acquired_generation: acquired_generation,
) {
HoldReleaseRefused { refusal: r } => FileHoldReleaseNotEligible { slot_key: slot_key, refusal: r }
HoldReleaseEligible { generation: g } =>
FileHoldReleasePlanned {
plan: FileHoldReleasePlan {
root: root,
slot_key: slot_key,
owner: owner,
generation: g,
free_payload: hold_slot_payload(state: DurableHoldFree { released_by: released_by }),
retention: KeepGenerationWindow { window: window },
},
}
}
}

// The commit still tells a lost race from an unavailable store. A release
// assessed at generation N and committed after the slot moved is
// FileHoldReleaseLost -- the hold this plan described no longer exists -- and
Expand Down
33 changes: 33 additions & 0 deletions dag/gunbc/typecheck_module_store.dag
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module gunbc.typecheck_module_store

// THE TYPECHECK MODULE STORE SESSION: the admitted consumer of
// extdeps.realization.materialization_store_local local_store_held_session.
// neat-carp-75 (C2) will drive lookups and commits through this fold. This
// module is the seal's inhabitant, not a second store.

import std.types { List }
import std.cache_identity { ArtifactKindId }
import std.materialization_provider { ArtifactRequest }
import std.materialization_object { ArtifactPayload, StoreLookup }
import extdeps.realization.materialization_store_local {
LocalStoreCapability, LocalStoreFamilyHeld, LocalStoreBracket, LocalStoreCommit,
LocalStoreStagedPart,
local_store_held_session, local_store_commit_under, local_store_lookup,
}

fn typecheck_module_store_session<T>(capability: LocalStoreCapability, family: ArtifactKindId, run: fn(LocalStoreFamilyHeld) -> T) -> LocalStoreBracket<T> {
local_store_held_session(capability: capability, family: family, run: run)
}

fn typecheck_module_store_lookup(capability: LocalStoreCapability, req: ArtifactRequest) -> StoreLookup {
local_store_lookup(capability: capability, req: req)
}

fn typecheck_module_store_commit_under(
held: LocalStoreFamilyHeld,
req: ArtifactRequest,
payloads: List<ArtifactPayload>,
parts: List<LocalStoreStagedPart>
) -> LocalStoreCommit {
local_store_commit_under(held: held, req: req, payloads: payloads, parts: parts)
}
12 changes: 12 additions & 0 deletions dag/test/claim/materialization_store_local_seal_witness_test.dag
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,15 @@ test fn a_direct_raw_observe_call_is_an_admission_refusal() -> Bool {
test fn a_direct_raw_reclaim_call_is_an_admission_refusal() -> Bool {
admission_refusals(source: direct_raw_reclaim_source, callee: "cas_reclaim_below") == 1
}

data direct_held_session_source: String = "module probe_direct_held_session\nimport std.cache_identity { ArtifactKindId }\nimport extdeps.realization.materialization_store_local { LocalStoreCapability, LocalStoreFamilyHeld, LocalStoreBracket, local_store_held_session }\nfn direct(c: LocalStoreCapability, f: ArtifactKindId) -> LocalStoreBracket<LocalStoreFamilyHeld> {\n local_store_held_session(capability: c, family: f, run: h => h)\n}\n"

data direct_named_window_observe_source: String = "module probe_direct_named_window_observe\nimport std.types { NonEmptyStr }\nimport std.durable_compare_and_set { CasGeneration, CasSlotObservation }\nimport gunbc.durable_cas_file_store { CasGenerationWindow, observe_cas_slot_state_windowed_at }\nfn direct(r: NonEmptyStr, k: NonEmptyStr, w: CasGenerationWindow, g: CasGeneration) -> CasSlotObservation<NonEmptyStr> {\n observe_cas_slot_state_windowed_at(root: r, key: k, window: w, generation: g)\n}\n"

test fn a_direct_held_session_call_is_an_admission_refusal() -> Bool {
admission_refusals(source: direct_held_session_source, callee: "local_store_held_session") == 1
}

test fn a_direct_named_window_observe_call_is_an_admission_refusal() -> Bool {
admission_refusals(source: direct_named_window_observe_source, callee: "observe_cas_slot_state_windowed_at") == 1
}
Loading
Loading