Skip to content

Commit e52bc3a

Browse files
committed
plan: check-then-read atomicity is a mandatory W1.1 decision output
CodeRabbit's Major on the epoch re-check design, verified real and absorbed as a council constraint rather than deferred: the epoch fetch and the cached LaneWindow/words read are two steps, so a cross-thread close (or same-slot reuse) between them defeats the check. Two honest frames recorded with it: the race is PRE-EXISTING (the closed-boolean guard carries the identical window — the re-check neither introduces nor widens it), and it is cross-thread-only (unreachable within one thread). The Phase-0 spec now requires the council to choose, as an explicit output: (i) serialize/lease covering both steps + a mandatory interleaving falsifier, or (ii) a written scoped contract with doctrine wording matching that scope — never (ii)'s semantics under (i)'s wording, the exact overclaim class PR #46 corrected. Savant #1's question set upgraded accordingly; W1.1 in the integration plan mirrors the constraint and scopes what 'resolved' means to the chosen arm.
1 parent 30986b4 commit e52bc3a

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎.claude/plans/epoch-recheck-phase0-v1.md‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,26 @@ CodeRabbit review addition, PR #47): its own ABI minor bump, manifest +
7474
old-library rejection leg in `OldAbiCompatTest` — otherwise the fallback
7575
recreates the missing-symbol failure class W1 exists to remove.
7676

77+
**Atomicity constraint (a second CodeRabbit review addition, PR #47 —
78+
the check-then-read TOCTOU):** the epoch fetch and the cached
79+
`LaneWindow`/`words` read are TWO steps; a `close(handle)` between them
80+
(or same-slot reuse) defeats the check. Two facts frame the resolution
81+
honestly: (1) the CURRENT `closed`-boolean guard carries the IDENTICAL
82+
race — the epoch re-check neither introduces nor widens it; (2) within
83+
one thread the window is unreachable (user code cannot call `close`
84+
inside an accessor), so the residual window is exclusively
85+
cross-thread lifecycle-vs-access. The council must therefore decide the
86+
CONCURRENCY CONTRACT the check ships under, as an explicit output, one
87+
of: (i) serialize epoch-fetch + cached read against close (a
88+
read/close lock or a native lifetime lease covering both steps) — then
89+
an INTERLEAVING falsifier for both cached paths is mandatory; or (ii)
90+
scope the guarantee in writing to stale-cache detection BETWEEN
91+
top-level calls, with the facade's lifecycle-vs-access thread contract
92+
stated in `RowStore`/`Mask` javadoc and the doctrine wording matching
93+
that scope (never "unconditional"). Silently shipping (ii)'s semantics
94+
under (i)'s wording is the overclaim class the PR #46 council already
95+
corrected once — not again.
96+
7797
**(b) Prove permanent unreachability, formally, and downgrade the
7898
doctrine wording** — only if (a)'s cost is measured unacceptable AND a
7999
falsifier-backed proof (a test that tries to construct the bad sequence
@@ -118,7 +138,7 @@ restoration in `CLAUDE.md` never happens under (b).
118138

119139
| # | lens | card | questions |
120140
|---|---|---|---|
121-
| 1 | handle safety | `handle-lifecycle-auditor` | Is `Engine.epoch(handle)` itself generation-checked (does its `lgj_resource_info` call go through `resolve`)? Does the recheck introduce a new TOCTOU between the epoch fetch and the subsequent read? |
141+
| 1 | handle safety | `handle-lifecycle-auditor` | Is `Engine.epoch(handle)` itself generation-checked (does its `lgj_resource_info` call go through `resolve`)? Which arm of §3's atomicity constraint — serialize/lease (i) or scoped-contract (ii) — is right, and why? (This is a mandatory decision output, not just a question — see §3; the TOCTOU is pre-existing, shared with the `closed` boolean, and cross-thread-only.) |
122142
| 2 | ABI membrane | `abi-membrane-warden` | Does an epoch-only export need a minor bump (yes per the resolution text — verify nothing cheaper suffices)? Does it fit the bulk/lifecycle taxonomy (`abi.md` §6)? |
123143
| 3 | zero-copy law | `zero-copy-warden` | Is the recheck O(1) per access with zero row-proportional allocation? Does caching the comparison RESULT risk becoming a second staleness authority? |
124144
| 4 | Java surface | `java-surface-warden` | Does the fix stay entirely inside `internal.ffm`/`RowStore`/`Mask` — no new public API, no freshness method leaking implementation physics? |

‎.claude/plans/mask-membrane-valhalla-integration-v1.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,15 @@ discipline remain the last layer.
149149
manifest + `abi.md` entry, `requireMinor(N)` at the Java call site, and
150150
an old-library rejection leg in `OldAbiCompatTest`, or the fallback
151151
recreates the missing-symbol failure class W1 exists to remove).
152-
Resolution (a) resolves `ISS-LGJ-EPOCH-UNCHECKED`.
152+
The epoch fetch and the cached read are two steps — the council's
153+
spec carries the check-then-read ATOMICITY constraint as a mandatory
154+
decision output (serialize/lease with an interleaving falsifier, or a
155+
written scoped contract; the spec's §3 "Atomicity constraint" is
156+
authoritative — a CodeRabbit review addition, and the race is
157+
pre-existing in the `closed`-boolean guard, cross-thread-only).
158+
Resolution (a) resolves `ISS-LGJ-EPOCH-UNCHECKED` at the scope the
159+
chosen atomicity arm actually delivers — the doctrine wording matches
160+
that scope, never exceeds it.
153161
Fallback (b) — formal unreachability proof + doctrine
154162
downgrade — only on measured cost, never on assumption; under (b) the
155163
issue closes as **DOWNGRADED-DOCUMENTED, never "resolved"**, and the

0 commit comments

Comments
 (0)