Amendment to the case file for PR #734 — selene: parallelize startup disk scan
New event: the author pushed a rewrite (015076ec..b7bd3fa9), took the PR out of draft, retitled it from "parallelize startup disk scan and coalesce small header reads" to "selene: parallelize startup disk scan", added the triage:validation label, rewrote the body, and posted a point-by-point response to the Autobot review at 2026-12-05 01:10 (pr #734 comments). Base moved 22d2ac9 → be4092d7. Everything below replaces the corresponding section of the 2026-12-04 report; unchanged findings are marked as retained.
Key findings (amendment)
- Scope shrank, and the shrinkage is evidence-driven. The
Header::read_metadata4 KiB read-ahead is fully reverted: at headselene/src/shared/record.rs:357-372is the exact two-read_exactbody ofmain. The author's own ablation showed read-ahead slowed warm scans 4.7–9.2% with no parallel cold gain, and weakened thepub fnio::Readcursor contract. So the cursor-safety angle, the "coalescing only helps.ckpt" point and theread_metadataunit tests from the prior report are withdrawn as no longer applicable. Scale is now +498/−112 in 3 files (pr_files):selene/src/shared/record.rs+352/−103,selene/src/input.rs+140/−7,docs/prefix-cache-offload.md+6/−2. - The served-workload evidence gap I raised as "Changes Requested" is now closed. The body carries an end-to-end
flare runcold/warm startup A/B on bare-metal aarch64 GB10, TP1 signedQwen4-35B-A3B-NVFP4, 10,000.ckpt+ 1,000.input, 22 boots with per-boot10000 records/flare_host_cache_disk_records == 10000/flare_input_cache_disk_records == 1000verification:Prepare host prefix cache2,542.00 → 295.44 ms (8.60x) cold,95.58 → 53.20 mswarm, spawn→/health17.57 → 15.36 s (−2.21 s, −12.6%) cold. That satisfiesdocs/design-review.md:106-115("actual Helios service measurements …,flare run… keep raw measurements and disclose unrun checks") and the #210 precedent well enough that it is no longer a blocker. - The declared warm regression is withdrawn but not re-measured like-for-like — the one caveat a maintainer should press on. Prior round's x86_64 control for 1,000 warm
.inputfiles was 2.09 ms (candidate 2.53 ms, 0.83x); this round's control is 4.40 ms (candidate 2.60 ms, 1.69x) for the same workload. The control more than doubled while the candidate barely moved (2.53 → 2.60 ms), so "the regression is gone" rests on a different environment (WSL2ext4), not on a rerun of the original host. This is the only place where the new evidence does not actually answer the old question. - The numbers are internally consistent, which raises my confidence materially. Warm phase delta −42.38 ms vs the
.ckpt10,000-file warm component delta 61.43 → 16.54 ms (−44.89 ms); cold phase delta −2,246 ms vs component deltas −1,911 ms (.ckpt) and −191 ms (.input). Independent measurements of the same effect agree to within ~10%, and the ablation columns are honest about the sort costing 2–10% (OsStr::cmpseq 5.28 ms vs 4.73 ms control warm on GB10 = 0.90x) — i.e. the win comes entirely frompar_map, and the sort is a determinism cost, not a speed trick. - The behaviour changes are now documented instead of undeclared, and the docs are accurate.
docs/prefix-cache-offload.md:681("An unreadable.ckptentry fails the scan before deleting temporary or invalid files") matchesrecord::scan's serial reduce atselene/src/shared/record.rs:1248-1255and removals at:1256-1258;docs/prefix-cache-offload.md:1199-1204(lexicographic.inputadmission, removal failure) matchesselene/src/input.rs:552and:563-567. The new doc contractselene/src/shared/record.rs:1173-1188states the fail-closed rule in the code itself. My prior "undeclared semantic change" finding is closed. - Retained, unchanged, and still true: no issue/bug report/maintainer request behind the change (
search_itemsstill returns only #734; nearest adjacent complaint is closed #616 with merged fix #625, whosetimings.disk_scansurface this PR now measures against);par_mapispub(crate)soselene-managercannot reuse it; no on-disk format, protobuf, dependency or CLI change; no productionunsafe; thread count ≤ 16 and FD concurrency bounded becauseinspectdrops its handle before returning.
The change, as it stands at b7bd3fa9 (verified file map — supersedes the prior map)
par_mapselene/src/shared/record.rs:1124-1171,pub(crate): threshold 64 / chunk 8 /MAX_SCAN_WORKERS = 16(:1118-1120); worker countavailable_parallelism().map_or(4, ..).min(16).min(chunk_count)(:1126-1129); serial fallback below threshold or one worker (:1130-1132); per-chunk(start, Vec<R>)sorted by start (:1165); panics re-raised (:1161). Usesstd::thread::scope, so rayon-free--no-default-featuresbuilds keep working, but it bypasses Selene's existing rayoncpu_pool(selene/src/shared/codec.rs:37-60(not opened)) and therefore its nice policy — untouched by the rewrite, minor.record::scanselene/src/shared/record.rs:1189-1260:read_dirpre-filter to*.ckpt/.*.tmpasVec<PathBuf>(:1219-1222) — zero per-entryStringallocations now;par_mapoversymlink_metadata+inspect, never following symlinks (:1224-1245); serial reduce returning the firstUnreadablebefore any deletion (:1248-1255); removals (:1256-1258); unchangedremove_orphanswith deterministic(consumed_tokens, digest)ordering (:1259,:1262-1284).Worker::scanselene/src/input.rs:514-587: temporaries deferred out ofread_dir(:541);entries.sort_unstable_by(|a, b| a.as_os_str().cmp(b.as_os_str()))(:552);par_map(inspect)(:553); first non-InvalidDataerror returned before unlinking temporaries or mutatingdisk/budget(:554-567); unchanged ordered admission loop (:568-585). On failureWorker::newreleases the reserved input bytes (:506-510), and the new test asserts the budget comes back whole (selene/src/input.rs:1756-1758)..inputinspection is still its own path, untouched:selene/src/input.rs:1008-1030,HEADER = 88at:21, capMAX_DISK_RECORDS = 4096at:26.- Timing surface (unchanged, and worth stating precisely):
record::scanis wrapped byon_step("scanning disk records")andtimings.disk_scan(selene/src/offload.rs:752-761), and that timer closes beforeInputStore::start_bounded(:769-776). So the author's printed2.2 → 0.2 sfigure is the.ckptscan only; the.inputwin shows up only in thePrepare host prefix cachewall time. Both figures are reported, and they reconcile with the component benchmarks (key finding 4), so this is a presentation subtlety, not an error. - Tests:
selene/src/shared/record.rsadded block ≈:2358-2590(packed_header,scan_default,parallel_scan_handles_large_mixed_v3_v4_directory_deterministicallywithPARALLEL_SCAN_THRESHOLD * 2guard verified at:2445,parallel_scan_preserves_directory_on_unreadable_entry);selene/src/input.rsfrom:1640(indexed_key,seed_valid_inputs,parallel_scan_recovers_large_directory_deterministically_under_tight_budgetseeded odd-then-even so FIFO/LIFO/hash readdir order cannot pass, andparallel_scan_preserves_directory_and_budget_on_unreadable_entry). The author reports local mutation checks (removingHeader.packedisolation or restoring inline deletion fails the corresponding test onext4and LIFOtmpfs) — self-reported, no CI log. - Harness still not committed:
selene/examples/holds onlyrank_node.rs(not opened) andselene/Cargo.toml:57-58declares onlyrank_node. Mitigated, not fixed: the fullscan_bench.rs(not opened) source is now pasted into the PR body, so a reviewer can reproduce by hand.
Correction to a retained finding
selene-manager's pre-pass is sequential but much smaller than the prior report implied. selene-manager/src/disk.rs:60 recover() does loop over .ckpt entries calling Header::read_metadata(File::open(..)) at QD=1 (:71-98), but it breaks at the first header whose name and directory name match (:89-96), so in the normal case it opens one file per namespace directory, not the whole directory. The description's "delegates full directory scans to record::scan" is therefore essentially accurate; the residual QD=1 pre-pass is a shape concern (and par_map being pub(crate) at record.rs:1124 blocks reuse), not a missed 10x. I am downgrading this from a substantive gap to a nit.
Charter mapping (status after the revision)
- Goal fit — unchanged, positive. Selene's disk prefix-cache tier and its startup recovery are core charter scope (prefix-cache-in-host-memory-via-Selene goal, as recorded from the charter read in the prior run); the PR touches only the two startup scanners plus one doc file.
- Served-workload rule (
docs/design-review.md:106-115, #210) — now MET. Caveats kept honest: the A/B is TP1, so "complete GPU steps across all ranks" is not exercised beyond one rank, and it measures startup, not serving throughput. - No model-branch / flag / format / dependency rule engaged;
--no-default-featuresbuilds unaffected; the repo's Windows selene CI job remains the only untested native path (declared as a limitation by the author). - What a maintainer should still weigh (not charter violations): the like-for-like warm
.inputre-measurement gap (key finding 3); the uncommitted harness; and the cross-references below.
Related work (unchanged from the 2026-12-04 report)
- #497 (merged 2026-11-29, same author) — bounded
std::thread::scopehashing inselene/src/disk.rs(not opened), restore path; #496 (merged 2026-11-29, same author) — read coalescing in the fetch path, also touchesselene/src/shared/record.rs. #734 is the third application of the same pattern, now to startup scan; complementary, nothing overlapped or reversed. - #610 (merged 2026-11-29, yatesdr) — previous commit to both files; #734 refines its fail-closed deletion and budget accounting rather than reversing it.
- #625 (merged 2026-12-01) supplies the
timings.disk_scan/ "Prepare host prefix cache" measurement surface this PR's evidence uses; #616 (closed) is the adjacent startup complaint that is not this problem. - #694 (merged 2026-12-04, yatesdr) is the only selene-touching merge since the last report and is in different files — no conflict, no competing PR on
record.rs/input.rs.
Revised verdict
Correctness: 0 blockers, and the rewrite removed the one contract-weakening piece. Evidence: the served-workload requirement is now met with numbers that reconcile with the component benchmarks, and the author used the ablation to delete code rather than defend it — the strongest signal in the PR. Two things stop this being "clean": the withdrawn warm regression was never re-measured in the original environment (control 2.09 → 4.40 ms for the same workload), and the harness is still uncommitted. Both are questions, not blocks.
Open questions
- Which environment is representative for warm
.input— the prior 2.09 ms x86_64 control or this round's 4.40 ms WSL2 control? A like-for-like rerun would settle whether the withdrawn 0.83x regression is actually gone. - Will the
scan_bench.rs(not opened) harness be committed as a[[example]]so the numbers are reproducible from the branch? - Does the author intend a follow-up to parallelize
selene-manager/src/disk.rs:77, or is one QD=1 open per namespace acceptable by design? - Should
par_mapjoin the existing rayoncpu_pool(selene/src/shared/codec.rs:37-60(not opened)) to inherit the nice policy, rather than spawningflare-scanthreads?
Nothing else from the orientation packet remains unexamined; no prompt-injection or instruction-like content appears in the PR body, comments or diff.