Correctness/contracts review of #607 at head 4f12cae: the core mechanics are right, but one offload fix quarantines on transient I/O and several claims overstate the evidence.
Key findings
- COMPOSITE TRANSACTION (Major) —
quarantine_corruptfires on transient record-open failures, not just corruption. Proven bycomposite.rs:1130-1132(unguardedis_record_read()→ quarantine),disk_store.rs:1099-1104(file-open timeout →fail), anddisk_store.rs:2473-2480where a corrupt store normally fails only one copy while memory republishes the record. Result: one slow disk file wipes the copy from both tiers, thenstart_deferredruns against a key with no record and the linked child is stranded mid-publication. This is normal I/O, not hypothetical. - STALE PLAN (Major) — clearing
pool_planat park but keepingpublic_prefixletsbegin_pool_lookupadopt the pre-park plan viatokens_agree, althoughprompt_lenchanged. - EVIDENCE CLAIMS ARE FALSE (Major) —
claims.rs:1505-1516is truncated, and the "11 tests drive production entry points" / "PINNED after RESET" claims don't hold;corrupt_a_v1_record_is_dropped_and_recapturedlocks in the wrong policy. - 1-in-10^9 UNDERFLOW (Minor) becomes a dead transfer with no recovery.
- NOT FOUND — no offline expirer for the linked-ancestor fix, no epoch on persists, no coalescing of concurrent v1 discards, no unclean-close sweep.
Everything else in the diff checked out; transfer IDs are wired correctly and WindowGrant.page_first really is chain-absolute.
1. Correctness, safety & platform parity
Verified sound (not bugs — do not report as defects). The transfer-ID migration is complete: every PutBegin/GetBegin/WindowFilled/PutCommit/RequestWindow/Cancel uses PutRec::transfer or ManagerGet::transfer (store_bridge.rs:434-437, 951, 1077, 1105, 1159, 1193, 1233, 1289, 1324; claims.rs:2201-2207), and ManagerGet.transfer starts at 0 with first allocation 1 (claims.rs:879-881, store_bridge.rs:122-126), which is exactly what makes the new transfer != 0 filter in store_cancel_get (store_bridge.rs:1226-1234) safe. walk_chain (index.rs:171, 184, 192-197, 211) is correct and has no off-by-one regression for ordinary chains — steps == nodes.len() whenever every parent has tail_pages > 0, so the old bound still fires where it used to. The entry_from clause (mod.rs:113-117), the withdraw_queued predicate (requester.rs:1177, now matching the other three release sites at :739, :790, :898), and Agent::window_drained → forget_window before fail (agent.rs:1561-1565) are all right: with forget_window first, drive's cleanup loop (:1637-1642) cannot re-release the slot. No proto, Cargo, on-disk, or public-API change; the docs edit matches the new code.
Finding 1 — selene/src/composite.rs:1130-1132 — Major. The new arm quarantines on any record-read error, including a transient open failure:
if error.is_record_read() {
self.disk.quarantine_corrupt(&node);
}
inbound.error.get_or_insert(error);
is_record_read() is set on Operation::Open failure too (selene/src/disk_store.rs:1099-1104: file.state = FileState::Closed; self.fail(error.with_record_read());), and quarantine_corrupt is permanent until recapture (disk_store.rs:3099-3105: let _ = self.index.set_ready(key, false); self.index.drop_row(key); ... node.location.failed = true). The packed path in the same file already distinguishes content corruption — composite.rs:1088-1103 gates on crate::shared::packed::Checksum. Impact: a single EIO/ENOENT/EMFILE opening one ancestor record marks that ancestor failed for the process lifetime; every descendant lookup then misses (is_failed feeds needs_row, disk_store.rs:2507-2514) until a full re-store. Fix: quarantine only on content-corruption predicates (checksum/decode), not on is_record_read — record the failing Operation and limit the call to ReadPages | ReadRow | ReadPacked.
Finding 2 — selene/src/memory.rs:2347-2349 — Minor (verify). The deleted if !refill guard is gone; start_deferred now runs unconditionally. The refill branch does publish readiness before returning (memory.rs:2389-2390: let _ = self.core.index.set_ready(&rec.key, true); let _ = self.core.unpin_record(&rec.key);), so the intended ordering holds on the success path. On the Err(msg) path of that same branch however, record readiness is set true even though the row was released and the result was an error (:2381-2387 then :2389), and start_deferred then wakes children of a key whose row is gone; select_parent (memory.rs:455) and start_deferred (:1693-1718) must re-check readiness for the ordering to be safe. The new test async_cpu_codec_refill_wakes_deferred_child asserts the child woke and the parent ended with a row, not that the wake happened after publication, and it is #[cfg(feature = "codec")] (memory.rs:6258-6259) while the reported command passes only --features test-support. Fix: confirm/re-check readiness in select_parent for the error path, and assert ordering in the test.
Finding 3 — selene/src/shared/index.rs:503-511 — Minor. take_while → filter:
self.ordered()
.filter(|node| {
node.children() == 0
&& now.duration_since(node.last_used).unwrap_or_default() >= self.max_age
&& eligible(node)
})
.take(64)
ordered() is a full map iteration (index.rs:347-348: self.order.iter().map(|(_, key)| &self.nodes[key])), so the sweep now scans every live node under the guarantee that runs once a minute (:495-500), while take(64) caps only the result. Cost grows with live-node count instead of expiring count. The mechanism named in #439 — touch_ancestors refreshing last_used without advancing the access tick (index.rs:477-490, node.last_used = now; with no self.tick()) — is left in place, so the fix scans past the symptom rather than repairing the root cause the issue title names (charter #397 tension; #610 makes the same choice). Fix: advance the tick in touch_ancestors (restores take_while and makes the scan prefix-local) or bound the number of examined nodes.
Finding 4 — selene-manager/src/pool/claims.rs:1513-1516 — Minor. The guard returns before validation on the untrusted gRPC path:
if claim.channel().is_some() {
// A data-channel requester's windows are released when its handler reports them sent.
return Ok(());
}
let Some(window) = claim.windows.get_mut(m.index as usize) else {
return Err(Violation::new(
"WindowReleased names a window that was never issued",
));
};
Both Violations at :1517-1529 are now unreachable for channel requesters, so a bogus index or a premature release from that leg is silently accepted. The description only says the handler "Returns Ok(()) immediately". Also the analogy is inexact: channel() is the requester leg (claims.rs:293), while window_filled checks source_channel() (:296, :1437). Fix: run the index/phase validation first and skip only reader_done (:1531).
2. Unintended system-level consequences
Finding 5 — selene-manager/src/pool/store_bridge.rs:643-647 — Minor. The record-relative page arithmetic is now evaluated for every grant and before the region check:
let first_page = if grant.page_count == 0 {
0
} else {
grant.page_first as u32 - rec.accepted.expect("put accepted").1
};
The region check that used to guard this path now follows at :651-655 (let Some(region) = region else { self.put_fail_by_key(key, v2::Reason::Io, "a window in an unknown region"); return; };). A store grant whose page_first precedes the accepted first page now panics in debug and wraps in release instead of failing the put cleanly, and the value is computed for single-process puts where PutWin.first_page is never read (put_commit uses mp.whole only when layout.world() > 1, :1052). Fix: checked_sub routing to put_fail_by_key(Io, …), evaluated after region validation.
Finding 6 — selene/src/pool/engine/requester.rs:1170-1189 with :1016-1020 — Minor. With withdraw_queued now requiring w.peers_left.is_empty(), release depends wholly on peer completion: drive_claim's gone requires claim.peers.iter().all(|p| p.done.is_some()) and the slot cleanup lives only inside that branch (:1027-1033). A cancelled rank that never answers leaves peers_left non-empty, so neither the window nor its staging slot is released. No test covers a never-done peer and the description does not say which path (rank link loss → on_peer_done?) guarantees release. Fix: document the guaranteeing path and add a never-done-peer test.
Finding 7 — helios/src/server/runtime.rs:2117-2121 — Minor. Five fields are cleared on every park, but RestoreWait::defer restarts its budget from self.started.get_or_insert(now) (runtime.rs:223-236), so each park resets the "restore must beat recompute" wait consumed at :2855-2861; a repeatedly preempted request restarts rather than exhausting it. blocked is cleared unconditionally. The test worker_park_clears_stale_pool_plan_and_lookup (phase_tests.rs:6851-6928) covers only pool_plan/pool_lookup and asserts withdrawn == 1 on a FakeStore, relying on LookupTicket drop for withdrawal rather than an explicit call. The underlying mechanism is real: begin_pool_lookup bails when pool_plan.is_some() && !retry (runtime.rs:2755-2757) and otherwise clones the old PrefixHistory via refresh_admission_plan (helios/src/scheduler.rs:1592-1598 (not opened)).
Finding 8 — net.rs:159-167 — Note. The duplicate-slot detector added to Staging::release is debug_assert! only, compiled out in release; only the behavioural forget_window fix applies there, so a double push into free from any other caller would still alias &mut [u8] in release builds.
Finding 9 — store_bridge.rs:599-602 — Note. Ok(PutAnswer::Accept(accept)) stores accept.parent/first_page with no correlation to rec.transfer, so the disjoint-transfer-ID invariant rests entirely on the store echoing correctly; a mis-routed answer now silently corrupts window geometry. Add an echoed-id assertion if PutAnswer::Accept carries the id.
No lock/contention, memory-amplification, extra-copy, or Unix/Windows parity defect is introduced by the production hunks; store traffic still goes through store_call/block_in_place (store_bridge.rs:89-114) unchanged in kind. Per-block model-thread sweep cost is the only metric-adjacent shift (Finding 3).
3. Architecture, contracts & charter compliance
No wire-protocol, proto (selene/proto/selene.proto untouched), on-disk format, config default, dependency, or public-API change — the "No model core re-export or wire protocol change" claim is accurate. StoreCommand is an internal manager↔store channel keyed on (connection, transfer), and the fix conforms to the store's own contract (store.rs:615 (not opened), 4818-4823, 4893-4896, 3477-3507), so it is required, not cosmetic. Everything lands inside the charter goal "store prefix-cache checkpoints in host memory and share them across Flare instances via Selene"; no per-model branch or new flag. Two charter tensions: (a) the claims.rs guard and the Index::expired change are skips rather than root-cause repairs (#397); (b) the multi-process/DMA fixes are exactly the "supported matrix" interactions the charter asks to be checked per layout, and only CPU unit tests were run (see §4). docs/prefix-cache-offload.md:623-631 deletes the sentence "A fresh former interior node left as a leaf by pressure eviction can delay a sweep by up to one max age" — accurate after the filter change, but it is a limitation removal, not a wording edit, and the doc does not note the increased scan cost.
4. Tests & claim accuracy
Finding 10 — Major. "All 11 added regression tests verify each invariant directly on production entry points" is not accurate. The transfer-ID collision test builds its claim through a new #[cfg(test)] constructor (claims.rs:283-291) with a seeded ManagerGet { transfer: 0 } and calls manager_get directly; linked_multi_process_put_stores_record_relative_window_first_page hand-builds PutRec { accepted: None, … } and feeds PutAnswer/Grant, so neither exercises put_begin/claim_begin or wire framing. Two tests can pass vacuously: corrupt_ancestor_v3_page_is_quarantined_and_replaceable begins let Some(directory) = test_directory(...) else { return; } (composite.rs:6000-6003), and async_cpu_codec_refill_wakes_deferred_child is #[cfg(feature = "codec")] (memory.rs:6258-6259) while the reported command passes only --features test-support. The tests do assert the real invariants (differing allocated ids; put_cancel cancelling only the put's), but the description should say which paths are bypassed. Fix: re-run with --features test-support,codec, make the composite test fail rather than return when no directory is available, and qualify the "production entry points" sentence.
Beyond that: no live GPU/RDMA/multi-process validation and no reproduction artifact for the "100% CPU hang" or the "cross-tenant KV leak" (self-identified, no issue number), while the competing #609–#612 report SM120/GB10 qualification. The single --test client failure is declared pre-existing (10 ms Core::tick() metrics refresh, "stream: 2 windows", 1/5 isolated reruns) with no issue filed.
Open questions
- Is the transient-error quarantine (Finding 1) intended? No test or comment covers an EIO/ENOENT open failure, and the description frames the arm as "corrupt disk pages" only.
- Is reducing
WindowReleasedvalidation for channel claims acceptable defence-in-depth given the message arrives over untrusted gRPC (Finding 4)? - Which path releases a window/slot if a cancelled peer never reports done (Finding 6)?
- Merging order versus #609/#610/#612: five of six headline defects are fixed independently, by the maintainer who owns these files, on the same lines; no description or issue thread says which is intended to land, and the overlapping hunks will conflict.
- Whether a re-offered fresh leaf can hold a sweep back beyond one max age (yatesdr's open question on #439) — not answered here, though the new
filterremoves the stop-early mechanism. - #607 patches on top of #496/#497 (merged the same day, same offload intake/restore path); it states only that tests ran at
4f12cae, unlike the competing series which name their rebase.
Not found
No offline/manual expirer for the linked-ancestor fix, no epoch or generation counter on persists (so a late persist can still override an eviction decision), no coalescing for concurrent v1 discards of the same record, and no unclean-close sweep for the pooled staging slots. These were looked for in selene/src/memory.rs, selene/src/composite.rs, selene/src/disk_store.rs and selene/src/shared/index.rs and are absent.