Opened by a workflow run, Dec 4, 2026 3:36 PM EST.
Classify draft
Selected: performance, area:selene
Threshold: 65%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 99.5% -
community: 26.9% -
duplicate: 4.2% -
enhancement: 3.3% -
bug: 2.0% -
documentation: 0.2%
Area
- [✓]
area:selene: 98.8% -
area:orbit: 32.1% -
area:preparation: 24.5% -
area:caching: 22.3% -
area:scheduling: 3.7% -
area:memory: 2.0% -
area:api: 1.8% -
area:engram: 1.2% -
area:rocenante: 0.4% -
area:packaging: 0.2% -
area:kernels: 0.1%
Model
-
model:glm-5.3: 0.5% -
model:kimi-k3.1: 0.2% -
model:muse-glimmer: 0.1% -
model:gemma4: 0.1% -
model:inkling-small: 0.0% -
model:deepseek-v4: 0.0% -
model:deepseek-v4.1: 0.0% -
model:qwen3.8-27b: 0.0% -
model:nemotron-3.5-bolt: 0.0% -
model:mimo-v2.6: 0.0% -
model:qwen3.8-flash-next: 0.0% decide malicious: all_clear (100%): No malicious content found
explore
Author: FujitsuPolycom (CONTRIBUTOR; 20 merged / 12 closed PRs in 180 days, mostly helios + docs; selene is not their usual area; Discord "Dooner")
Motivation: Selene's startup recovery reads every cached .ckpt and .input header one file at a time, so a disk cache with thousands of records stalls startup without using NVMe queue depth. This parallelizes that inspection across bounded threads and merges the small header reads into one syscall.
Scale: +554 / −30 lines in 2 files (selene/src/shared/record.rs +424/−23, selene/src/input.rs +130/−7; description says +135/−30 production, +419 test)
Proposal:
Header::read_metadatafills aHEADER_BYTES + 4096stack buffer in oneread()loop, so v3 headers and v4 directories ≤ 4 KiB cost one syscall; larger v4 falls back to aread_exacttail.- New
pub(crate) par_map: scopedflare-scanthreads (≤16, chunk 8, threshold 64 files) with calling-thread participation and serial fallback. record::scancollects candidates, inspects them in parallel (never following symlinks), then reduces serially and deletes.tmp/invalid files only if nothing wasUnreadable.Worker::scansorts.inputpaths, inspects in parallel, and returns non-InvalidDataerrors before unlinking.input.pendingor touchingself.disk/self.budget.- Adds ~419 lines of tests (single-read/EINTR/short-read, deterministic large-directory scans, unreadable-entry preservation). Touches:
selene/src/shared/record.rs— startup record scan, deletion/error semantics, apubAPI whose reader cursor now moves.selene/src/input.rs— prepared-input recovery, deterministic admission order under budget.selene/src/offload.rs(unchanged but affected) — the timedPrepare host prefix cachephase. Related items:- #497 Reduce disk offload restore latency and integrated-memory intake overhead (merged): same author, same bounded-scoped-thread pattern, restore path; complementary.
- #496 Coalesce shared ancestor reads across concurrent Selene disk fetches (merged): same author, read coalescing in the fetch path; also touches
record.rs. - #610 fix(selene): local storage tier, input cache, sharding, codec edge cases (merged): last commit to both changed files; this PR composes with it.
- #625 Avoid THP compaction stalls … and report offload startup timings (merged): added the
scantiming this change shrinks. - #616 v0.4.4 takes over 15 minutes to prepare a 119 GiB host prefix cache (closed): adjacent startup complaint, but about host slab population, not the record scan.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/734
Autobot comments: Undeclared behaviour:
.tmp/.input.pending/invalid-file deletion is deferred to a second pass, so a mid-scanUnreadableerror now leaves garbage that the old code removed; and.inputadmission under a tightDiskBudgetis now lexicographic, changing which records survive (pinned by a new test).selene-manager's identity pre-pass (selene-manager/src/disk.rs:71-98) is still sequential, sincepar_mapispub(crate)— the "delegates scans" claim covers only the final scan. The.inputpath never usesread_metadata, so coalescing helps.ckptonly. Evidence gap: timings are isolated component microbenchmarks, not the served workload the charter requires (#210), and the ~200-line harness is uncommitted (selene/Cargo.tomldeclares onlyrank_node), so numbers cannot be reproduced from the branch. The author honestly declares one regression: warmInputStore::start_boundedon x86_64 goes 2.09 → 2.53 ms (0.83x), cause not ablated. No issue, report or maintainer request motivates it; draft, no CI, no comments or reviews yet. No format, wire, config or dependency changes; cursor read-ahead is cursor-safe for all five current callers (verified).
Value Proposition
Value Proposition — PR #734: selene: parallelize startup disk scan and coalesce small header reads
Charter alignment — good. Startup recovery of the on-disk prefix-cache tier sits squarely inside the charter goal "store prefix-cache checkpoints in host memory and share them across Flare instances via Selene." The diff adds no per-model branch, flag, dependency, unsafe, or on-disk/protobuf format change, so it does not conflict with the runtime ownership rules or rung a non-goal. It is Selene-layer work in Selene's own crate, not a recipe.
Novelty & status — genuinely additive. Not obsolete: nothing on main since 22d2ac9 touches either file. Not superseded: no open PR overlaps. The author's #496/#497 apply the same pattern to fetch/restore paths and are complementary, and #625 only added the timings.disk_scan hook that makes this target visible. This is the first startup-latency PR in the area.
Value vs cost — real, but unproven at the layer that counts. Cold wins are large and operator-visible (9–11x at 10,000 .ckpt on both x86_64 and GB10; 8.4x/9.0x cold for InputStore::start_bounded). Against that: (a) the charter requires served-workload evidence (#210), yet the description concedes these are "isolated component microbenchmarks, not end-to-end flare run startup timings," and the ~200-line harness is uncommitted — the numbers are not reproducible from the branch; (b) no ablation separates read coalescing from parallelism (#497's review asked for exactly that); (c) a declared regression on the warm .input restart path (0.83x, +0.44 ms, cause not isolated); (d) two undeclared semantic changes ride along — lexicographic .input admission changes which records survive a tight DiskBudget/MAX_DISK_RECORDS, and deferred deletion leaves .tmp/invalid files behind on a mid-scan Unreadable error; (e) selene-manager's sequential identity pre-pass is untouched, so the claimed effect is overstated.
Verdict: Worth it with changes. Scoped, compatibility-safe, and consistent with a contributor who got equivalent work merged. To land, it needs: an end-to-end Prepare host prefix cache measurement (or maintainer confirmation that scan is a real bottleneck, at what record counts); the harness committed per AGENTS.md; an ablation isolating coalescing vs par_map and resolving the warm .input regression (rayon cpu_pool vs raw scoped threads, entries.sort()); and explicit maintainer sign-off that fail-closed deletion and the new admission ordering are intended behavior rather than performance collateral.
Note: no attempt to redirect the reviewer was found in the PR body or dossier.
Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Classify intake
Selected: triage:review, performance, area:selene
Threshold: 65%
Triage
- [✓]
triage:review: 91.5% -
triage:design-review: 5.2% -
triage:validation: 3.1% -
none: 0.1% -
triage:investigate: 0.1% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 98.4% -
community: 46.9% -
enhancement: 2.6% -
duplicate: 1.6% -
bug: 0.2% -
documentation: 0.1%
Area
- [✓]
area:selene: 99.6% -
area:caching: 18.2% -
area:preparation: 1.1% -
area:scheduling: 0.4% -
area:api: 0.2% -
area:memory: 0.2% -
area:orbit: 0.2% -
area:engram: 0.1% -
area:kernels: 0.1% -
area:rocenante: 0.0% -
area:packaging: 0.0%
Model
-
model:nemotron-3.5-bolt: 0.2% -
model:kimi-k3.1: 0.2% -
model:qwen3.8-27b: 0.1% -
model:qwen3.8-flash-next: 0.1% -
model:muse-glimmer: 0.1% -
model:glm-5.3: 0.1% -
model:mimo-v2.6: 0.1% -
model:deepseek-v4: 0.0% -
model:deepseek-v4.1: 0.0% -
model:inkling-small: 0.0% -
model:gemma4: 0.0%
Apply Labels (Intake)
Applied: +triage:review
Gates and contracts
Contracts, Charter & Verification Gates Audit — PR #734
selene: parallelize startup disk scan and coalesce small header reads · head 015076e · base main @ 22d2ac9
Changed files (pr_files): selene/src/shared/record.rs (+424/−23), selene/src/input.rs (+130/−7). Nothing else.
Verdict: one Major contract/verification gate miss (served-workload A/B evidence), one Minor documentation-contract drift, no blockers on core-format/wire/graph boundaries, vendored code, or cross-PR dependencies. No failing tests or CI failures are reported anywhere, so no failing-test gate applies.
Gate 1 — Signed core-format / wire / captured-graph / public contract boundaries: PASS
- No new proto, core-format, captured-graph enum, wire kind, or graph operation family. The diff touches only two Selene files. No
*.proto, nohelios/src/core/*, noignition/*, nodocs/core-format-design.md(not opened) surface, nodocs/scheduling-theory.md(not opened) /docs/scheduling-runtime-design.md(not opened) invariant.docs/design-review.md:22-26(op-family approval) andAGENTS.md:377-382(captured-graph contracts) are not triggered, so the "recorded owner approval" requirement does not apply. - No new public API.
par_mapispub(crate)(selene/src/shared/record.rs:1148), soselene-managercannot and does not gain a new dependency on it;pub(crate)visibility is unchanged from the base's absence.PARALLEL_SCAN_THRESHOLD/MAX_SCAN_WORKERS(:1142,:1144) are private consts. Header::read_metadatasignature is unchanged (pub fn read_metadata(mut file: impl io::Read) -> io::Result<Vec<u8>>,record.rs:361). The only contract change is cursor position, and it is documented in the doc comment (record.rs:357-360: "May read ahead past the end of the metadata … callers must not rely on the reader cursor position"). I verified all five production callers are cursor-safe:selene/src/disk.rs:1478— the openedFileis retained, but every later read is positional:read_exact_atatdisk.rs:1464for packed reads,io_uringopcode::Read::…offset(chunk.offset)atdisk.rs:1985-1988, Windowsqueue.submit(slot, file, addr, len, chunk.offset, write)atdisk.rs:2148-2149. No sequentialread/seekon that handle exists (grepforreading.fileyields onlyread_exact_atand theRing::transferpositional paths).selene/src/shard.rs:1202and:1251— handle is a temporary, dropped in the same expression/call.selene-manager/src/disk.rs:77—Header::read_metadata(File::open(entry.path())?), temporary dropped per iteration.selene/src/shared/record.rs:1334(inspect) — handle dropped after the call; only the returned block andsymlink_metadatalength are used.- Test-only callers (
selene-manager/tests/packed.rs:526(not opened),selene/src/offload/sharded/tests.rs:450-451(not opened), newrecord.rs:2474+) are unaffected. The described read-ahead can pull ≤ 4 KiB of the first page segment into a stack buffer and discard it (record.rs:376-379); no current caller observes it.
record::scan's public contract (ordering, return) is preserved. Signature unchanged; the deterministic reduction keepsrecords.sort_by_key((consumed_tokens, digest))(record.rs:1300) andremove_orphansis untouched. Symlink semantics are unchanged and now pinned by test (symlinks aresymlink_metadata-inspected and treated asAbsent,record.rs:1246-1258; the input side usesentry.file_type()atinput.rs:530-535), matchingdocs/prefix-cache-offload.md:677-680("validates magic, version, identity, fingerprint, name … deletes temporary files"). Otherrecord::scanconsumers (selene-manager/tests/client.rs:2357 (not opened),2431,2558,selene-manager/tests/packed.rs:469(not opened),helios/src/offload/gpu_tests.rs(not opened)) call it unchanged.- No on-disk format change: no
Header::encode/packed::REVISION/.inputHEADER = 88change (input.rs:21), noCargo.tomlchange, no dependency added (selene/Cargo.toml:22-51untouched;libcalready present at:28, and the newlibc::geteuid()use is inside a#[cfg(unix)]test with a justified// SAFETY:comment).
Minor (documentation-contract drift, not a blocker): docs/prefix-cache-offload.md:684-690 states that across a restart "partial temporary files are discarded" and :677-680 states the startup scan "deletes temporary files"; :1180-1182 states startup fails if scanning or cleanup cannot establish disk usage. The new fail-closed ordering returns an Unreadable error before deleting .tmp/invalid files (record.rs:1265-1277) and before unlinking .input.pending (input.rs:554-567), so on the failure path temporaries survive where the old code had already deleted them. Because startup aborts on that error (input.rs:506-510; offload.rs:750-761 propagates with ?), the accounting invariant at :1180-1182 still holds and the next startup removes the leftovers — the end state on the success path is identical. Still, the normative prose at :677-690 is the contract this PR changes behavior under, and AGENTS.md:233 names docs/prefix-cache-offload.md as required reading for Selene changes. Recommend one sentence there for the fail-closed ordering (and for the new deterministic .input admission order, which is undocumented anywhere, unlike the checkpoint path at :250).
Gate 2 — Vendored upstream dependencies & cross-PR conflicts: PASS
- No vendored upstream file is modified or forked: nothing under
helios/native/(e.g.roce_proxy.c(not opened)), nothird_party, no submodule, no lockfile, noCargo.toml/uv.lockedit in the diff. - No unmerged external recipe/PR dependency. The change is self-contained on
main@22d2ac9; the description recordsgit merge-tree --write-treeclean and identicalgit archivebases. The sibling PRs #496/#497 are already merged and are not required (no shared hunks — they touchdisk.rs/disk_store.rs(not opened)/shard.rs, this touchesrecord.rs/input.rs). No pin or link to an external branch is relied on.
Gate 3 — Mandatory verification evidence: ONE MAJOR MISS (evidence), otherwise PASS
Major — performance claim lacks an attributable served-workload A/B measurement. The governing rules are explicit:
- Charter, Bring real evidence: "Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210)." docs/design-review.md:106-115(principle 12): "Performance claims require equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements … Keep raw measurements and disclose unrun checks and material limitations. Satisfy every applicable layer of the testing hierarchy."docs/core-design.md:1828-1856(Performance acceptance): the minimum measurement set includes a Startup row, and "Report individual workloads and tail latency; an aggregate win does not erase a workload regression."
The PR measures the right baselines (control 22d2ac97 vs candidate 015076ec, interleaved A-B-B-A, two architectures, cold/warm, medians with p10–p90) — but only at component level: in-process record::scan and InputStore::start_bounded. The description states this plainly: "These are isolated component microbenchmarks, not end-to-end flare run startup timings." No flare run / Prepare host prefix cache measurement exists, on either architecture, in any round.
Why this is a real gate miss rather than pedantry here:
- The claimed benefit is operator-visible startup latency, and the measurement surface already ships and is documented —
selene/src/offload.rs:750-765recordstimings.disk_scanaroundrecord::scanandInputStore::start_boundedinside thePrepare host prefix cachephase, withon_step("scanning disk records"), and it is documented atdocs/prefix-cache-offload.md:1070-1076. Aflare runcold-restart A/B would require no new instrumentation. - The PR itself declares a served-path regression: warm
InputStore::start_boundedon x86_64, 1,000 files,2.09 → 2.53 ms(0.83x, +0.44 ms), with the cause "not separately isolated by ablation", plus bimodal aarch64 warm distributions with overlapping arms.docs/core-design.md:1834-1836("an aggregate win does not erase a workload regression") means a declared regression on a common restart path needs the served measurement to establish whether it is even visible, and an ablation to attribute it. Without either, the regression is unresolved by the PR's own evidence. - The ~200-line harness is not in the diff (
pr_files= 2 files;selene/Cargo.tomldeclares only therank_nodeexample,:57-59). It exists only as pasted prose, which conflicts withAGENTS.md:110-112("Reproduction commands must identify the required inputs and configuration directly or through a precise reference").
Required to clear the gate: one flare run (exported core, local disk tier) restart A/B on main vs head, cold and warm page cache, report Prepare host prefix cache / disk_scan duration — plus an ablation isolating read coalescing from par_map (and, for the warm .input regression, entries.sort() vs thread-scope setup) that #497's review round also asked for.
Not applicable — correctly omitted, not a miss:
- 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 changes none:selene/src/shard.rs(offload aggregation) andhelios/src/*schedulers are untouched; the change is confined to pre-serving startup directory inspection, no ownership/ordering protocol state. Running it is not required. - Kani (
docs/design-review.md:221-225): triggers are completion-vector validation, prepared completion contracts, state-view extent arithmetic, sequential validators over an input domain.record::scanandWorker::scanare none of these; the new arithmetic is bounded buffer indexing insideread_metadata, covered by the new unit test over short reads/EINTR/truncation/invalid directory length. - Mutation testing: triggers "adding or changing safety guards" in the modeled domain; the fail-closed error-before-delete ordering is covered by two new tests (
record.rsparallel_scan_preserves_directory_on_unreadable_entry,input.rsparallel_scan_preserves_directory_and_budget_on_unreadable_entry) that would fail if the ordering were reverted. - GPU/CUDA/VMM and scheduler/worker-lifecycle paths: untouched. No core-format change, so no live export/serve + legacy core replay is required (principle 13 unaffected: no protobuf addition, no wire identifier removal, no reader removal).
No failing test or CI evidence to act on. Nothing in the description, the dossier, or pr_comments reports a failing check. selene-spark-pipeline-style CI is not evidenced either way; per calibration I am not flagging CI absence. The author reports 591 selene tests (test-support) and 566 (--no-default-features) passing on both bare-metal aarch64 GB10 and containerized x86_64, non-root, with both 0o000 unreadable-entry tests and the live-symlink test executing rather than skipping — counts consistent with the new tests visible in the diff. The one admitted hardware gap (no native Windows execution) is disclosed and would be exercised by .github/workflows/native-serving.yml:53-55 (not opened) (windows-2022, cargo test … selene), since the new scan tests are not #[cfg(unix)]-gated except the two permission tests that self-skip via modes_restrict_user().
Gate 4 — Material scope / claim contradictions: PASS
- Every named test exists in the diff.
read_metadata_uses_single_read_for_v3_and_small_v4_and_handles_large_v4(record.rs:2474, with 37-byte short-read on v3 and v4, one-shotEINTR,UnexpectedEofon 4095-byte v3 and truncated v4 directory,InvalidDataon directory length 0 andMAX_DIRECTORY + 1);parallel_scan_handles_large_mixed_v3_v4_directory_deterministically(140 valid + 12.tmp+ 10 truncated + 10 bogus + 6 wrong-identity + 10 orphans; foreign file,nested.ckptsubdirectory, dangling and live symlinks all asserted to survive; second scan asserted equal);parallel_scan_preserves_directory_on_unreadable_entry;input.rsparallel_scan_recovers_large_directory_deterministically_under_tight_budget(140 records,keep_count = 80, budget-tight) andparallel_scan_preserves_directory_and_budget_on_unreadable_entry(80 valid + corrupt +.pending+0o000blocked, assertingcheckpoint_limit/checkpoint_pressureuntouched andreserve_input(limit)still succeeds). No phantom test or benchmark is claimed. - No unrelated tooling bundle. +554/−30 in two files, of which +419 are tests inside the same modules. No new example, binary, script, or docs file is added to the tree.
- Claim-vs-diff consistency. "0 production
unsafe" holds (the onlyunsafeislibc::geteuid()in a#[cfg(unix)]test with a// SAFETY:comment); "0 new dependencies" holds; "+105 net production LOC" is arithmetically consistent with +554 − 419.
Info / Nit (correcting the Discovery Dossier, not a gate violation): Dossier Key finding 7 calls the deferred deletion and the lexicographic .input admission order "undeclared behavioural changes". They are declared in the PR body's Worker::scan and record::scan bullets ("sorts .input paths lexicographically", "rejects non-InvalidData I/O errors before unlinking .input.pending files or mutating self.disk/self.budget", "returns any Unreadable error before deleting .tmp or invalid entries"). They are undeclared in the docs, which is Gate 1's Minor above. Likewise the dossier's "selene-manager is only half covered" is fair as an effect caveat (selene-manager/src/disk.rs:71-98 identity pre-pass stays sequential because par_map is pub(crate)) but is not a contract or scope violation.
Summary
| Gate | Result |
|---|---|
| 1. Core-format / wire / captured-graph / public contract | Pass — no proto/wire/graph change; read_metadata signature unchanged with documented cursor semantics and all 5 callers verified cursor-safe; par_map is pub(crate). Minor doc drift on the fail-closed deletion ordering (docs/prefix-cache-offload.md:677-690, :1180-1182) and the undocumented .input admission order. |
| 2. Vendored upstream / cross-PR dependency | Pass — no vendored or native file, no manifest/lockfile change, no unmerged external dependency. |
| 3. Mandatory verification | Major miss (evidence only) — performance claim has an attributable main-vs-head A/B but only at component level; no served-workload (flare run / Prepare host prefix cache disk_scan) measurement, a declared warm .input regression (0.83x) unresolved, and an uncommitted harness, against charter #210, docs/design-review.md:106-115, docs/core-design.md:1828-1856. TLA+, Kani, mutation, GPU and core-replay gates correctly not applicable. No failing tests/CI reported. |
| 4. Material scope / claim contradictions | Pass — all named tests present, focused diff, no unrelated tooling. |
Blockers: none. Should fix before merge: (1) the end-to-end Prepare host prefix cache / disk_scan A/B on main vs head, cold and warm, on at least one architecture, plus a coalescing-vs-par_map ablation that resolves the warm .input regression; (2) commit or reference the benchmark harness so the numbers are reproducible from the branch; (3) one paragraph in docs/prefix-cache-offload.md covering the fail-closed deletion ordering and the deterministic .input admission order.
Subtraction and simplicity
Subtraction & Simplicity audit — PR #734 (selene: parallelize startup disk scan and coalesce small header reads)
Head 015076e, base 22d2ac9. Diff: selene/src/shared/record.rs +424/−23, selene/src/input.rs +130/−7. No CLI flags, config knobs, dependencies, or compatibility surfaces are added — nothing to subtract there (only libc::geteuid in a #[cfg(unix)] test; selene/Cargo.toml untouched). The production additions are two: a coalesced read and a scoped thread pool. Both are close to minimal. The subtraction opportunities are concentrated in (a) the ~90 LOC of duplicated PackedUnit fixture code the PR adds as tests and (b) three places where the same fail-closed decision is encoded twice / three times.
Ordered by value.
1. High — a ~36-line PackedUnit fixture is duplicated in the same module (test-side, largest single deletion)
selene/src/shared/record.rs:2354-2389, inside the pre-existing test header_eq_implies_same_hash (:2324):
let first_page = a.parent.unwrap().consumed_tokens / a.page_tokens;
let mut units = Vec::new();
for p in 0..a.tail_pages {
for (rank_idx, rank_sizes) in a.ranks.iter().enumerate() {
units.push(PackedUnit {
kind: Kind::Page as i32,
logical_index: first_page + u64::from(p),
...
stored_length: 128,
stored_crc: 11 + p,
original_crc: 22 + p,
The PR adds fn packed_header(...) at selene/src/shared/record.rs:2430-2471 which builds the same unit list from the same Header:
let first_page = parent.map_or(0, |p| p / base.page_tokens);
for offset in 0..u64::from(base.tail_pages) {
for (rank_idx, rank_sizes) in base.ranks.iter().enumerate() {
units.push(PackedUnit { ... stored_length: 256, stored_crc: 11, original_crc: 22, ... });
The two differ only in three constants (stored_length 128 vs 256, stored_crc 11+p vs 11, original_crc 22+p vs 22) and one loop-variable name. a at :2339 is header(&geometry, 512, Some(256)), i.e. exactly packed_header(&geometry, 512, Some(256)); only the stored_length/crc literals affect the hash assertion and none of them are semantically meaningful here. Move packed_header above header_eq_implies_same_hash (it is a module-level test fn, so it already resolves) and replace :2354-2389 with let d = packed_header(&geometry, 512, Some(256)); (the following let mut d = a.clone(); d.packed = ... collapses to two lines). ~34 lines deleted, one fixture maintained instead of two.
2. Medium — par_map's work-stealing + re-sort is more machinery than the crate's existing scoped pool uses, for the same job
selene/src/shared/record.rs:1142-1192, 51 lines and three new module constants (PARALLEL_SCAN_THRESHOLD, PARALLEL_SCAN_CHUNK, MAX_SCAN_WORKERS, :1142-1144) plus a new AtomicUsize/Ordering import (:79-82). The core is:
let start = next.fetch_add(PARALLEL_SCAN_CHUNK, Ordering::Relaxed);
...
out.push((start + offset, f(item)));
...
ordered.sort_unstable_by_key(|(idx, _)| *idx);
ordered.into_iter().map(|(_, value)| value).collect()
The crate already has this exact shape in selene/src/disk.rs:585-649 (hash_pages_scoped) — scoped threads, calling thread participates, failed spawn degrades silently — and it needs no atomics, no index tagging, and no re-sort, because it assigns static chunks up front (buffers.chunks(chunk_len), completed[0] = true at :603-604, inline recompute for unspawned/panicked partitions at :636-648). Static partitioning with items.chunks(len.div_ceil(workers)) would let par_map write straight into Vec<R>-order (chunks/zip over the output slice, or a plain Vec<(usize,R)>-free Vec<R> built by extending each chunk in order), deleting the AtomicUsize import, the (start + offset, ...) tagging, and both sort_unstable_by_key and the final .into_iter().map(|(_, value)| value).collect() (two full extra passes and two extra allocations of items.len() elements). Note also :1147's doc phrase "preserving the input order with zero unsafe" — zero unsafe is a claim, not a contract; Ordering::Relaxed + the sort is doing the actual work, and disk.rs proves order preservation does not require atomics.
Order preservation itself is load-bearing and must be kept: both callers zip results back by index (record.rs:1266, input.rs:568).
Why not rayon: selene/Cargo.toml:16 makes rayon optional (codec = ["dep:rayon", ...]), and the PR explicitly claims --no-default-features --lib passes, so rayon::par_iter is genuinely unavailable here. That decision is correct; the implementation of the replacement is what can shrink.
3. Medium — the fail-closed rule is encoded two different ways in the two callers
record.rs uses an explicit state enum:
// selene/src/shared/record.rs:1305-1313
enum Inspection {
Record(Scanned),
/// The file vanished while the scan ran.
Absent,
/// The file's name or contents fail a record check; the scan deletes it.
Invalid,
/// The file could not be opened or read; the scan fails and keeps it.
Unreadable(Error),
}
input.rs re-derives the same distinction inline, with index/swap_remove ceremony:
// selene/src/input.rs:553-561
let mut inspected = super::record::par_map(&entries, |path| inspect(path));
if let Some(pos) = inspected.iter().position(|result| {
matches!(result, Err(error) if error.kind() != std::io::ErrorKind::InvalidData)
}) {
return Err(failure(
"read prepared-input record",
&entries[pos],
inspected.swap_remove(pos).unwrap_err(),
));
}
and then has to re-establish the invariant it just relied on in a second loop: for (path, result) in entries.into_iter().zip(inspected) (:568). Cheapest fix, −2 lines and one invariant removed: build let mut pairs: Vec<_> = entries.into_iter().zip(inspected).collect(); once after par_map, then let (path, result) = pairs.swap_remove(pos); and for (path, result) in pairs — the &entries[pos] / inspected.swap_remove(pos) index-correspondence assumption disappears. The larger (optional) version is a shared helper since input.rs:553 already reaches across modules into super::record::par_map; but the small version is the one worth doing in this PR.
4. Low-medium — dead third tuple field in record::scan's candidate list
selene/src/shared/record.rs:1239-1243 and :1259-1261:
let is_tmp = name.starts_with('.') && name.ends_with(".tmp");
if !is_tmp && !name.ends_with(SUFFIX) { continue; }
candidates.push((entry.path(), name.to_owned(), is_tmp));
...
if *is_tmp { return Inspection::Invalid; }
is_tmp is a pure function of name, which is also carried in the same tuple and is available inside the closure (which already does). The reduction ignores it entirely: for ((path, _, _), outcome) in candidates.into_iter().zip(outcomes) (:1266). Delete the field and recompute name.starts_with('.') && name.ends_with(".tmp") at the single use site — or better, note that name.ends_with(SUFFIX) is false for anything ending .tmp, so the is_tmp check could move into the prefilter as "not (tmp or .ckpt) → skip" and the closure's branch disappears.
5. Low — six copies of the same temp-directory boilerplate in the test module
Identical std::env::temp_dir().join(format!("flare-record-...-{}-{:?}", std::process::id(), std::thread::current().id())) + let _ = fs::remove_dir_all(&directory) + crate::testing::directory_lock(&directory) + trailing drop(lock); fs::remove_dir_all(&directory).unwrap(); at selene/src/shared/record.rs:1986, :2156, :2205, :2236, :2569 (added by this PR — parallel_scan_handles_large_mixed_v3_v4_directory_deterministically), :2697 (added — parallel_scan_preserves_directory_on_unreadable_entry). Two of the six are new. A fn scan_fixture(name: &str) -> (DirectoryLock, PathBuf) helper would pay for itself at two uses and shrink the two new tests by ~10 lines each. (selene/src/input.rs already has struct Directory(PathBuf) at :1123 with a Drop — that is the pattern; record.rs's tests just don't have it.) The cleanup is also not panic-safe in any of the six copies, while input.rs:1123's is.
6. Low — the 88-byte input record size is written out nine times
selene/src/input.rs:884-886 (production Worker::write), :985 (parse), and tests :1237-1239, :1292-1294, :1580-1582, :1648-1650 (added), :1702-1704 (added):
let bytes = HEADER as u64
+ record.metadata.len() as u64
+ record.payload.as_ref().map_or(0, |p| p.len() as u64);
PreparedInputRecord::bytes() exists at selene/src/input.rs:35-39 but omits HEADER. A fn disk_bytes(metadata: usize, payload: usize) -> u64 (or HEADER as u64 + record.bytes() - ENTRY_BYTES) collapses all nine; :985's use is the natural home and :884 the natural caller. This is pre-existing rather than introduced, and the two new tests add two more copies, so it is worth fixing as part of "the PR's fixtures".
7. Nit — magic 4096 next to a symbolic HEADER_BYTES
selene/src/shared/record.rs:363: let mut buf = [0u8; HEADER_BYTES + 4096]; where HEADER_BYTES = BLOCK_BYTES as usize and BLOCK_BYTES: u64 = 4096 (selene/src/geometry.rs:22 (not opened)). Coincidental equality, not a real relation; worth a comment or a named const READ_AHEAD: usize = 4096, since :387 (if filled >= total) silently depends on it being ≥ any "typical" v4 directory.
Confirmed lean (no action)
Header::read_metadata(selene/src/shared/record.rs:357-397) is the tightest possible version of what it does: one stack buffer, a short-read-tolerant loop for the fixed header, one fast pathif filled >= total { return Ok(buf[..total].to_vec()); }, oneread_exactfallback usingVec::with_capacity(total)so the slow path does not realloc. 40 lines for two behaviours (v3 fast path, v4 ≤4 KiB fast path) and it replaces 14 lines of two-read_exactcode. No speculative generality, no flags, no branch that cannot be taken.record::scan's two-phase structure (:1223-1277) is the minimum needed for "inspect in parallel, then mutate serially, fail closed": candidates →par_map→ one reduction match → one removal loop → unchangedremove_orphans(:1280). It does not re-implement ordering or re-scan the directory.Worker::scanis the same shape with the budget loop untouched (selene/src/input.rs:568-585); only theis_tmp/Absent/Unreadableencodings above are redundant.- Three module constants for one pool is defensible; the alternative (inlining 64/8/16) would be worse for reviewability.
Total available deletion: ~60 lines, of which ~50 are tests/fixtures (#1, #5, #6) and ~10 are production (#2's atomics+tag+sort passes, #3's index pairing, #4's dead field). The production diff is otherwise lean; the PR's weight sits in test fixtures, and the one structural argument worth making to the author is #2 — the crate already contains a scoped-pool implementation (selene/src/disk.rs:585-649) that gets the same result without atomics or a re-sort.
Code correctness
Deep Code Correctness / Invariants / Hot-Path Audit — PR #734 @ 015076e
Scope check (per the partitioning rule): 2 files, 2 modules of one crate (selene/), 554 changed lines — small & single-subsystem, so no sub-agents were spawned; the audit was done directly with batched reads of the diff, both changed files, and every non-trivial callee.
Verdict
No Blocker, no Major, and no verified correctness or hot-path defect. I traced every non-trivial changed function against its callees and against the four protocol checks and could not construct a failing counterexample. Three genuine but non-defect-level observations follow, each directly verified against source at 015076e.
Protocol check 1 — callee / enum / design-invariant resolution (all resolved, all sound)
Inspection (selene/src/shared/record.rs:1304-1313) has four variants; the new match at record.rs:1266-1273 places every one correctly against inspect's own contract (record.rs:1315-1371):
match outcome {
Inspection::Record(scanned) => records.push(scanned),
Inspection::Invalid => removals.push(path),
Inspection::Unreadable(error) => return Err(error),
Inspection::Absent => {}
}
Inspection::Invalidis only produced by (a)is_tmpafter anis_file()check (record.rs:1259-1261), (b)UnexpectedEof | InvalidDatafromread_metadata(record.rs:1337-1341), (c) a failedHeader::decode(1350-1352), and (d)!belongs_here || !named_by_key || !covers_pages(1361-1363). All four are "contents/name fail a check", so deferring all of them toremovalsand only unlinking after the whole pass (record.rs:1274-1276) is semantically identical to the old inlineremove(&path)?, except that it is now fail-closed.Inspection::Absentcovers bothNotFoundfromsymlink_metadataand!metadata.is_file()(record.rs:1256-1258) — i.e. dangling symlinks, live symlinks andnested.ckpt/directories. The pre-filter at1239-1242keeps the name predicate before the metadata call, and sinceis_tmp/SUFFIXare pure name tests, nothing that previously reachedis_file()can now be deleted. Verified against the test fixtures atrecord.rs:2639-2672(subdirectory + dangling + live symlink must all survive).Header::read_metadataread-ahead: I opened all five production callers and confirmed none depends on the cursor or on over-reading —selene/src/disk.rs:1478(dropsFileintoReading{file}and afterwards only uses positionalread_exact_at,disk.rs:1464, i.e.preadpereos/src/lib.rs:24-46),selene/src/shard.rs:1202and:1251(decode-only;is_v4at1264-1267usesmetadata[..12]only),record.rs:1334(decode-only),selene-manager/src/disk.rs:77(decode-only). The new doc note atrecord.rs:359-360matches reality.
Protocol check 2 — order-of-operations / state transitions (traced, consistent)
Worker::scan (selene/src/input.rs:514-587), full failure-path trace:
entries.sort();
let mut inspected = super::record::par_map(&entries, |path| inspect(path));
if let Some(pos) = inspected.iter().position(|result| {
matches!(result, Err(error) if error.kind() != std::io::ErrorKind::InvalidData)
}) { return Err(failure("read prepared-input record", &entries[pos],
inspected.swap_remove(pos).unwrap_err())); }
par_mappreserves input order (record.rs:1165-1166pushes(start + offset, …),1190sorts by index), soentries[pos]names exactly the file whoseErrwas found;swap_remove(pos)returns the element atpositself, sounwrap_err()is the matched error. Bothentriesandinspectedare still unmodified when the index is taken.- No same-iteration flag hazard: the admission loop (
input.rs:568-585) mutatesself.disk/self.budgetonly on theOk(...) if …arm and never re-readsinspected, so deferring all removals past the whole inspection pass cannot observe stale state. - Budget accounting on the new early return is cleaner, not corrupted: the error now fires before any
reserve_input, soWorker::new's compensation atinput.rs:506-510(release_input(self.disk values sum)) becomes a no-op rather than a partial unwind. Verifiedreserve_input/release_input/checkpoint_pressureatinput.rs:136-159and the new test's assertions (input.rs:1746-1749). record::scan's reduction is still order-independent where it matters:remove_orphans(record.rs:1280-1302) computeskeys/parentsfrom the whole set and iterates to a fixed point, then sorts by(consumed_tokens, digest)at1300, sopar_map's completion order cannot leak into the result ("parents precede children" forDiskStore::new,disk_store.rs:2183-2186, preserved). The parallelinspectbodies touch no shared state: each opens and drops its own handle beforethread::scopeexits, so the Windows close-before-unlink ordering holds.
Protocol check 3 — adversarial small-N / boundary counterexamples (all pass)
par_mapwithitems.len() = 0:0usize.div_ceil(8) == 0→workers = 0→ theworkers <= 1guard (record.rs:1153) takes the serial path;(1..0)is never iterated.len = 63→ serial;len = 64→min(16, 8) = 8;available_parallelism() == 1→ serial. No division by zero, no empty-chunk panic.- Chunk math is exact at the tail (
end = (start + 8).min(items.len()),record.rs:1164) andfetch_addindices are unique, soRelaxed(1160) is sufficient: RMWs on one atomic are totally ordered, the references were published beforescope, and results return throughjoin().spawn_scoped(...).ok()silently degrading to caller-only work is correct because the caller runs the sameworker()loop (1173-1181). read_metadataboundaries (record.rs:361-397): file exactly 4096 (selene/src/disk.rs:3493-3495wide_path) → oneread,filled == HEADER_BYTES, no spurious EOF. 37-byte short-read stream →filledreaches exactly 4096 and the v4 tail path (filled < total) doesextend + resize + read_exact(&mut bytes[filled..]), identical bytes to before.filled > HEADER_BYTESbut< total(partial coalesce) is handled by the same branch.size == 0andsize == MAX_DIRECTORY + 1rejected before allocation, so the "corrupt length never allocates past the bound" invariant (packed::MAX_DIRECTORY = 2 MiB,shared/packed.rs:17) holds — confirmed byselene-manager/tests/packed.rs:524-526(u32::MAXlength).Ok(0)can only occur whilefilled < HEADER_BYTES, soOk(0)after a full header can never be misreported as EOF.
Protocol check 4 — hot-path big-O
par_map and both scans are startup-only (record::scan callers: offload.rs:754, selene-manager/src/disk.rs:101; Worker::scan only from Worker::new, input.rs:506). No per-step/eviction/request path is touched, and remove_orphans's existing O(N)-per-pass HashSet build is unchanged. Nothing in the diff lands on a scheduler/serving hot loop.
Verified observations (non-blocking, cite-and-confirm only)
- Minor — documented invariant drift:
.*.tmpfiles now survive a failed scan.record.rs:1259-1261turns a tmp entry intoInspection::Invalid, andrecord.rs:1270+1274-1276only reachremove()after the entire pass succeeds, so anyInspection::Unreadablereturns at1270first:
Previously (Inspection::Unreadable(error) => return Err(error),main) the tmp file encountered atrecord.rs:1147-1150(old) was unlinked during iteration, before the unreadable file was reached. Consequence: after a permission/device error, the directory keeps both the unreadable.ckptand every leftover.tmp, whereas the module contract atrecord.rs:1194-1208still says the scan "delete[s] temporary files" and narrows the keep-in-place rule to "a.ckptfile the scan cannot open or read", andselene-manager/docs/operating.md:357(not opened) states "Recovery per scope removes leftover.*.tmpfiles". The new test atrecord.rs:2734("temp file must not be deleted on unreadable scan failure") enshrines the new behavior, so this appears deliberate — worth an explicit confirm since it changes a documented recovery guarantee (the next successful scan does clean them up). - Minor —
par_mapmakes two extra full passes/allocation copies.record.rs:1181-1191: results are accumulated asVec<(usize, R)>,sort_unstable_by_key'd, then re-collected into a freshVec<R>. For the PR's 10,000-record geometry this doubles peak retention ofScanned(each with aPathBuf+Header) plus thecandidatesVec<(PathBuf, String, bool)>atrecord.rs:1223-1244, which the sequential version never materialized. Startup-only and a few MB at 10k records, but achunk_index * CHUNK-indexedVec<Option<R>>(or writing into a pre-sizedMaybeUninit/unsafe-free slot vector) would avoid the second pass. - Minor — helper threads do not set priority explicitly.
record::inspector's scoped"flare-scan"threads (record.rs:1175-1177) rely on inheritance of the creator's niceness/scheduling class; the disk path deliberately callsflare_eos::lower_priority(disk.rs:619). Irrelevant for cold startup, but theflare-input-recordsthread sets it (input.rs:295) and its new children do not restate it.
Also verified as non-issues (checked, clean)
Worker::scandeterminism is now better:entries.sort()on prefix-sharedPathBufs (input.rs:552) is byte-lexicographic on the 64-hex-digit name, i.e. ascending key order, so which records surviveMAX_DISK_RECORDS(input.rs:571) and a tightDiskBudgetis host-independent — the oldfs::read_dirorder was arbitrary. Covered byinput.rs:1645-1694.inspectreclassification is exhaustive: the removedErr(error) if error.kind() != InvalidDataarm (input.rs, old560-562) is exactly reproduced by the pre-check atinput.rs:554-562, and_ => fs::remove_file(input.rs:582) still covers bothErr(InvalidData)andOk-but-over-budget, matchingparse'sInvalidDataclassification (input.rs:988-992) andinspect's own (input.rs:1011-1028).- Deferring
.input.pendingremoval toinput.rs:563-567keeps the existing error-precedence test satisfied (input.rs:1544-1569: "remove incomplete prepared-input record" still surfaces first under a read-only directory).
Full report Merge Risk: medium_high (100%): Medium or high merge risk (core runtime/scheduler/GPU/CUDA/VMM/RoCE/multi-rank/contracts/ABI, large multi-crate changes, or Blocker/Major findings) — route to Super Agent.
Final review
Recommendation: Changes Requested
The implementation is clean, well-scoped (+135/-30 production LOC, +419 test LOC across two Selene files, zero production unsafe, zero new dependencies, zero format or wire changes), and passes an independent line-by-line correctness, boundary, and cursor-safety audit with zero code defects. However, as a pure performance PR with no user-reported issue behind it, it does not yet satisfy the Charter's served-workload evidence requirement (#210 / docs/design-review.md:106-115): it provides only isolated component microbenchmarks (no flare run Prepare host prefix cache A/B) and omits an ablation separating read coalescing from par_map or isolating the declared 0.83x (+0.44 ms) warm InputStore::start_bounded regression on x86_64.
Merge Risk
Level: Low
- Implementation safety:
Header::read_metadataread-ahead (HEADER_BYTES + 4096) is verified cursor-safe across all five production callers (selene/src/shared/record.rs:1334,selene/src/disk.rs:1478,selene/src/shard.rs:1202,1251,selene-manager/src/disk.rs:77), none of which usesO_DIRECTor relies on post-call file cursor position;par_mapdrops all file handles insideinspectbeforestd::thread::scopeexits (keeping concurrent FDs<= 16and preserving Windows close-before-unlink safety) and preserves symlink/directory safety. - Compatibility & blast radius: Strictly confined to pre-serving startup directory scans (
record::scanandWorker::scan). On-disk v3/v4.ckptand.inputlayouts, protobuf schemas,remove_orphansordering, and--no-default-featuresbuilds (rayon-free) are preserved. - Remaining risk: Minor warm-path latency regression (
2.09 → 2.53 ms,0.83xonx86_641,000 warm.inputfiles) and unverified end-to-endflare runstartup impact; native Windows execution was audited statically only.
Walkthrough
selene/src/shared/record.rs:357-397(Header::read_metadata): Replaces tworead_exactcalls with a single[0u8; HEADER_BYTES + 4096]stack buffer read loop (handling short reads andEINTR), returning immediately for v3 headers and v4 directories<= 4096bytes and falling back to oneread_exacttail read for larger v4 directories (bounded bypacked::MAX_DIRECTORY = 2 MiB). Documents non-guaranteed reader cursor position.selene/src/shared/record.rs:1142-1192(par_map): Adds apub(crate)bounded parallel mapper (threshold = 64,chunk = 8,workers = available_parallelism().clamp(1, 16)) usingstd::thread::scope, dynamicAtomicUsizechunking, fallible thread spawning (spawn_scoped(...).ok()with calling-thread participation), and index-order restoration.selene/src/shared/record.rs:1209-1278(record::scan): Pre-filters.*.tmp/*.ckptcandidates duringfs::read_dir, runsfs::symlink_metadata(never following symlinks) andinspectviapar_map, and reduces sequentially fail-closed (returning the firstInspection::Unreadablebefore deleting.tmp/invalid entries) before unchangedremove_orphans.selene/src/input.rs:514-587(Worker::scan): Defers.input.pendingremoval out offs::read_dir, sorts.inputpaths lexicographically for deterministic admission underMAX_DISK_RECORDS(4,096) andDiskBudget, inspects headers viarecord::par_map, and aborts on the first non-InvalidDataerror before unlinking temporaries or mutatingself.disk/self.budget.- Unit tests (
selene/src/shared/record.rs:2430-2741,selene/src/input.rs:1644-1750): Adds single-read/large-v4/short-read/EINTR/truncation/invalid-length tests forread_metadata, mixed v3/v4 parallel scan determinism and symlink/foreign-file preservation tests, tight-budget deterministic.inputrecovery, and Unix0o000unreadable-entry fail-closed tests.
Pre-merge Checks
- [PASS] Security / malicious screen: Zero production
unsafe(onlylibc::geteuid()in a#[cfg(unix)]test with// SAFETY:), zero new dependencies, symlinks never followed or unlinked,packed::MAX_DIRECTORYvalidated before allocation, no prompt-injection or suspicious code. - [WARN] Charter & value fit: Squarely within Selene's disk prefix-cache charter goal with no model branches, flags, or format changes, but lacks the served-workload (
flare run) benchmark and regression ablation required for performance PRs (#210,docs/design-review.md:106-115,docs/core-design.md:1834-1836). - [PASS] Related / duplicate / conflict check: Cleanly extends
#496/#497(same author, fetch/restore paths) to startup scan with zero overlapping hunks and zero conflicts againstmain(22d2ac9). - [WARN] Tests & verification evidence: Thorough unit-test coverage added and dual-architecture
A-B-B-Acomponent microbenchmarks reported (7.5x–10.8xcold NVMe.ckpt,8.4x–9.0xcold.input), but no end-to-endflare runmeasurement, no coalescing-vs-par_mapablation, and native Windows remains statically audited only (disclosed).
Blockers
None.
Should Fix
- Provide end-to-end
flare runstartup A/B evidence and an ablation isolating read coalescing vspar_map(and the declared warm.inputregression).- Where: PR performance evidence vs
selene/src/offload.rs:750-776(timings.disk_scan/Prepare host prefix cache),selene/src/shared/record.rs:361-397,1142-1192,selene/src/input.rs:552-553. - Why: The Project Charter (Bring real evidence,
#210) anddocs/design-review.md:106-115require performance PRs to demonstrate an actual improvement overmainon a served Helios workload, anddocs/core-design.md:1834-1836specifies that an aggregate win does not erase a workload regression. Here, the PR explicitly notes that its measurements are isolated component microbenchmarks (even thoughflare runalready timesrecord::scaninPrepare host prefix cacheviatimings.disk_scanatselene/src/offload.rs:750-765, documented atdocs/prefix-cache-offload.md:1070-1076, and runsInputStore::start_boundedimmediately after at:767-776). Furthermore, the PR discloses anx86_64warmInputStore::start_boundedregression (2.09 → 2.53 ms,0.83x,+0.44 mson 1,000.inputfiles — which do not useHeader::read_metadatacoalescing) whose cause (entries.sort()vs spawning up to 15"flare-scan"OS threads atPARALLEL_SCAN_THRESHOLD = 64) is explicitly unisolated, and does not separate the.ckptspeedup attributable toHeader::read_metadatacoalescing vspar_map(mirroring the mechanism attribution requested on#497). - Fix:
- Run a cold- and warm-page-cache
flare runrestart A/B (main22d2ac97vs PR head) against a populated--prefix-cache-diskdirectory on at least one target host (e.g., GB10 orx86_64) and report thePrepare host prefix cachetotal andscan(timings.disk_scan) durations. - Run a brief ablation isolating (a)
Header::read_metadatacoalescing alone vspar_mapon.ckptscans, and (b)entries.sort()vspar_mapthread-spawn overhead on warm.inputscans — and if thread-spawn/contention drives the warm.inputregression, either tune the threshold/worker cap for.inputor confirm it is negligible inflare runstartup.
- Run a cold- and warm-page-cache
- Where: PR performance evidence vs
Subtract / Simplify
- Deduplicate the
PackedUnittest fixture inselene/src/shared/record.rs:2354-2389vs:2430-2471.packed_headeradded at:2430-2471builds the samePackedUnitlist already hand-constructed inheader_eq_implies_same_hash(:2354-2389). Callingpacked_header(&geometry, 512, Some(256))inheader_eq_implies_same_hashremoves ~34 lines of duplicated fixture code.
- Tag and sort per chunk instead of per item in
par_map(selene/src/shared/record.rs:1158-1191).- Each worker processes contiguous
PARALLEL_SCAN_CHUNK(8) slices already in index order. ReturningVec<(usize, Vec<R>)>(or sorting chunks bystartand flattening) cuts sort cardinality by 8x and avoids storing an extrausizeindex alongside everyInspection/Resultelement, while keeping dynamic work-stealing intact.
- Each worker processes contiguous
- Extract a small
Drop-based temp-directory fixture forrecord::scantests (selene/src/shared/record.rs:2569-2741).- Matches the existing
DirectoryRAII pattern inselene/src/input.rs:1123, eliminates repeated temp-dir setup/teardown boilerplate in the two new scan tests (and 4 existing ones), and ensures temp dirs are cleaned up even if an assertion panics.
- Matches the existing
Nits
selene/src/shared/record.rs:363: Name the4096read-ahead size (e.g.,const READ_AHEAD_BYTES: usize = 4096;) instead of an inline literal next toHEADER_BYTES.selene/src/shared/record.rs:1239-1266: Theis_tmp: booltuple element incandidatesis redundant withname(after the pre-filter at:1240,!name.ends_with(SUFFIX)uniquely identifies.tmpentries).docs/prefix-cache-offload.md:677-690/selene/src/shared/record.rs:1206-1208: Optional one-sentence update noting that an unreadable-entry error aborts before deleting.tmp/invalid files and that.inputrecovery admits files in deterministic lexicographic order.
Dropped on verification
- "
selene-manageridentity pre-pass is still a full sequential QD=1 loop" (Discovery Dossier / Value Prop): False.selene-manager/src/disk.rs:71-98executesbreak;at:95on the first valid.ckptfile to obtain(identity, fingerprint, page_tokens, ranks)(O(1) in any healthy namespace) and delegates the full directory scan torecord::scanat:101. - "Deferred deletion and lexicographic
.inputadmission are undeclared behavioral changes / documented invariant violations" (Discovery Dossier / Value Prop / Code Audit): False / over-escalated. Both changes are explicitly declared in the PR description (### What changed). Onmain, whether.tmp/invalid files were removed before anUnreadableerror depended arbitrarily onfs::read_dirorder; aborting before deletion makes failure behavior deterministic and aligns withselene-manager/docs/operating.md:359-360("fails startup without deletion"). Likewise,entries.sort()replaces arbitrary filesystem order with deterministic admission order. - "Use Selene's existing
rayoncpu_pool(selene/src/shared/codec.rs:37-60) instead of scoped threads" (Discovery Dossier / Value Prop): Invalid.rayonis an optional dependency behind thecodecfeature (selene/Cargo.toml:14-16,23);record.rsandinput.rsmust compile and pass under--no-default-features. - "Replace
AtomicUsizework-stealing inpar_mapwith static partitioning likeselene/src/disk.rs:585-649" (Subtraction Audit): Dropped as worse for this workload.hash_pages_scopedhashes uniform 4 MiB RAM buffers; startup scans mix metadata-only.tmpchecks, 4 KiB v3 headers, two-read large v4 directories, and variable cold-NVMe latency, where dynamic chunking balances stragglers and automatically absorbs failed thread spawns without a post-scope recompute pass. - "Scoped
"flare-scan"helper threads do not callflare_eos::lower_priority" (Code Audit): Non-issue. On Unix (eos/src/unix.rs:91-97),SCHED_BATCHandniceare inherited by threads spawned fromflare-input-recordsafterselene/src/input.rs:295; on Windows (eos/src/windows.rs:161(not opened)),lower_priorityis a no-op; andrecord::scanruns during startup before serving threads exist. - "Commit the ~200-line
scan_bench.rs(not opened) harness intoselene/examples/" (Value Prop / Contracts Audit): Dropped. Committing a one-off benchmark example adds permanent repo footprint (neither#496nor#497committed example binaries), and the PR already embeds the complete standalone reproduction source in<details>; the actual evidence gap is theflare runstartup measurement and ablation above. - "Collect
entries.into_iter().zip(inspected)intopairs: Vec<_>inselene/src/input.rs:553-568" (Subtraction Audit): Dropped; adds an unnecessary heap allocation compared to the existing zero-allocationzip, and index correspondence is guaranteed bypar_map. - "CI not observable / Windows not executed on host" (Discovery Dossier): Not escalated; no CI failure is reported, Windows close-before-unlink is statically verified (
Filehandles drop insideinspectbeforescopeexits), and the Windows execution limitation is honestly disclosed.
Classify triage
Selected: triage:validation
Threshold: 65%
Triage
- [✓]
triage:validation: 88.0% -
triage:review: 11.9% -
triage:design-review: 0.1% -
none: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:integration: 0.0% -
triage:superseded: 0.0% Decision to Test: no (99%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.
Apply labels
Applied: +triage:validation, -triage:review decide malicious: all_clear (100%): No malicious content found
explore
Author: FujitsuPolycom (CONTRIBUTOR; Discord "Dooner") Motivation: Selene's startup recovery reads every cached checkpoint header one file at a time, so a large disk prefix cache takes seconds to become ready and slow local storage is left idle. This PR spreads that scan across a bounded thread pool and makes the surviving build deliberately drop the one optimisation its own measurements showed hurt. Scale: +498 / −112 lines in 3 files Proposal:
- Add
par_map(threshold 64, chunk 8, ≤16 scoped threads, order-preserving) inselene/src/shared/record.rs. - Rewrite
record::scanto inspect candidates in parallel and to fail before deleting.tmp/invalid files. - Rewrite
Worker::scanto defer.input.pendingremoval, sort paths byOsStr, and inspect in parallel. - Revert the earlier
Header::read_metadata4 KiB read-ahead tomain's tworead_exactcalls (ablation showed a warm-path loss). - Document the new fail-closed ordering and lexicographic
.inputadmission indocs/prefix-cache-offload.md. Touches: selene/src/shared/record.rs(record scan +par_map, deletion ordering)selene/src/input.rs(input startup scan, admission order)docs/prefix-cache-offload.md(present-state contract) Related items:- #497 selene: reduce disk offload restore latency (merged): same author, same bounded-thread pattern, restore path
- #496 selene: coalesce shared ancestor reads (merged): same author, fetch path, touches
record.rs - #625 offload startup preparation (merged): supplies the
timings.disk_scansurface this PR measures - #610 selene/selene-manager hardening (merged): last commit to both files; refined, not reversed
- #210 served-workload measurement rule (closed): now satisfied by the
flare runA/B Link: https://github.com/NVIDIA/hyperflare-inference/pull/734 Autobot comments: The rewrite answers the earlier review: the served-workload gap is closed by an end-to-endflare runA/B (cold phase 2,542 → 295 ms, 8.60x; spawn→/health−2.21 s), and those numbers reconcile with the component benchmarks (warm phase delta −42 ms vs −45 ms for the.ckptcomponent delta). Still not settled: the withdrawn warm.inputregression was never re-measured in the same environment — the old control was 2.09 ms for 1,000 files and the new one 4.40 ms, while the candidate barely moved (2.53 → 2.60 ms), so "regression gone" rests on WSL2 numbers. The benchmark harness is still not committed (selene/examples/holds onlyrank_node.rs(not opened); source is pasted into the body instead). No issue or bug report asks for this work; the nearest complaint is #616, fixed by #625. No CI run is visible — test counts and mutation checks are self-reported. Theselene-managerpre-pass atdisk.rs:77is still sequential, but it breaks at the first matching header so it is usually one open per namespace directory, smaller than earlier reports implied.
Classify intake
Selected: triage:validation, performance, area:selene
Threshold: 65%
Triage
- [✓]
triage:validation: 67.6% -
triage:review: 31.9% -
triage:design-review: 0.3% -
none: 0.2% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 98.0% -
community: 40.7% -
enhancement: 4.2% -
duplicate: 2.3% -
bug: 0.3% -
documentation: 0.2%
Area
- [✓]
area:selene: 99.8% -
area:caching: 53.1% -
area:memory: 2.0% -
area:preparation: 2.0% -
area:kernels: 0.5% -
area:api: 0.4% -
area:scheduling: 0.3% -
area:engram: 0.1% -
area:orbit: 0.1% -
area:rocenante: 0.1% -
area:packaging: 0.0%
Model
-
model:nemotron-3.5-bolt: 0.3% -
model:kimi-k3.1: 0.2% -
model:qwen3.8-flash-next: 0.1% -
model:qwen3.8-27b: 0.1% -
model:glm-5.3: 0.1% -
model:deepseek-v4.1: 0.1% -
model:mimo-v2.6: 0.0% -
model:muse-glimmer: 0.0% -
model:deepseek-v4: 0.0% -
model:inkling-small: 0.0% -
model:gemma4: 0.0%
Apply Labels (Intake)
No label changes
Gates and contracts
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.
Subtraction and simplicity
Subtraction & Simplicity Lens — PR #734 (selene: parallelize startup disk scan)
Scope read in full: pr_diff (both halves), selene/src/input.rs:495-600, selene/src/shared/record.rs:1105-1400, plus the neighbouring helpers the diff leans on (record::inspect at :1297, record::remove at :1355, input::is_temporary_name at :937, input::file_name at :945, testing.rs:416, shared/codec.rs:37-60, disk.rs:540-683). Verdict up front: the production diff is genuinely lean — 0 new deps, 0 new flags/config/CLI surface, 0 speculative generality, and the rewrite deleted code (Header::read_metadata read-ahead reverted). The reduction pass in record::scan is the textbook shape. I found 2 worth-fixing simplifications and 2 nits; none is a blocker, and the largest is ~10 lines of duplication in the new test helpers.
High-value (worth doing)
1. par_map's Inspection::Unreadable / input Result handling duplicates one "return the first error" rule in two shapes — and the input one has a needless swap_remove
selene/src/input.rs:553-562:
let mut inspected = super::record::par_map(&entries, |path| inspect(path));
if let Some(pos) = inspected.iter().position(|result| {
matches!(result, Err(error) if error.kind() != std::io::ErrorKind::InvalidData)
}) {
return Err(failure(
"read prepared-input record",
&entries[pos],
inspected.swap_remove(pos).unwrap_err(),
));
}
swap_remove + unwrap_err() is used purely to move the error out of inspected so the borrow of entries[pos] ends; but the value is discarded immediately (return Err(...)). Two cheaper forms exist, and one removes an unwrap_err() that is unreachable-by-construction-but-invisible:
if let Some((pos, Err(error))) = inspected.iter().enumerate().find(...)then index&entries[pos]— but that still borrows.- Simplest: zip at the top and scan the zipped iterator, mirroring what
record::scanalready does at:1248-1255:
The error is anfor (path, result) in entries.iter().zip(&inspected) { if let Err(error) = result && error.kind() != std::io::ErrorKind::InvalidData { return Err(failure("read prepared-input record", path, /* clone/move */)); } }io::Error, which is notClone, so the position-based version is defensible — but then the cheaper spelling islet Some(pos) = …position(…) else { … }plusif let Err(error) = &inspected[pos] { return Err(failure(…, &entries[pos], clone_ish)) }. My concrete recommendation: keep the position search, dropswap_remove().unwrap_err()and rebuild the error from a reference instead, i.e. drop themutoninspectedand the.unwrap()-adjacent panic path. Cost: one line either way; benefit: nomutbinding, noswap_removethat silently reorders aVecyou thenzipin order at:568(it doesn't matter today because the function returns, but it is exactly the kind of thing a later edit turns into a real bug).
Why this is worth flagging at all: the same rule is expressed twice in two different idioms — record::scan folds it into the match outcome { Inspection::Unreadable(error) => return Err(error), … } arm at selene/src/shared/record.rs:1252, and input::Worker::scan reimplements it as an out-of-band pre-pass over a Result vec. Making par_map return an Inspection-shaped enum for the input path too (or, better, giving input::inspect the same status-quo Result and letting both call sites reduce identically) would collapse ~8 lines and one mut. Given inspect already exists in both modules with the same name and the same never-InvalidData-is-fatal contract, this is the one place the diff's two halves could share shape.
2. record::scan's candidate name filter re-implements the temp-name predicate with a raw string test; record::temporary_name already owns that invariant
selene/src/shared/record.rs:1219:
if !name.ends_with(SUFFIX) && !(name.starts_with('.') && name.ends_with(".tmp")) {
continue;
}
and then again at :1238-1243:
let Some(name) = path.file_name().and_then(|n| n.to_str()) else {
return Inspection::Absent;
};
if !name.ends_with(SUFFIX) {
return Inspection::Invalid;
}
The second block exists only because the pre-filter dropped the name it already had at :1215-1218 — the pre-filter deliberately avoids per-entry String allocation by pushing entry.path() instead of a (PathBuf, String), so par_map's closure must re-derive the name from the path. That is a defensible trade for 10k files (it is the PR's stated reason), but note the resulting asymmetry: Absent is returned when re-deriving the name fails (:1239), a branch that is unreachable — the path came from entry.path(), whose file_name() is exactly the non-UTF-8-checked name that already passed to_str() at :1216. So the closure carries a dead arm and a comment-free Absent fallback for an impossible state.
Concrete simplification: clone the OsString once per candidate (candidates.push((entry.path(), name.to_owned())) — one small allocation per candidate .ckpt, not per directory entry, and only for entries that will then be opened and read), or push entry.file_name() alongside the path and pass &str into the closure. Either removes :1238-1240 entirely, makes the Invalid test at :1241 the same ends_with(SUFFIX) the pre-filter just proved, and lets the closure skip straight to inspect(path, name, …). Net: −3 lines, one unreachable arm gone, and the filter predicate is stated once rather than twice.
Also in the same block: the temp test name.starts_with('.') && name.ends_with(".tmp") duplicates knowledge that record::temporary_name (:996-998, format!(".{}.tmp", file_name(key))) owns, while input.rs has a stricter, correct is_temporary_name (input.rs:937-944, validates the 64-hex body). record's version will treat any .*.tmp file — e.g. .x.tmp, or a user's .backup.tmp in the cache directory — as an Invalid entry and delete it (:1242 → removals → remove). That behaviour predates this PR (the old inline path did if name.starts_with('.') && name.ends_with(".tmp") { remove(&path)? }), so it is not a regression, but the new Inspection::Invalid doc comment at :1291 now states it as intent: "A temporary .*.tmp file or a .ckpt whose name or contents fail a record check; the scan deletes it." Sharing one predicate (record::is_temporary_name, mirroring input.rs:937) would let record and input agree and shrink the doc. This is the only place a maintainer could reasonably ask "why two temp-name predicates in one crate?"
Nits (mention, do not block)
-
par_mapre-derives thread-count policy thatdisk.rsalready implements.selene/src/shared/record.rs:1118-1132(threshold 64 / chunk 8 /MAX_SCAN_WORKERS = 16/available_parallelism().map_or(4, ..)) is a third variant of the same idea alongsidedisk.rs:159-166,560-567(MAX_HASH_THREADS = 4,parallel_cpus.min(..), with an explicit skip-below-HASH_PARALLEL_MIN_PAGESrule and documented rationale) andshared/codec.rs:41-43((n/2).clamp(1, 24)). Three different ceilings (4 / 16 / 24) and three differentavailable_parallelismfallbacks (map_or(1, ..),map_or(4, ..),map_or(4, ..)) is exactly the kind of drift a sharedfn scan_workers(items: usize) -> usize(or astd::thread::available_parallelismwrapper) prevents. Notedisk.rs's version also lowers priority where non-Linux (lower_priority()atdisk.rs:540, called in the helper at:672;codec.rs:47-54nices to 10 for all workers) —par_map'sflare-scanthreads at:1150-1152inherit the caller's priority with no such call, so the newest helper is the only one of the three that does not hint the scheduler. That is a 3-line fix (or a one-line reuse offlare_eos::lower_priority). -
unsafecounter nit that the PR body overstates. The body says "0 productionunsafe". True for the changed lines, but the tests added by this PR add a fourth hand-rolledgeteuid() == 0skip block atselene/src/shared/record.rs:2524-2528— the crate already hasmodes_restrict_user()atinput.rs:1507-1510and an identical inline block atrecord.rs:2187-2191. Three copies of the sameunsafe { libc::geteuid() } == 0+ skip message. Sincerecord.rs's test module is in the same crate asinput.rs's, onepub(crate) fn modes_restrict_user()(or a hoist into the already-pub(crate)crate::testingmodule,lib.rs:41-42) would delete two of the three. Strictly a nit — but it is the only newunsafein the PR, and the PR body's headline claim invites a reviewer to grep.
Things I checked and confirmed are NOT subtraction candidates
- Test helper
Directoryduplication is unavoidable and correct.record.rs:1966-1989andinput.rs:1123-1140are near-identical temp-dir guards (~20 lines each) in two#[cfg(test)] mod tests. They cannot be shared without apub(crate)test util;crate::testing::test_directory(testing.rs:416-442) is not a fit — it probes forO_DIRECTand returnsOption<PathBuf>, and it is gated ontest-supportwhile these run under plain#[cfg(test)]. Consolidating would mean newpub(crate)surface for ~15 lines saved; not worth it. Therecordversion'sDeref<Target = Path>impl is genuinely load-bearing (it letsdirectory.join(..)keep working after the refactor). InspectiongainingAbsent-from-!is_file()is a real merge, not a widening.record.rs:1289("vanished … or is not a regular file") folds two oldcontinues into one enum arm. Good subtraction; nothing to remove.entries.sort_unstable_by(|a, b| a.as_os_str().cmp(b.as_os_str()))atinput.rs:552is the PR's own ablation-measured choice overPath::cmp; it is not expressive cruft. Note it is not reproducingrecord'sremove_orphansordering — different concern, correctly separate.- No dead branches or speculative generality:
PARALLEL_SCAN_THRESHOLD/_CHUNK/MAX_SCAN_WORKERSare all live and all exercised (the test atrecord.rs:2445,assert!(expected.len() >= PARALLEL_SCAN_THRESHOLD * 2), guards the parallel path deliberately). No new CLI flag, config knob, feature, or dependency anywhere in the 3-file diff (selene/Cargo.tomluntouched, still onlyrank_nodeas an example). packed_header/scan_defaulthelpers (record.rs:2362,:2409) are consolidation, not duplication — they replace ~40 lines of inlinePackedUnitconstruction inheader_eq_implies_same_hashand five copies of the 5-argscan(...)call. Net subtraction already taken.
Bottom line
Production code: lean, and leaner than the code it replaces — I would not ask for a rewrite of par_map or either scan loop. Two concrete asks: (1) make the "first non-InvalidData error aborts the scan" rule read the same way in input.rs:553-562 as it does in record.rs:1252, dropping the swap_remove().unwrap_err(); (2) stop re-deriving file_name() inside par_map's closure (record.rs:1238-1240), which deletes an unreachable Absent arm and states the .ckpt suffix test once. Plus the two nits: three divergent thread-count policies (4/16/24) across disk.rs/record.rs/codec.rs with par_map the only one not hinting scheduler priority, and a third copy of the geteuid skip idiom that contradicts the PR body's "0 production unsafe" framing when a reviewer greps the diff.
Code correctness
Deep Correctness / Invariants / Hot-Path Audit — PR #734 (selene: parallelize startup disk scan)
Partitioning decision: 3 files, +498/−112 (≈610 changed lines), single top-level crate (selene/) plus one doc file. Below both large-PR thresholds (>12 files, >900 LOC across 2+ crates), so no sub-agents were used; audited directly at head b7bd3fa.
Bottom line: I found no verified Blocker or Major code defect. The parallelization preserves record::scan's fail-closed and determinism invariants, the .input scan preserves its budget/index invariants, and both call-site contracts (selene/src/offload.rs:754, selene-manager/src/disk.rs:101) still hold. Two Minor observations are documented below; neither is a correctness break. Details of everything I proved are listed so the "no bug" conclusion is auditable.
Protocol 1 — Callee / enum-variant / design-invariant resolution
Inspection enum re-purposing (record.rs:1287-1295) — the new variant semantics are Record / Absent (vanished or not a regular file) / Invalid (temp file, bad name, bad contents) / Unreadable (metadata or content read failure, fail the scan). I verified every producer/consumer agrees:
record.rs:1225-1244(par_mapclosure) is the only producer.symlink_metadataNotFound→Absent(matches pre-PRcontinue); non-regular →Absent(matches pre-PRif !metadata.is_file() { continue; }at old line 1147); non-.ckptname →Invalidbut this is unreachable dead-by-construction becauserecord.rs:1219already filtered!(ends_with(".ckpt") || (starts_with('.') && ends_with(".tmp"))). A.tmpname therefore always reachesInvalid→ deletion, matching pre-PRremove(&path).inspect(record.rs:1297-1353) returnsInvalidonly forUnexpectedEof/InvalidData/Header::decodefailure/semantic mismatch, andUnreadableotherwise — byte-for-byte the same classification as pre-PR inline code.- Critical invariant checked:
Inspection::Unreadablemust not be reachable in the.tmp-deletion path. Verified:record.rs:1248-1255accumulatesremovalsforInvalidonly, andUnreadablereturnsErrat line 1252 before thefor path in removals { remove(&path)?; }loop at 1256-1258. So a.tmpsibling of an unreadable.ckptnow survives a failed scan — this is the intended, documented fail-closed change (record.rs:1185-1188,docs/prefix-cache-offload.md:681).
Two-predicate guard at record.rs:1219: !name.ends_with(SUFFIX) && !(name.starts_with('.') && name.ends_with(".tmp")). I resolved both against SUFFIX = ".ckpt" (record.rs:94) and temporary_name (record.rs:996: format!(".{}.tmp", file_name(key))) and file_name (record.rs:988). Domains are not disjoint (a temp name is .…ckpt.tmp, so it fails the first predicate but passes the second) — the guard is live in both directions and neither conjunct is dead. No unsatisfiable/dead-code defect.
par_map generic bounds (record.rs:1124): T: Sync, R: Send, F: Fn(&T) -> R + Sync. worker is a Fn closure capturing &f, &next, &items — AtomicUsize is Sync, &[T] is Sync when T: Sync, &F is Sync when F: Sync. Sound for both call sites: &[PathBuf] and R = Inspection / std::io::Result<(InputKey, u64, bool)>, both Send. Ordering::Relaxed on the chunk cursor is sufficient — the cursor only hands out disjoint index ranges and all cross-thread data movement happens through Scope's join. No data race, no chunk lost or duplicated (each fetch_add returns a unique start; start >= len terminates).
workers guard is live, not dead: if items.len() < 64 || workers <= 1 (record.rs:1130). workers = available_parallelism().min(16).min(chunk_count). With len >= 64, chunk_count >= 8, so workers <= 1 iff available_parallelism() == 1 (e.g. a 1-CPU cgroup). That is a genuine single-core fallback, not a dead guard — correctly retained.
is_temporary_name (input.rs:937-944) unchanged semantics: requires exactly 64 lowercase-hex digits + .input.pending. Verified a name like user.pending does not match, so the deferred-removal refactor does not widen what gets unlinked; the existing test restart_bounds_the_disk_index_and_preserves_unrelated_pending_files (input.rs:1336-1349) still asserts this and still passes under the new code path (temporaries are only those returned by is_temporary_name).
Design-doc cross-check (docs/prefix-cache-offload.md:678-682, :1196-1205): the doc's new normative claims match the code exactly — (i) unreadable .ckpt fails before deleting temp/invalid files (record.rs:1252 vs 1256); (ii) startup fails if removing over-budget/corrupt/temp .input files fails (input.rs:563-567 and 582-583 both use ? on remove_file); (iii) .input recovery admits in lexicographic path order (input.rs:552).
Protocol 2 — Order-of-operations & state-transition tracing
record::scan reduction (record.rs:1246-1259): traced read-before-write — records/removals are accumulated first, then a single deletion pass, then remove_orphans(records). No state is mutated before the fail-closed return Err; remove_orphans is only entered with a fully-successful inspection set, so the orphan fixpoint (record.rs:1262-1284) can never delete a descendant of a record whose inspection failed. Pre-PR interleaved deletion could not make that guarantee.
Worker::scan state ordering (input.rs:514-587): traced the exact order — entries/temporaries collected → sort → par_map → error gate (554-562) → temporaries unlinked (563-567) → admission loop mutating self.disk + self.budget.reserve_input (568-585). Confirmed the gate strictly precedes both the .input.pending unlinks and every self.disk.insert / reserve_input call, so an unreadable entry leaves self.disk empty and the budget uncharged. The caller Worker::new (input.rs:506-510) then does budget.release_input(disk.values().map(...).sum()) — with disk empty that is a no-op, so no double-charge and no under-release. This is exactly what the new test parallel_scan_preserves_directory_and_budget_on_unreadable_entry (input.rs:1716-1746) asserts via checkpoint_limit() == limit, checkpoint_pressure() == 0, and budget.reserve_input(limit).
Error-path index alignment (input.rs:554-561) — verified, and this is the subtlest hunk in the PR: inspected.iter().position(...) yields pos in entries order because par_map restores index order; entries[pos] is therefore the same file whose error is reported, and inspected.swap_remove(pos).unwrap_err() extracts that same Err. swap_remove is safe here only because the function returns immediately after — I confirmed there is no subsequent use of inspected on that path. (Also note the borrow checker accepts the overlapping immutable/mutable borrows only under NLL, which holds.) No wrong-file-reported and no index-shift defect.
Same-iteration flag check: the admission guard self.disk.len() < MAX_DISK_RECORDS && self.budget.reserve_input(bytes) (input.rs:570-571) short-circuits so the budget is not charged when the record-count cap rejects — preserving the pre-PR ordering exactly. And within an iteration nothing later in the loop body clears a flag read earlier in that iteration (the loop only inserts/removes).
Handle-close-before-unlink (Windows safety): inspect opens let mut file = fs::File::open(path) (record.rs:1306) and returns Inspection by value, so file is dropped at every return path inside the parallel closure. All remove/remove_file calls happen in the sequential reductions (record.rs:1256-1258, input.rs:563/582) after par_map has returned. Verified for both call sites — no handle is held across an unlink.
Protocol 3 — Adversarial small-N / boundary / sort-order counterexamples
n = 0, 1, 2, 63, 64, 65:chunk_count = len.div_ceil(8).len = 0→chunk_count = 0→workers = min(ap,16,0) = 0→ note: the check isworkers <= 1, which catches0, solen = 0returnsitems.iter().map(f).collect()(empty) rather than spawning zero workers and returning empty via the parallel path. Correct by luck of the<= 1(not== 1) comparison — worth keeping.len = 63→ sequential;len = 64→chunk_count = 8, parallel.len = 65→ chunks[0..8, 8..16, …, 64..65], last chunk of 1 —end = (start + 8).min(65)handles it, andsort_unstable_by_keyrestores order. No off-by-one.- Sort-order counterexample (
.inputadmission):entries.sort_unstable_by(|a, b| a.as_os_str().cmp(b.as_os_str()))(input.rs:552) compares rawOsStrbytes on Unix — a total order on the full path bytes, so it is deterministic and independent of filesystem readdir order (FIFO/tmpfs-LIFO/ext4-hash). Verified there is no cross-platform divergence that matters: on WindowsOsStrcompares UTF-16 code units, still a total order, so admission is deterministic per platform (not identical across platforms, but recovery was never cross-platform-ordered). The new test seeds(1..140).step_by(2).chain((0..140).step_by(2))and thenkeys.sort_unstable()before assertingkeys[..80]survive — that is exactly the counterexample that fails if the sort is removed, so the invariant is genuinely pinned. tail_pages = 0/ row-less edge: for a page-only.ckpt,covers_pages(record.rs:1341-1342) still admits atbytes >= row_segment, andremove_orphansprunes leaves with no children (record.rs:1267-1273) — unchanged by this PR; existing testscan_prunes_page_only_leaves_left_by_an_incomplete_spill_chain(record.rs:2154-2182) still exercises it through the new parallel path.- Unreadable entry with invalid siblings on both sides: the new test seeds 8 invalid + 8
.tmpsiblings before and after the0o000entry (record.rs:2534-2575, and same shape for.inputat input.rs:1716-1726). Sincecandidatesorder is readdir order and deletion now happens only after full reduction, both the pre-PR-inline-order and post-PR-order cases are covered. I verified the fixture is permission-restored (0o600at record.rs:2587, input.rs viaModeGuard::dropat 1500-1505) so the newDirectory::drop'sremove_dir_all(record.rs:1985-1989) can succeed; had it not been, the fixture would leak a temp dir per run. - Fixture ordering hazard checked:
Directoryis declared beforelockin every refactored test (record.rs:1993-2018, 2156-2157, 2192-2193, 2215-2217, 2415-2416, 2529-2530), andDropruns in reverse declaration order, solockreleasesflockbeforeremove_dir_all. Correct. PackedUnitfixture (packed_header, record.rs:2362-2407): I validated this againstpacked::Layout::new(packed.rs:187-292) rather than assuming.stored_length = 256,original_length = page_record_bytes()/row_record_bytes()(8192-ish) →stored_length <= original_length✓ (packed.rs:236);Representation::Packetrequiresprofile.len() == 32andraw_xxh3 == 0✓ (packed.rs:247), both satisfied (vec![0x42; 32],..Default::default()leavesraw_xxh3 = 0); unit ordering dedupprevious.is_some_and(|p| p >= unit.stored_rank)✓ (single rank, ranks descending-free); full rank coverageseen.count_ones() == ranks.len()✓ (one unit per rank);tail as usize <= units.len()✓ (units = tail×ranks + ranks). The refactor from the inline block topacked_header(...).packedinheader_eq_implies_same_hash(record.rs:2322-2331) is semantics-preserving and additionally strengthens the test by no longer perturbingpage_segment/row_segment— verified againstwith_packed(record.rs:317-345) which setsrow_checksum = 0, clearsREPLICATED|REPLICATED_ROW, setsversion = packed::REVISION, and all of which are excluded from neitherPartialEq(record.rs:147-164) norHash(record.rs:168-205). Bothpackedandversion-omission are consistent betweenPartialEqandHash, soassert_eq!(digest(&d), digest(&e))is valid.- Resource/fan-out bounds: ≤ 16 threads and ≤ 16 concurrently open file descriptors per
par_mapcall (MAX_SCAN_WORKERS), because eachinspectopens exactly one file and closes it before returning.record::scanandWorker::scanrun in sequential phases (offload.rs:754 completes beforeInputStore::start_boundedat 769), so no multiplication of 16×16. Nounsafeadded (the onlyunsafeislibc::geteuid()in a#[cfg(unix)]test, record.rs:2524-2525, with a// SAFETY:comment).
Protocol 4 — Hot-path big-O
par_map (record.rs:1124-1171) at N = 10,000: O(N) work, O(N/chunk) chunk vectors, one sort_unstable_by_key over N/8 = 1,250 entries (O((N/8)·log(N/8)), ~2% of the linear work), and a final Vec::with_capacity(N) flattened move-copy of N R values. Acquire is Relaxed on an AtomicUsize touched once per 8 items — negligible contention. No O(N·span), no per-iteration Vec::clone/HashMap::new, no re-scan inside the loop. remove_orphans (record.rs:1262-1284) is unchanged: its HashSet rebuild per orphan-generation is pre-existing and bounded by chain depth.
Minor observations (verified, not correctness breaks)
Minor 1 — record::scan holds three live N-sized path collections at peak (record.rs:1203, 1224, 1246-1255).
let mut candidates = Vec::new(); // path 1: PathBuf per candidate
...
let outcomes = par_map(&candidates, |path| { ... }); // candidates still live
let mut records = Vec::new();
let mut removals = Vec::new();
for (path, outcome) in candidates.into_iter().zip(outcomes) { // outcomes + records + removals live
inspect also allocates a second PathBuf per record via path.to_path_buf() (record.rs:1349) which is then moved into records. Peak is therefore ≈ 2 path copies for survivors plus the Inspection vector, versus 1 path copy on main. At the PR's own 10,000-record scale this is ≈ 10,000 × ~100 B ≈ 1 MB of extra transient allocation — irrelevant next to the 649 GiB working set, but it is a genuine 2–3× increase in scan-index memory that is unnecessary. Fix: have par_map produce the path inside the outcome only for survivors (or take the paths by Vec::into_iter and have inspect return Inspection without path, re-attaching path during the reduction) — the reduction loop already owns path.
Minor 2 — the parallel path is chosen purely by item count, ignoring actual storage queue depth / device (record.rs:1130). record::scan will spawn 16 threads on a network filesystem or a single-spindle device just as readily as on local NVMe; the PR's own motivation is "local NVMe caches" and its warm measurements show a 1.8–3.7× rather than 10× gain. This is an absolute improvement in every measured case (never a regression in the supplied data), so it is not a defect — but the threshold is a fixed 64 items rather than a per-entry cost probe, so on a high-latency remote mount the fan-out could add contention on top of tail-latency-bound I/O. Not a bug; noting only because the constant is unconfigurable.
Explicitly checked and found sound (so this is not a "looked briefly" pass)
Worker::scannon-InvalidDatagate (input.rs:554-556) resolvesstd::io::ErrorKind::InvalidDatacorrectly againstinspect/parse(input.rs:975-999, 1008-1030):parseemitsInvalidDatafor every corrupt-header class (checksum, magic, version, flag,MAX_METADATA/MAX_PAYLOAD, length mismatch) andinspectaddsInvalidDatafor truncation and name/key mismatch; read failures surface as non-InvalidDataand remain fatal. Unchanged frommain.MAX_DISK_RECORDS = 4096/ENTRY_BYTES = 256(input.rs:26-27) still boundindex_bytesregardless of directory size — parallelism does not enlarge the index..ckptand.inputon-disk formats,Headerencode/decode, andHeader::read_metadata(record.rs:358-373) are untouched by this diff (the interim 4 KiB read-ahead was reverted, per the author'sb7bd3fafollow-up).- Callers
selene/src/offload.rs:750-765andselene-manager/src/disk.rs:101-108only consume the orderedVec<Scanned>and theResult, both preserved. - No prompt-injection attempt or instruction-like content in the PR text, comments, or changed files.
Limitations of this audit
I performed a static audit at b7bd3fa and did not execute cargo test (no toolchain in this environment), so the claim "every test passes" rests on my line-by-line reading of the new fixtures against the actual packed::Layout::new, Header PartialEq/Hash, DiskBudget, and ModeGuard definitions rather than on a run. Windows execution remains unverified, as the author discloses, but the close-before-unlink property is structurally guaranteed by inspect's handle lifetime.
Full report Merge Risk: medium_high (95%): Medium or high merge risk (core runtime/scheduler/GPU/CUDA/VMM/RoCE/multi-rank/contracts/ABI, large multi-crate changes, or Blocker/Major findings) — route to Super Agent.
Re-review
Recommendation: Ready To Merge
Every Round 1 requirement and simplification item has been resolved cleanly at b7bd3fa: the author reverted the Header::read_metadata 4 KiB read-ahead after ablation showed it hurt warm scans and weakened the io::Read cursor contract (selene/src/shared/record.rs:358-373 is now byte-identical to main), supplied an attributable end-to-end flare run startup A/B on bare-metal GB10 NVMe (Prepare host prefix cache cold 2,542.00 → 295.44 ms, 8.60x; warm 95.58 → 53.20 ms, 1.80x; spawn-to-/health -2.21 s), ablated .input sorting (OsStr::cmp vs Path::cmp), switched par_map to per-chunk ordering, deduplicated the PackedUnit and Directory RAII test fixtures, and documented the fail-closed and lexicographic-admission contracts in docs/prefix-cache-offload.md. Direct verification of all changed code, callees, state transitions, and boundary cases at b7bd3fa confirms zero correctness defects, zero hot-path regressions, and all governance gates satisfied.
Merge Risk
Level: Low
- Implementation safety: Strictly confined to pre-serving startup directory scans (
selene/src/shared/record.rs::scan,selene/src/input.rsWorker::scan) with zero productionunsafe, zero new dependencies, and bounded concurrency (<= 16"flare-scan"scoped threads and<= 16open FDs per scan). EveryFilehandle opened insideinspectdrops beforestd::thread::scopeexits and before sequentialremove/remove_filecalls, preserving Windows close-before-unlink safety and symlink/subdirectory exclusion. - Compatibility & blast radius:
Header::read_metadata, on-disk v3/v4.ckptand.inputlayouts, protobuf wire schemas,remove_orphans(consumed_tokens, digest)ordering,DiskBudgetunwind invariants (selene/src/input.rs:506-510), and--no-default-features(rayon-free) builds are preserved. Both behavioral refinements (fail-closed error-before-deletion and lexicographic.inputadmission) are documented and pinned by fault-sensitive tests. - Disclosed residual limits: Native Windows execution was audited statically only, and the
x86_64warm.inputablation ran on WSL2ext4(control4.40 msvs Round 1's2.09 mshost baseline) rather than rerunning on the originalx86_64host; the governing served-workload GB10flare runCold + Warm A/B and GB10 warm.input(1.89x) both improve cleanly.
Walkthrough
selene/src/shared/record.rs:358-373(Header::read_metadata): Reverted tomain's exact two-read_exactimplementation, removing the Round 1 read-ahead and restoring the originalio::Readcursor contract.selene/src/shared/record.rs:1118-1171(par_map):pub(crate)bounded parallel mapper (threshold = 64,chunk = 8,workers = available_parallelism().map_or(4, ..).min(16).min(chunk_count)) usingstd::thread::scope, falliblespawn_scoped(...).ok()with calling-thread participation, panic propagation viaresume_unwind, and per-chunk(start, Vec<R>)sorting for exact input-order restoration.selene/src/shared/record.rs:1189-1260(record::scan): Pre-filters*.ckptand.*.tmpcandidate paths (Vec<PathBuf>, zero per-entryStringallocations), inspectsfs::symlink_metadata(never following symlinks) and headers in parallel viapar_map, and reduces sequentially fail-closed (returning the firstInspection::Unreadablebefore deleting.tmp/invalid entries) prior to unchangedremove_orphans.selene/src/input.rs:514-587(Worker::scan): Defers.input.pendingremoval out offs::read_dir, sorts.inputpaths in lexicographic rawOsStrorder (sort_unstable_by(|a, b| a.as_os_str().cmp(b.as_os_str()))), inspects headers viarecord::par_map, and aborts on the first non-InvalidDataerror before unlinking temporaries or mutatingself.disk/self.budget.docs/prefix-cache-offload.md:681,1199-1204: Documents fail-closed startup preservation on unreadable.ckpt/.inputentries, failure on.inputcleanup errors, and lexicographic path-order.inputadmission.- Unit tests (
selene/src/shared/record.rs:1966-1989,2322-2588,selene/src/input.rs:1644-1759): Extracts RAIIDirectory(declared beforelockacross all sixrecord::scantests) and deduplicatedpacked_header/scan_defaulthelpers; adds large mixed v3/v4 parallel scan determinism (including.dir.tmp,.link.tmp, live/dangling symlink survival), non-monotonic odd-then-even tight-budget.inputrecovery, and Unix0o000fail-closed tests with siblings seeded on both sides of the unreadable entry.
Pre-merge Checks
- [PASS] Security / malicious screen: Zero production
unsafe(only test-onlylibc::geteuid()under#[cfg(unix)]with// SAFETY:atselene/src/shared/record.rs:2525), zero new dependencies, symlinks/subdirectories never followed or unlinked, no prompt-injection or suspicious code. - [PASS] Charter & value fit: Squarely within Selene's disk prefix-cache goal with no model branches, flags, or format changes, and now backed by served-workload
flare runA/B evidence (#210,docs/design-review.md:106-115(not opened)). - [PASS] Related / duplicate / conflict check: Cleanly extends
#496/#497to startup recovery atopmain(be4092d7) with zero conflicts;selene-manager/src/disk.rs:101delegates full scans torecord::scanunchanged. - [PASS] Tests & verification evidence: End-to-end
flare runCold/Warm A/B reconciles with component benchmarks and.inputsort ablation; extensive non-root--releasetest runs reported passing onaarch64GB10 andx86_64Linux (native Windows static-audit limitation and WSL2x86_64warm ablation environment honestly disclosed).
Blockers
None.
Should Fix
None.
Subtract / Simplify
None.
Nits
selene-manager/docs/operating.md:357-360: Optional one-line alignment withdocs/prefix-cache-offload.md:681clarifying that leftover.*.tmpremoval occurs only when no entry fails with an I/O error (the existing sentence already states "fails startup without deletion").selene/src/shared/record.rs:2188,2525vsselene/src/input.rs:1507-1515: Optional test-only cleanup to share a singlemodes_restrict_user()helper instead of repeating theunsafe { libc::geteuid() } == 0guard inrecord.rstests.
Dropped on verification
- "Replace
inspected.swap_remove(pos).unwrap_err()inselene/src/input.rs:553-562by rebuilding the error from a reference" (Subtraction Audit): Dropped;std::io::Erroris notClone,super::record::io_failuretakesio::Errorby value, andswap_remove(pos)is followed immediately byreturn Err(...)so the reorderedVecis never observed afterward. Rebuilding from a reference would lose OS error fidelity (raw_os_error). - "Store
name.to_owned()incandidatesinselene/src/shared/record.rs:1222to avoidpath.file_name()re-derivation at:1238-1240, and shareis_temporary_namewithinput.rs" (Subtraction Audit): Dropped; storingVec<PathBuf>deliberately avoids 10,000Stringallocations on large caches while:1238-1240is a safeunwrap-free fallback, and.ckpttemporary names (.{16-hex}-{32-hex}.ckpt.tmp,record.rs:996) have a different format from.inputtemporary names (64-hex.input.pending,input.rs:937), so changing the predicate would be an out-of-scope behavioral change. - "Unify
par_map's thread ceiling withdisk.rs/codec.rsand callflare_eos::lower_priority" (Subtraction Audit / Discovery Dossier): Dropped;disk.rs(MAX_HASH_THREADS = 4) hashes 4 MiB RAM buffers during serving,codec.rs(rayonbehind optionalcodecfeature, unavailable under--no-default-features) runs background KV compression during serving, whereaspar_map(MAX_SCAN_WORKERS = 16) drives NVMe metadata queue depth during pre-serving startup and inherits Unix scheduling priority fromflare-input-records(eos/src/unix.rs:91-97(not opened)). - "Commit
scan_bench.rs(not opened) intoselene/examples/" (Discovery Dossier): Dropped; consistent with#496/#497not committing one-off benchmark examples, and the complete standalone source plusflare runreproduction commands are embedded in the PR body. - "Parallelize
selene-manager/src/disk.rs:71-98pre-pass" (Discovery Dossier): Dropped; verifieddisk.rs:95executesbreak;on the first valid.ckptheader (O(1)per healthy namespace) and delegates the full directory scan torecord::scanat:101. - "Fixed
PARALLEL_SCAN_THRESHOLD = 64ignores remote filesystems /record::scanholds twoPathBufcopies per survivor" (Code Audit Minors 1–2): Dropped as non-actionable; startup scan targets local NVMe caches with bounded<= 16workers and ~1 MB transient path memory at 10,000 records is negligible compared to simplifyinginspect/Scannedownership. - "
geteuid()in test contradicts '0 productionunsafe' claim" (Subtraction Audit): False; the PR explicitly claims0productionunsafe, andrecord.rs:2525is inside#[cfg(test)] #[cfg(unix)]with a// SAFETY:comment.
Classify triage
Selected: triage:validation
Threshold: 65%
Triage
- [✓]
triage:validation: 87.6% -
triage:review: 10.5% -
none: 1.6% -
triage:design-review: 0.2% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: yes (82%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.
Pre Test Report
Hardware test plan — PR #734 (selene: parallelize startup disk scan), head b7bd3fa9
0. What I verified before writing the plan
The review stack is consistent and the PR is at "Ready To Merge / Decision to Test: yes". The changed code and the instrumentation I rely on below are all present at the PR head:
- Change surface:
par_map(selene/src/shared/record.rs:1118-1171, threshold 64, chunk 8,MAX_SCAN_WORKERS = 16,available_parallelism()driven),record::scan(:1189-1260),input::Worker::scan(selene/src/input.rs:514-587).Header::read_metadatais back tomain's tworead_exact(record.rs:358-373) — so there is no read-coalescing claim left to test, only parallelism, fail-closed deletion ordering, and lexicographic.inputadmission. - The timed surface already ships; no instrumentation work is needed:
- phase
"Prepare host prefix cache"is created athelios/src/runtime_core/model.rs:1121and finished at:1167with the store summary as detail; timings.disk_scanwrapsrecord::scanatselene/src/offload.rs:750-765, andInputStore::start_boundedruns immediately after at:767-776(inside the phase, outsidedisk_scan);- the summary renders as
disk <dir> (limit …, <N> records, staged, scan <x.x>s)—selene/src/offload.rs:469-483withelapsed_seconds={:.1}s(:488-490). Note the 0.1 s resolution: warm scans (0.05 s) are below it, so warm must be measured from the phase wall time, not the printedscan. - Non-TTY stderr prints one line per phase ending in
… Prepare host prefix cache. <detail> <elapsed>x.xs(helios/src/startup.rs:414-465), so a boot log is a complete record; the phase prints[ PENDING ]only while running.
- phase
- Counters to prove the scan saw the dataset:
flare_host_cache_disk_recordsandflare_input_cache_disk_records(helios/src/server/metrics.rs:40, 663-670, 1405-1415). - Relevant flags exist as claimed:
--prefix-cache-disk,--prefix-cache-disk-limit,--prefix-cache-memory,--lossless-kv-compression,--prefix-cache-drain-on-shutdown(flare-cli/src/cli.rs:1060-1088),--gpus,--host/--port(:767, 782-792). - Docs rule I am respecting: benchmarks must be
flare runon an exported core, notignition debug-serve(docs/performance-work.md:9-13,docs/design-review.md:106-115).
Two facts that shape the plan:
- This code path never touches a GPU. It runs during startup directory inspection, before serving. GPU time is only spent on model load that both arms pay identically. So the whole mechanism, the two behaviour changes, and the scaling claim can be validated on CPU only — the GPU is needed for exactly one end-to-end confirmation pair.
- The exported core is arm-independent. It is produced by
ignitionfrom the model, and the namespace directory name comes from core/config identity+fingerprint (selene/src/offload.rs:642-657, 645), not from the changed code. Export once and reuse for both arms — this is the single biggest GPU-time saving (two builds, one export, one seeded dataset).
1. Hardware assignment
| Test | Machine | Why | GPU used |
|---|---|---|---|
| T1 correctness suites | cn5 (48 CPUs, x86_64) and cn7 (arm64) | both arches must compile/pass; 0o000 fail-closed tests must actually run (need non-root) |
none |
| T2 component A/B + ablation | cn5 (48 CPUs) | reproduces the .ckpt scaling claim on a many-core x86_64 host, and closes the PR's own disclosed gap: its x86_64 warm .input numbers came from WSL2, never bare metal. Also exercises available_parallelism≫16 → worker cap behavior |
none |
| T2b worker-cap ablation | cn7 via taskset |
cn7 gives a job 10 CPUs, so workers = min(10,16,chunks); taskset -c 0-3 lowers it further. Confirms the 64/8/16 tuning curve the PR claims is a trade-off, and tests the <64 candidates serial path |
none |
T3 end-to-end flare run A/B (cold+warm) |
cn7 (GB10, SM121, integrated memory, NVMe) | the architecture the PR measured (20-core Grace); cn7 is 10 CPUs, so this is also a capacity-sensitivity check: expect a smaller speedup, and a null result here is itself a finding | 1 (of 1) |
T4 (optional) flare run A/B on x86_64 |
cn5, --gpus 0 only |
second arch for the served number; leave GPUs 1-3 free | 1 |
Model choice (smallest first, to bound RAM and export time):
- cn7:
google/gemma-4-E4B-it(smallest) ornvidia/Qwen3.8-27B-NVFP4;gemma-4-26B-A4B-itas a third option.dbg: gemma4is a supported recipe (docs/api.md:961(not opened)). Use an image-capable model (gemma4) if you wantflare_input_cache_disk_records> 0 —InputStoreis only started wheninput_staging != 0(selene/src/offload.rs:767-776), which is text-only zero for pure text cores. - cn5:
nvidia/GLM-5.3-Flash-NVFP4(glm53recipe) with--gpus 0.facebook/dinov2-baseandtimm/vit_base_patch14_dinov2.lvd142mare notflare runtargets — do not use them. - Precondition (confirm before booking time): all model rows list
0 GiB. Verify actual weight bytes on disk (du -shon the hub cache) and thatignition exportcan run in the job's 60 GiB (cn7) / 125 GiB (cn5) RAM. If weights are absent and cannot be fetched in-job, skip T3/T4 and deliver T1/T2 — they cover the change (see §6).
2. Test plan
T1 — Correctness gate (no GPU, ~15 min, run first on both machines)
cargo test --locked --release -p selene --features test-support # expect 645 passed, 0 failed, 0 ignored
cargo test --locked --release -p selene --no-default-features --lib # expect 620 passed (rayon-free path)
cargo test --locked --release -p selene-manager --lib # expect 205 passed, 1 ignored
- Run as non-root and confirm
0 failedand0 ignoredfor the twoselenecommands: the0o000unreadable-entry tests self-skip for root (selene/src/shared/record.rs:2524-2528,selene/src/input.rs:1507-1515), and they are the only tests that actually pin the new fail-closed behaviour. - Pass: zero failures on both arches, no skip. This alone validates determinism, symlink/subdirectory/foreign-file preservation, fail-closed error-before-deletion, and deterministic
.inputadmission under a tight budget.
T2 — Component A/B and ablation (no GPU, ~45 min, cn5)
The PR's selene/examples/scan_bench.rs (not opened) is not in the branch (selene/examples/ holds only rank_node.rs (not opened)), so the engineer must recreate it. Minimal recipe (keep it out of the commit):
- Two clean trees:
git archive be4092d7(control) andgit archive b7bd3fa9(candidate). - In each:
printf '%s' "<source from the PR description <details>>" > selene/examples/scan_bench.rs(not opened),cargo build --locked --release -p selene --example scan_bench, then delete the example. - Datasets (sparse, so 16 GiB scratch is ample — only the 4 KiB header per file occupies blocks):
prep-ckpt <dir> 10000(5,000 v3 + 5,000 v4, ~70 MB logical each),prep-ckpt <dir> 2000,prep-ckpt <dir> 500,prep-input <dir> 1000(4,440 B each). - Interleaved mirrored rounds, medians: Warm = 20 rounds n=20/arm after one warm-up pass per arm. Cold = 10 rounds with
sync; echo 3 | sudo tee /proc/sys/vm/drop_cachesbefore each invocation (checksudo -n truefirst; if not permitted, see §5). - Ablation rows to reproduce (
record::scan,/= control/candidate):- 10,000
.ckpt: 2,122 → 211 ms cold (10.0x), 61 → 17 ms warm (3.7x) - 2,000: 466 → 44 cold, 16 → 5 warm; 500: 119 → 11 cold, 3.3 → 1.7 warm
InputStore::start_bounded1,000 files: cold 214 → 23 ms, warm 4.7 → 2.5 ms.inputsort ablation (3rd/4th columns):OsStr::cmpsequential (nopar_map) vsPath::cmp+par_mapvs candidate, warm. This is the row the x86_64 host has never produced natively.
- 10,000
- Pass: candidate ≥ control on every warm row (no regression), cold speedup ≥ 5x at 10,000 records, and the sequential-sort-only column within ±5% of control (i.e. sorting alone does not explain the win or a loss).
T2b — Worker-cap / threshold ablation (no GPU, 10 min, cn7)
Same harness on cn7 at 10,000 records, warm, three cell counts:
taskset -c 0-0 ./scan_bench scan-ckpt <dir> 10000 # available_parallelism()=1 -> serial path (record.rs:1130)
taskset -c 0-3 ./scan_bench scan-ckpt <dir> 10000 # 4 workers
./scan_bench scan-ckpt <dir> 10000 # 10 workers (job's CPU cap)
Plus a sub-threshold dataset of 40 records: both arms must be within noise (< 64 takes items.iter().map(f)). Record the scaling curve — this is the number the maintainer will need if MAX_SCAN_WORKERS = 16/threshold = 64 is ever revisited, and it tells you what to expect from T3 on a 10-CPU machine (roughly half of the 20-core GB10 gain).
T3 — End-to-end flare run A/B, cold and warm (cn7, 1 GPU)
- Export the core once (ignition is unchanged by this PR):
.venv/bin/ignition export gemma-4-E4B-it --gpus 0(or the 27B). Do not re-export per arm. - Build both binaries from clean archives:
cargo build --locked --release --manifest-path flare-cli/Cargo.toml(not opened) atbe4092d7and atb7bd3fa9. Keep the twoflarebinaries side by side. - Populate the namespace directory with a small prefix cache and drain, to obtain one genuine
.ckptwith the real identity/fingerprint/page_tokens/ranks from that core (PR method): one boot with--prefix-cache-disk <DIR> --prefix-cache-disk-limit 2000G --prefix-cache-drain-on-shutdown=30s, one 400-token chat request to/v1/chat/completions, SIGTERM, then read the header of the written.ckptto learn the namespace directory name and geometry. - Seed 10,000 sparse
.ckptfiles into that same namespace directory using the harvested geometry (5,000 v3 + 5,000 v4, roots survivingremove_orphansneed either a row or a child — the PR used 1,000 ten-step chains), and 1,000.inputfiles of 4,440 B.truncate-style sparse files keep real usage ≈ 10k × 4 KiB. - Verify before trusting the data: first boot must log
10000 recordsin thePrepare host prefix cachedetail and/metricsmust showflare_host_cache_disk_records 10000(+flare_input_cache_disk_records 1000on an image-capable core). If the count is 0, the seeded headers do not match the running core and were deleted as invalid — regenerate (cheap) and recheck; snapshot the filename list first so this is detectable. - Measure, n=5/arm interleaved (A,B,A,B,…), SIGTERM after
/health:Prepare host prefix cacheOK-line elapsed (this is the number that improved 2,542 → 295 ms cold, 95.6 → 53.2 ms warm on 20-core GB10 — use it for warm, sincescanprints at 0.1 s);- the
scan x.xsin the phase detail (= timings.disk_scan); - spawn →
/health200; - record counts from
/metrics; - file count in the namespace directory after shutdown (must be unchanged: 0 deletions).
- Cold arm:
sync; echo 3 | sudo tee /proc/sys/vm/drop_cachesbefore each boot (root required, see §5); otherwise report warm only.
- Pass criteria: warm phase time candidate < control with non-overlapping ranges (or ≥1.3x); cold (if runnable) ≥3x at 10 parallel workers, with the 20-core PBX-style 8.6x as the ceiling NOT the expectation on 10 CPUs; identical record counts and zero deletions in every boot;
spawn→/healthnot worse.
T4 — (optional) x86_64 served confirmation (cn5, --gpus 0)
Repeat T3 steps 5-7 with the same seeded dataset and the two binaries, one GPU only, 3 boots/arm. Purpose: a single-arch served number is enough for the charter, and cn5's 48 CPUs make the parallel path fire at the full 16-worker cap — a different operating point from cn7.
3. Time budget (GPU time is what matters)
| Step | Wall time | GPU |
|---|---|---|
| T1 both machines | 30 min | 0 |
| T2 (+builds) cn5 | 60 min | 0 |
| T2b cn7 | 15 min | 0 |
| core export (once) | 20-40 min | 1 GPU, once |
| T3: 10 warm boots + 6 cold (if allowed) | 25 min (≈90 s/boot) | 1 GPU |
| T4 optional | 15 min | 1 GPU on cn5 |
Total ≈2.5 h wall, of which < 1.5 h touches a GPU, and never more than one GPU at a time.
4. What each result proves
- T1 proves the two semantic refinements (fail-closed error-before-deletion; lexicographic
.inputadmission) and the non-following of symlinks/subdirectories behave as documented indocs/prefix-cache-offload.md:681, 1199-1204on both arches and under--no-default-features. - T2/T2b prove the mechanism: the win is parallelism (not sorting), it scales with cores, it vanishes below 64 candidates, and there is no warm regression on x86_64 bare metal (the PR's warm
.inputregression was previously "fixed" only against WSL2 numbers — that gap is now closed by cn5). - T3/T4 prove the operator-visible claim at the layer it targets (
Prepare host prefix cache), and that the scan does not delete data or reject records.
5. Pitfalls the engineer should not lose time to
- 16 GiB scratch. Do not create 650 GiB of real files: use sparse files (
truncate -s, or write only the 4 KiB header thentruncate). Logical size is whatDiskBudget/--prefix-cache-disk-limitaccounts (selene/src/offload.rs:766), so pass--prefix-cache-disk-limit 2000G— it is a number, not a free-space check, when given explicitly (default would be free/10,offload.rs:658-664). - Cold cache needs root.
drop_cachesis the only clean cold state. Ifsudois unavailable, report warm + freshly-recreated-directory numbers and say so; do not call page-cache-warm numbers "cold". - cn7 gets 10 CPUs, not 20.
available_parallelism()drives the pool (record.rs:1126-1129), so cap your expectation at ~half the quarantine GB10 speedup; a null result there is a real, reportable finding about the worker cap, not a broken build. --prefix-cache-memory 0is tempting but changes what runs. With memory 0 and disk set, intake is still allocated viaheadroom_inner(offload.rs:178-192, 702-746) andInputStoreonly starts wheninput_staging != 0(:767-776). Keep the PR's flags (--lossless-kv-compression cpu, explicit--prefix-cache-disk-limit) so the phase composition matches the published numbers; if the slab does not fit, report the slab/register sub-timings separately and compare only thescansub-timing plus a warm phase delta.- Phase total includes slab population and CUDA registration (
offload.rs:694-749), which this PR does not change. Because those are constant across arms they only add noise — take medians and prefer thescandetail (0.1 s resolution) as the secondary signal, with the wall time as primary. - Deletion risk is real and cheap to contain. Any seeded
.ckptwhose header disagrees with the running core is deleted by design (record.rs:1343-1345). Snapshot the directory listing, use a throwaway directory, and check/metricsbefore running the A/B. - Never measure with
ignition debug-serve(docs/performance-work.md:9-13); it is diagnostic only.
6. If core export cannot be done in-job
Deliver T1 + T2 + T2b only. They fully exercise the changed code paths (both record::scan and Worker::scan, all four Inspection outcomes, budget accounting, determinism) with zero GPU, and they reproduce the mechanism claim that the PR's end-to-end number rests on. In that case, record explicitly that the served-workload number was not re-measured on our hardware, and that the PR's 8.60x cold / 1.80x warm remain author-reported from a 20-core GB10.
Discord Test Request
Discord post (ready to paste)
Recommendation: Test
Medium-high confidence. The change surface is confirmed at head (b7bd3fa) and the PR is "Ready To Merge" with no code defects across two review rounds; what's left is exactly what a hardware run can answer — whether the gain holds at our core count, and whether the file-deletion paths are safe on real seeded data.
Hardware Required
- cn5 (48-core x86_64) and cn7 (10-core arm64 GB10) for the correctness suites and component scan benchmarks — no GPU needed for these.
- cn7 + 1 GPU for the end-to-end
flare runstartup A/B (export the model core once and reuse it for both builds). - ~16 GiB NVMe scratch, a non-root user, and root
drop_cachesfor cold-cache runs (16 GiB is plenty — the seeded cache files are sparse).
Justification
- The PR's only served-workload evidence is author-reported from a 20-core GB10, and the whole claim is "scale with cores." cn7 gives 10 CPUs, so it is a real capacity check — a smaller gain (or null) there is itself the finding.
- Cheap insurance on the risky part: the seeded 10,000-record cache is the only place a bad header silently deletes files, and the fail-closed / no-deletion-before-error guarantees are pinned only by unit tests that self-skip when run as root.
Estimated Time to Complete
~2.5 h wall clock total, under 1.5 h on a GPU, never more than one GPU at once (correctness + benchmarks ~1.75 h CPU-only; core export 20–40 min plus ~25 min of A/B boots).
What I confirmed while reviewing the pre-test report
- PR #734 ("selene: parallelize startup disk scan", @FujitsuPolycom, open, head
b7bd3fa, +498/−112) touches only three files:selene/src/shared/record.rs,selene/src/input.rs,docs/prefix-cache-offload.md.selene/examples/scan_bench.rs(not opened) is not committed — the report is right that the benchmark harness must be recreated, and it is deliberately excluded from the commit. - No read-coalescing left to test — correct. The diff does not touch
Header::read_metadata, and the second review states it was reverted tomain's tworead_exact(record.rs:358-373). So the plan's scope (parallelism, fail-closed deletion ordering, lexicographic.inputadmission) matches the actual change. - Tuning constants match the plan:
PARALLEL_SCAN_THRESHOLD = 64,PARALLEL_SCAN_CHUNK = 8,MAX_SCAN_WORKERS = 16, workers =available_parallelism().map_or(4,..).min(16).min(chunk_count), serial fallback whenitems.len() < 64 || workers <= 1. That validates the plan'staskset -c 0-0serial-path test and the sub-64-file control. - Fail-closed ordering is real in both call sites:
record::scancollectsremovalsand only unlinks them after the reduce loop returns noUnreadable;Worker::scanreturns on the first non-InvalidDataerror before unlinking.input.pendingand before mutatingself.disk/self.budget. Tests for both are the0o000cases that self-skip as root — the plan's non-root requirement is load-bearing. - Author-reported numbers the plan compares against:
Prepare host prefix cache2,542 → 295 ms cold (8.60x) and 95.6 → 53.2 ms warm (1.80x) on 20-core GB10, n=5/arm, 22 boots, 0 deletions; unit tests 645 / 620 / 205 passing on both aarch64 and x86_64, non-root, 0 ignored. - The disclosed gap the plan targets is genuine: the review's "residual limits" section says the x86_64 warm
.inputablation ran on WSL2 ext4, not bare metal — so cn5's native number is new information, not a duplicate.
Caveats the post does not carry (worth watching on the day)
- Precondition, not a finding: all model rows list
0 GiBweights. If the weights can't be fetched andignition exportcan't fit the job's RAM (60 GiB cn7 / 125 GiB cn5), only T1/T2/T2b run — CPU-only, and that still covers every changed line. Say so explicitly in the writeup rather than reporting a served number. flare_input_cache_disk_recordsrequires an image-capable model —InputStoreonly starts wheninput_staging != 0.- Cold cache needs root
drop_caches; without it, report warm + freshly-recreated-directory numbers and never call page-cache-warm data "cold." - Never measure with
ignition debug-serve(diagnostic only perdocs/performance-work.md(not opened)). - Warm dedup resolution: use the phase wall time as primary, not the printed
scan— it renders at 0.1 s, and warm scans are ~0.05 s.
Honest limitations of this pass
I verified the diff, the PR discussion/reviews, and the constants and control flow behind every behaviour claim above. I did not independently re-check the report's peripheral line references — helios/src/runtime_core/model.rs:1121 (not opened)/1167, selene/src/offload.rs:750-765 (not opened)/469-483/488-490, helios/src/server/metrics.rs:40 (not opened),663-670,1405-1415, helios/src/startup.rs:414-465 (not opened), the flare-cli/src/cli.rs (not opened) flag lines, docs/performance-work.md:9-13 (not opened), the cn5/cn7 machine specs, or the "0 GiB" model rows — and I ran out of turns before writing scratchpad notes. Those items are second-hand from the pre-test report and should be spot-checked before the engineer books time; the deliverables above do not depend on them, since the recommendation (Test) rests on the verified change surface plus the author-reported evidence being 20-core-only and WSL2-partial.