Contracts, Charter & Verification Gates Audit — PR #734 (selene: parallelize startup disk scan) @ b7bd3fa9
Scope: pr_files = 3 files, +498/−112 — selene/src/shared/record.rs (+352/−103), selene/src/input.rs (+140/−7), docs/prefix-cache-offload.md (+6/−2). Nothing else.
Verdict: No contract or verification gate blockers. All four hard gates pass. This supersedes the 2026-12-04 round's "Major miss (evidence)" on Gate 3 — the author added the served-workload A/B and reverted the read-ahead that the earlier round had flagged, so the prior finding is withdrawn, not repeated.
Gate 1 — Core-format / wire / captured-graph / public contract boundaries: PASS
- No new proto, core-format, wire kind, graph kind, or op family. The diff touches no
*.proto, noignition/*, nohelios/src/core/*, and nodocs/core-format-design.mdsurface (grepfor.ckpt/record directory in that doc returns nothing).docs/design-review.md:22-26(captured-graph op-family owner approval) andAGENTS.md:377are not triggered, so no recorded approval is required. Header::read_metadatais now byte-identical tomain. At head it isselene/src/shared/record.rs:357-373(tworead_exactcalls) and atmainit is:354-370; the only difference is line offset. The 4 KiB read-ahead that the prior round verified for cursor safety is fully reverted, so the prior round's cursor-contract finding, its five caller checks, and the "coalescing helps.ckptonly" caveat are all moot.pub fn read_metadata's signature and semantics are unchanged frommain.par_mapispub(crate)(selene/src/shared/record.rs:1124), soselene-managergains no new public API and cannot reuse it;PARALLEL_SCAN_THRESHOLD/PARALLEL_SCAN_CHUNK/MAX_SCAN_WORKERS(:1118-1120) are private consts.record::scan's public contract is preserved and now stated in the code. Signature unchanged, deterministic reduction retained (remove_orphanssorts by(consumed_tokens, digest)atselene/src/shared/record.rs:1282), symlinks/subdirectories never followed or unlinked (:1219-1237pre-filter +symlink_metadata+!metadata.is_file() -> Absent). The two behaviour changes are documented both in the doc comment (:1185-1188: "fails the scan with an error naming it before deleting temporary or invalid files") and in the normative design doc (docs/prefix-cache-offload.md:681: "An unreadable.ckptentry fails the scan before deleting temporary or invalid files"), matching the code atrecord.rs:1248-1258..inputadmission ordering documented.docs/prefix-cache-offload.md:1199-1204now states the fail-before-removal rule and lexicographic admission order, matchingselene/src/input.rs:552(sort_unstable_by(|a,b| a.as_os_str().cmp(b.as_os_str()))),:554-567(error before unlinking temporaries or mutatingdisk/budget), and:568-585(ordered admission).AGENTS.md:233names this doc as required reading for Selene changes — it is updated, not contradicted. The prior round's Minor "documentation-contract drift" is closed.- No on-disk format change:
HEADER_BYTES/packed::REVISION/input.rsHEADER = 88untouched; no protobuf field added or removed, sodocs/design-review.md:116-123(core compatibility, reserved identifiers) is not engaged. - No production
unsafeadded. The onlyunsafeoccurrences in the changed files are pre-existing (record.rs:1066,1386,1397,1446,2279,2288) or new test-onlylibc::geteuid()with// SAFETY:comments (record.rs:2188,:2525,input.rs:1509).
Gate 2 — Vendored upstream dependencies & cross-PR conflicts: PASS
- No file under
helios/native/, nothird_party, no submodule, and no manifest/lockfile edit.libcused by the new test is already declared atselene/Cargo.toml:28— zero new dependencies, consistent with the claim. - No unmerged external recipe/PR dependency. The sibling PRs are already merged (#496, #497) and are not needed — no shared hunks; #610 last touched both files and this PR refines rather than reverses it;
selene-manager/src/disk.rs:101still delegates torecord::scanunchanged. - No competing PR on
record.rs/input.rsin the dossier; the description records a cleangit merge-treeagainstmainbe4092d7.
Gate 3 — Mandatory verification evidence: PASS (prior round's Major miss is now closed)
Served-workload performance evidence (the 2026-12-04 blocker) now exists and is attributable. docs/design-review.md:106-115 (principle 12) requires "equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements… Comparisons against other runtimes must use exported cores with flare run", and docs/core-design.md:1861 lists a Startup row in the minimum measurement set. The PR body now carries exactly that surface: flare run on bare-metal aarch64 GB10 with a signed TP1 Qwen4-35B-A3B-NVFP4 core against a populated --prefix-cache-disk (10,000 .ckpt + 1,000 .input), interleaved n=5/arm with drop_caches for Cold and n=5/arm after warm-up for Warm, control be4092d7 vs candidate b7bd3fa9, medians with min–max: Prepare host prefix cache 2,542.00 → 295.44 ms (8.60x) cold and 95.58 → 53.20 ms warm; timings.disk_scan 2.2 → 0.2 s; spawn→/health 17.57 → 15.36 s (−2.21 s). That is the measurement surface the code already ships — selene/src/offload.rs:752-761 wraps record::scan in on_step("scanning disk records")/timings.disk_scan, with InputStore::start_bounded at :769-776 — so no new instrumentation was required and the claim is measured at the layer it targets.
Supporting, not substituting: the in-process component benchmarks remain, and the sort-vs-par_map ablation the prior round asked for is now present (including a Path::cmp column that isolates component parsing from concurrency). The author also used the ablation to delete code (Header::read_metadata read-ahead reverted), which removes the one contract-weakening piece rather than defending it.
"An aggregate win does not erase a workload regression" (docs/core-design.md:1841) is addressed. The previously declared warm .input regression is no longer declared; the candidate is now faster in the reported arms on both architectures. The control baseline moved between rounds for the same workload (2.09 ms prior x86_64 host vs 4.40 ms this round's WSL2 ext4), which is a measurement-environment question, not a gate violation — the served-workload (Cold + Warm flare run) numbers are the governing comparators and they improve.
Formal/proof gates correctly not engaged.
- TLA+
verification/helios-lifecycle/check.py(not opened) (docs/design-review.md:209-220): the trigger list is admission, fences, generations, cancellation, speculation accounting, cache compaction, snapshot aliases, response buffering/ownership, offload aggregation, readiness, rank coordination. This diff only inspects a cache directory before the store is constructed;selene/src/shard.rs(not opened),helios/src/scheduler*, andoffload.rs's aggregation paths are untouched, andWorker::new's failure compensation (input.rs:506-510) is unchanged. - Kani (
docs/design-review.md:221-225): no completion-vector, prepared-completion-contract, or state-view extent arithmetic changes; no new arithmetic beyond the pre-existing bounded header parse. - Mutation testing (
:226-228): the new ordered-tests provide the fault sensitivity (odd-then-even seeding ininput.rsso removing the sort fails; siblings seeded both before and after the0o000entry in both files so inline deletion fails). - Core-compatibility live replay (
:116-123): not required — no format/protobuf change.
No failing test or CI failure is reported anywhere. Per calibration I do not flag "CI not observable". The body reports --release runs on both architectures with 0 failed: selene 645 (test-support) and 620 (--no-default-features), selene-manager 205, flare 247, flare-cli 228, helios 2,022 + 4 Python, with the native Windows path declared as statically audited only — an honest disclosure, not a failure.
Gate 4 — Material scope / claim contradictions: PASS
- Every claimed artifact exists in the diff.
packed_header(record.rs:2361+),scan_default,parallel_scan_handles_large_mixed_v3_v4_directory_deterministically(:2415, with thePARALLEL_SCAN_THRESHOLD * 2guard),parallel_scan_preserves_directory_on_unreadable_entry(:2529),indexed_key/seed_valid_inputs+parallel_scan_recovers_large_directory_deterministically_under_tight_budgetandparallel_scan_preserves_directory_and_budget_on_unreadable_entry(input.rs:1645onward, budget assertions at:1746-1758). TheDirectoryRAII helper (record.rs:1966-1988) really is used by all six scan tests (:1993, 2156, 2192, 2215, 2415, 2529). - The
record::scanrewrite matches its description: name pre-filter (:1219-1222), parallelsymlink_metadata+inspect(:1224-1245), serial fail-closed reduce (:1248-1255), removals after (:1256-1258), unchangedremove_orphans(:1259). - The
selene-managerclaim is accurate.recover()delegates the full scan torecord::scan(selene-manager/src/disk.rs:101) and its residual pre-passbreaks at the first matching header (:89-96), i.e. normally one open per namespace directory. The earlier "still fully sequential" escalation is correctly dropped. - No unrelated tooling bundle: +498/−112 in three files, of which the test additions are ~419 lines inside the same two modules;
selene/examples/still holds onlyrank_node.rs(not opened).
Info / Nit (not gate violations, no action required to pass)
selene-manager/docs/operating.md:357still reads "Recovery per scope removes leftover.*.tmpfiles… one that cannot be read because of an I/O error fails startup without deletion". After this PR the.tmpremoval is on the success path only, so the sentence is now conditional on a readable directory. It sits next to the correct "fails startup without deletion" clause and the failure end state is still "no deletion", so the contract is not contradicted — but a one-line touch-up there would keep the manager doc in step withdocs/prefix-cache-offload.md:681. Unrelated to CI or TODO.txt bookkeeping.- Benchmark harness is not committed (
selene/examples/holds onlyrank_node.rs(not opened)), but the complete standalonescan_bench.rs(not opened) source plus the exactflare runcommand line are embedded in the PR body, which satisfiesAGENTS.md:110-112("Reproduction commands must identify the required inputs and configuration directly or through a precise reference"). Neither #496 nor #497 committed an example either, so this is consistent precedent rather than a gate miss. - Windows close-before-unlink under concurrency remains statically audited only — disclosed by the author, and structurally sound (each
inspectdrops its handle beforethread::scopeexits; helper threads ≤ 16, so ≤ 16 concurrent FDs). - No issue/bug/maintainer request motivates the change — the nearest adjacent complaint (#616) was fixed by #625, which is also the PR that added the
timings.disk_scansurface this change shrinks. The charter accepts "a measured performance issue" as sufficient, so this is context, not a violation.
Summary table
| Gate | Result |
|---|---|
| 1. Core-format / wire / captured-graph / public contract | Pass — no proto/wire/graph change; read_metadata restored to main's exact two-read_exact body; par_map is pub(crate); both behaviour changes documented in the code and in docs/prefix-cache-offload.md:681,1199-1204. |
| 2. Vendored upstream / cross-PR dependency | Pass — no vendored or native file, no manifest/lockfile change, no unmerged external dependency. |
| 3. Mandatory verification | Pass — served-workload flare run A/B (Cold + Warm, both arches' --release tests, 0 failures) satisfies docs/design-review.md:106-115 / #210 and the Startup row of docs/core-design.md:1852-1862; sort-vs-par_map ablation present; TLA+/Kani/mutation/core-replay gates correctly not triggered; no failing CI or test reported. |
| 4. Material scope / claim contradictions | Pass — every claimed test, helper and doc sentence is present in the diff; the selene-manager delegation claim is accurate; focused 3-file diff. |
Blockers: none. Should fix before merge: none on governance grounds. The residual items are the two reviewable questions from the prior round that are now answered by the author (served-workload evidence: answered; reverted read-ahead: answered), plus the two Info notes above.