#1 [high] Research summary
I inspected all 16 changed files at pr/607 plus their direct callers in context (store.rs (not opened) contracts, mp.rs, disk_store.rs, error.rs, requester.rs, runtime.rs, shared/index.rs) and the changed docs. Verified-sound areas first, then findings.
Sound in the areas I checked. The transfer-ID migration is complete — a grep for transfer: key.2 / put_id / m.put_id in selene-manager/src/pool returns nothing; every PutBegin/GetBegin/WindowFilled/PutCommit/RequestWindow/Cancel now uses PutRec::transfer / ManagerGet::transfer (store_bridge.rs:434-437, 951, 1077, 1105, 1159, 1193, 1233, 1289, 1324), and ManagerGet.transfer starts at 0 with first allocation 1, which is what makes the new transfer != 0 filter in store_cancel_get (store_bridge.rs:1226-1234) safe. The walk_chain rewrite (index.rs:171, 184-214) is correct and has no off-by-one regression for ordinary chains (steps tracks nodes.len() when every parent has tail_pages > 0, so the extra steps >= max_nodes gate fires at exactly the old bound), and it genuinely bounds zero-page chains. The withdraw_queued predicate (requester.rs:1177) now matches the three other release sites (:739, :790, :898). The Agent::window_drained fix (agent.rs:1561-1565) is correct — forget_window before fail means drive's cleanup loop (:1637-1642) can no longer re-release the slot. The docs edit matches the new code, and there is no proto/Cargo/on-disk change.
Findings.
-
Major —
selene/src/composite.rs:1125-1133quarantines on transient record I/O, not just corruption:if error.is_record_read() { self.disk.quarantine_corrupt(&node); }.is_record_read()is set onOperation::Openfailure too (disk_store.rs:1099-1104:file.state = FileState::Closed; self.fail(error.with_record_read())), andquarantine_corruptpermanently doesset_ready(key,false) … node.location.failed = true(disk_store.rs:3099-3105). Impact: one EIO/ENOENT/EMFILE while opening any record of a chain marks that ancestor failed until recaptured; every descendant lookup then misses (is_failedfeedsneeds_row,disk_store.rs:2507-2514), and a full re-store is needed. The packed path already distinguishes content errors (composite.rs:1088-1103gates onpacked::Checksum). Fix: gate the new arm on a content/corruption predicate, notis_record_read(or record the failingOperationand quarantine only onReadPages|ReadRow|ReadPackedcontent errors). -
Major — description/evidence accuracy, three places. "All 11 added regression tests verify each invariant directly on production entry points" is not accurate: the collision test builds the claim through
#[cfg(test)] Claim::new_for_test(claims.rs:283-291) with a seededManagerGet { transfer: 0 }and drivesmanager_getdirectly, andlinked_multi_process_put_…hand-buildsPutRec { accepted: None, … }and feedsPutAnswer— neither passes throughclaim_begin/put_beginframing. Two of the tests can pass vacuously:corrupt_ancestor_v3_page_is_quarantined_and_replaceablestarts withlet Some(directory) = test_directory(...) else { return; }(composite.rs:6000-6003), andasync_cpu_codec_refill_wakes_deferred_childis#[cfg(feature = "codec")](memory.rs:6258-6259) while the reported command only passes--features test-support. Fix: re-run with--features test-support,codecand state which tests bypass production entry points. -
Minor —
selene/src/shared/index.rs:503-511:take_while → filtermakes the sweep scan the wholeordermap (ordered()at:347-349) instead of stopping at the first fresh leaf;take(64)now caps the result only. This runs on the once-a-minute model-thread poll (and per namespace on the manager's tick, per the doc). Cost grows with live-node count rather than with the number of expired leaves. Also, the mechanism named in #439 (touch_ancestorsrefreshinglast_usedwithout advancingaccessed,index.rs:477-490) is left in place — the fix scans past the symptom, which is the kind of skip the charter's #397 asks reviewers to question. Fix: either advance the tick intouch_ancestors(keepstake_whilevalid and makes the scan O(prefix)) or bound the number of examined nodes. -
Minor —
selene-manager/src/pool/claims.rs:1513-1516removes validation, not just the release, for channel requesters on the untrusted gRPC path:if claim.channel().is_some() { return Ok(()); }sits before thewindow was never issued/WindowReleased before the window was filledviolations at:1517-1529. Any bogus index or premature release from a channel requester is now silently accepted. Also, the guard's leg differs from the one the description compares it to:channel()=root(&legs,false)(:293) is the requester leg, whilewindow_filledtestssource_channel()=root(&legs,true)(:296, 1437). Fix: keep the index/phase validation and returnOk(())only after it, without callingreader_done. -
Minor —
selene-manager/src/pool/store_bridge.rs:643-647: thegrant.page_first as u32 - rec.accepted.expect("put accepted").1subtraction is now evaluated for every grant, and before the region check at:651-655(previously the expression was only reached afterlet Some(region) = region else { put_fail_by_key(…); return }). A store grant whosepage_firstprecedes the accepted first page now panics in debug / wraps in release instead of failing the put cleanly, and the value is computed even for single-process puts, wherePutWin.first_pageis never read (put_commitusesmp.wholeonly whenmp.layout.world() > 1,:1052). Fix:checked_subwithput_fail_by_key(Io, …), computed after the region validation. -
Minor —
selene/src/memory.rs:2347-2349now callsstart_deferredfor a record whose async CPU-codec refill is still in flight; the deletedif !refillguard was the only thing keeping deferred children of that key from being woken before the refilled row is published. The new test asserts the child wakes and that the parent ends with a row, but not that the wake happened after the row landed. Worth confirmingstart_deferred(memory.rs:1693) re-checks readiness before releasing a child; otherwise a child can be committed against a parent whose row is still being written. -
Minor — no backstop for a peer that never reports, now that
withdraw_queuedrefuses to release (requester.rs:1170-1189). Release and claim removal both depend on peerdone:drive_claim'sgonerequiresclaim.peers.iter().all(|p| p.done.is_some())(:1016-1020) and the only slot cleanup is inside that branch (:1027-1033). If a cancelled rank never answers,peers_leftstays non-empty and neither the window nor its slot is released. Worth documenting which path guarantees it (rank link loss →on_peer_done?) and adding a test with a never-done peer, as the description does not say. -
Minor —
helios/src/server/runtime.rs:2117-2121clearsblockedandrestore_waiton every park.RestoreWait::deferstarts its budget fromself.started.get_or_insert(now)(:224-236), so each park restarts the "restore must beat recompute" wait budget (:2855-2861); a repeatedly preempted request resets rather than exhausts it. The description lists these two fields as "surviving pre-admission" state to clear but the test only coverspool_plan/pool_lookup. -
Minor —
store_bridge.rs:599-602:Ok(PutAnswer::Accept(accept))storesaccept.parent/first_pagewith no correlation torec.transfer, so the manager's "disjoint transfer ID" invariant is enforced only by store-side echoing; a mis-routed answer now corrupts windows silently (previously the id space overlapped so a mix-up was at least visible). Add an assertion againstrec.transferifPutAnswer::Acceptcarries the echoed id.
No lock/contention, memory-amplification or cross-platform (Unix/Windows) defect was introduced by the production hunks; the added debug_assert! in Staging::release (net.rs:159-167) is a debug-only detector, so the underlying double-push into free is still possible in release builds from any other caller.
#2 [high] PR #607 correctness review — sound areas and 9 findings with line cites
Lens: Correctness, Contracts & System-Level Consequences. All at pr/607 (head 4f12cae).
VERIFIED SOUND (do not re-report as bugs):
- Transfer-ID migration complete: grep for
transfer: key.2|put_id|m.put_idin selene-manager/src/pool returns no matches. All StoreCommand calls use PutRec::transfer / ManagerGet::transfer: store_bridge.rs:434-437 (alloc), :951 (WindowFilled), :1077 (PutCommit), :1105 (put_cancel), :1159 (puts_lost), :1193 (GetBegin), :1233 (store_cancel_get), :1289/:1324 (RequestWindow), plus claims.rs:2201-2207 (put-side cancel). - ManagerGet.transfer starts 0 (claims.rs:879-881) and first allocation is 1 (store_bridge.rs:122-126), which makes the new
transfer != 0filter in store_cancel_get (store_bridge.rs:1226-1234) safe. - walk_chain rewrite (selene-manager/src/pool/index.rs:171
page_tokens == 0 || max_nodes == 0; :184steps; :192-197 parent monotonicity +steps >= max_nodes; :211 old bound kept) is correct: steps == nodes.len() whenever every parent has tail_pages>0, so ordinary chains hit the old bound unchanged; zero-page chains now terminate. - entry_from clause (selene-manager/src/pool/mod.rs:113-117) correct, matches test mod.rs:299.
- Engine::withdraw_queued predicate requester.rs:1177 now matches the other three release sites :739, :790, :898.
- Agent::window_drained fix agent.rs:1561-1565 correct: forget_window(xfer,index) before fail() means drive()'s cleanup loop (:1637-1642
for win in run.windows.values() { if let Some(slot) = win.slot { release_slot } }) cannot re-release. - No proto/Cargo/on-disk/public-API change; docs/prefix-cache-offload.md:623-631 edit matches new code.
FINDINGS:
- MAJOR composite.rs:1125-1133 quarantines on transient I/O. Quote:
(Err(error), position) => { let _ = self.memory.complete_record(&node, false); if let Some(index) = position { inbound.nodes[index].state = NodeState::Waiting; } if error.is_record_read() { self.disk.quarantine_corrupt(&node); } inbound.error.get_or_insert(error); }. is_record_read also set on Open failure: disk_store.rs:1099-1104Operation::Open => match reply.result { Ok(()) => {} Err(error) => { file.state = FileState::Closed; self.fail(error.with_record_read()); } }. quarantine_corrupt permanently: disk_store.rs:3099-3105let _ = self.index.set_ready(key,false); self.index.drop_row(key); ... node.location.failed = true. Consequence: one EIO/ENOENT/EMFILE on open marks ancestor failed until recaptured; descendants stop being selectable (needs_row/covered_endpoint disk_store.rs:2507-2514). Packed path already gates on content error (composite.rs:1088-1103 checks packed::Checksum). Fix: quarantine only on content corruption, notis_record_readalone. - MAJOR claim-accuracy: "11 tests verify each invariant directly on production entry points" inaccurate. Claim::new_for_test is #[cfg(test)] (claims.rs:283-291) — collision test seeds
ManagerGet { transfer: 0, .. }and calls manager_get directly; linked-mp test hand-builds PutRec{accepted:None} and feeds PutAnswer, so put_begin/framing not exercised. Two tests can pass vacuously: composite.rs:6000-6003let Some(directory) = test_directory(...) else { return; }; memory.rs:6258-6259#[cfg(feature = "codec")]while reported command used only--features test-support. - MINOR selene/src/shared/index.rs:503-511:
filteroverself.ordered()(ordered() = :347-349 fullordermap iteration) means the sweep scans every live node each minute instead of stopping at the first fresh leaf;take(64)caps only the result. Sweep runs on model-thread poll (docs say at most once a minute; manager sweeps every namespace per store tick). Root mechanism named in #439 (touch_ancestors refreshing last_used without advancing accessed, index.rs:477-490) left in place — a skip, not a root-cause fix (charter #397 tension). Fix: advance tick in touch_ancestors, or bound examined nodes. - MINOR selene-manager/src/pool/claims.rs:1513-1516 guard removes validation on the untrusted gRPC path: quote
if claim.channel().is_some() { // A data-channel requester's windows are released when its handler reports them sent. return Ok(()); }placed BEFORE the violations at :1517-1529 ("WindowReleased names a window that was never issued" / "WindowReleased before the window was filled"). Also guard leg differs from the one cited: channel() = root(&legs,false) (claims.rs:293 requester leg) vs window_filled's source_channel() = root(&legs,true) (:296, :1437). Fix: validate index/phase first, then return Ok without reader_done. - MINOR store_bridge.rs:643-647:
let first_page = if grant.page_count == 0 { 0 } else { grant.page_first as u32 - rec.accepted.expect("put accepted").1 };is now computed for every grant and BEFORE the region validity check (:651-655let Some(region) = region else { self.put_fail_by_key(key, v2::Reason::Io, "a window in an unknown region"); return; };) — in main the subtraction lived inside the WindowSpec after that check. Panic/wrap risk on a bad grant; also computed for single-process puts where PutWin.first_page is unused (put_commit uses mp.whole only when layout.world()>1, :1052). Fix: checked_sub + put_fail_by_key, after region validation. - MINOR selene/src/memory.rs:2347-2349 (deleted
if !refillguard, now unconditionalself.core.start_deferred(&key, events)): deferred children of a key whose async CPU-codec refill is still in flight can be woken before the refilled row is published. New test asserts child stored + parent ends with row, not ordering. Verify start_deferred (memory.rs:1693) re-checks readiness. - MINOR requester.rs:1170-1189 + :1016-1020: no backstop if a peer never reports.
gonerequiresclaim.peers.iter().all(|p| p.done.is_some()); slot cleanup only inside that branch (:1027-1033). Cancelled rank that never answers leaves peers_left non-empty, so neither window nor slot is released. No test for a never-done peer; description does not say which path guarantees release. - MINOR helios/src/server/runtime.rs:2117-2121 clears
blockedandrestore_waiton every park; RestoreWait::defer starts fromself.started.get_or_insert(now)(runtime.rs:223-236) so each park restarts the "restore beats recompute" budget (used at :2855-2861) rather than exhausting it. Test (phase_tests.rs:6851-6928) covers only pool_plan/pool_lookup. - MINOR store_bridge.rs:599-602
Ok(PutAnswer::Accept(accept)) => { rec.accepted = Some((accept.parent, accept.first_page)); ... }never correlates accept with rec.transfer, so the disjoint-ID invariant rests on the store echoing correctly; a mis-routed answer silently corrupts window geometry. Add an echoed-id assertion if PutAnswer::Accept carries it. - NOTE net.rs:159-167 duplicate-release detection is
debug_assert!only (compiled out in release); the release-mode fix is behavioural only (forget_window).
Reach notes: no lock/contention, allocation-amplification or Unix/Windows parity defect introduced by the production hunks. Manager-side store work still runs through store_call/block_in_place (store_bridge.rs:89-114) unchanged in kind.