Review of PR #79 (lens D — simplicity), head 41f1c76
Verdict: should-fix issues only (no blocking). The blob hard-link fallback in heliopause/src/export/archive.rs:299-313 is the right minimal fix for #54 and should be kept as written. The deletable mass is the second mechanism the PR adds — a directory-publication preflight — which is written once and called from six Rust sites plus one Python hook, probes the same destination twice per export, reinvents a name generator that already exists in the same module, and is covered by two stub tests and a chmod that CI running as root cannot enforce.
Rules this review judges against:
- Charter, How We Work: "Look for the smallest footprint in shared code, or a way to solve it without new code at all."
AGENTS.md:188-193— "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement… Refactoring must directly support the requested behavior."AGENTS.md:194-199— "Require focused, meaningful validation. Tests must exercise the affected behavior or contract; source-text checks and mocks that bypass the behavior cannot establish runtime correctness… Keep each PR focused on one coherent outcome."docs/design-review.md(not opened) principle 15 (reject scope expansion) and principle 16 (prose).
Should fix
1. The preflight is wired into seven call sites; three are dead or test-only and each export probes twice
ignition/preparation/model_core.py:41-42, heliopause/src/export/binding.rs:120-124 + :128, heliopause/src/export/core.rs:640-642, heliopause/src/export/binding.rs:33-36, heliopause/src/export/conversion.rs:316-317, helios/src/core/cache.rs:2804, helios/src/core/cache.rs:3678
All seven sites call the same preflight_directory_publication (grep over the head: model_core.py:42, binding.rs:35, binding.rs:122, core.rs:641, cache.rs:2804, cache.rs:3678, conversion.rs:316). What each one buys:
- Dead in the product.
model_core.py:41-42only runs whennot cache_only and form == 'directory', butserve.py:330callsexport_core(..., path=None)(andserve.py:229viahost_ranks.export(None, …)), so atmodel_core.py:27cache_onlyisTrueand the branch never executes. Onlytests/preparation/test_model_core.py:68/82/136pass a real path. The Python hook (binding.rs:120-124, registered at:128) andtests/preparation/test_directory_preflight.pyexist to test call ordering of code that the product never reaches — the strongest case in the PR for deletion. - Test-only.
cache.rs:3678(Staging::commit_standalone) has no production caller; onlycache.rs:5011/5017/5132call it. - Duplicated inside one export. A cache-backed directory export probes the same destination twice inside
publish_payload:core.rs:641, then — for!cache_only && form == "directory"—core.rs:934root.export_entry→cache.rs:2804, with the whole payload assembly in between.export_capturewithsources == falselikewise probes atbinding.rs:35and again atcore.rs:641, withcapture_rankin between. Both re-runs fall in the exact window where the fail-fast value is smallest. - Redundant with the caller's own check.
core.rs:618-620and:627-632already reject an existing destination (twice each other, even) before:641;cache.rs:2797-2803and:3671-3677do the same before their probe.
Why it matters: charter's "smallest footprint… without new code" and AGENTS.md:188-193's ban on speculative layers — this is a fail-fast convenience layered on top of a publication path that already refuses replacement (rename_noreplace, cache.rs:4265), multiplied by six call sites and a pyfunction. The PR description ("focused helper harness passed 3 tests") discloses neither the preflight nor the four files it lands in.
Fix (smaller shape): keep one probe per publication operation, in the two places that build a tree before publishing — cache.rs:2804 (export_entry) and conversion.rs:316 (unpack_with). Delete model_core.py:41-42, binding.rs:120-124, the registration at binding.rs:128, tests/preparation/test_directory_preflight.py, cache.rs:3678, and core.rs:640-642. If the early abort before GPU capture is genuinely wanted, keep binding.rs:33-36 alone and drop the rest; either way one of {binding.rs:35, core.rs:641} is provably redundant.
2. Two definitions of "no-replace unsupported" that disagree
heliopause/src/export/archive.rs:304-306 and helios/src/core/cache.rs:4239-4240
// archive.rs:304-306
error.raw_os_error().is_some_and(|code| code == libc::EINVAL || code == libc::ENOTSUP)
// cache.rs:4240
matches!(error.raw_os_error(), Some(libc::EINVAL | libc::ENOTSUP | libc::ENOSYS))
The PR's own probe treats ENOSYS as "unsupported" (and its test cache.rs:4539-4567 covers ENOSYS), while the blob fallback it sits beside — the actual fix for #54 — still aborts on ENOSYS. Two encodings of one predicate now live in the tree, and the newer one contradicts the older. The established precedent in the repo is selene/src/disk.rs:1309 (EOPNOTSUPP | ENOSYS).
Fix: one helper beside rename_noreplace (cache.rs:4263) and two call sites:
pub(crate) fn noreplace_unsupported(error: &io::Error) -> bool {
matches!(error.raw_os_error(), Some(libc::EINVAL | libc::ENOTSUP | libc::ENOSYS))
}
archive.rs:304 then becomes if noreplace_unsupported(&error), and cache.rs:4239-4249 collapses to the Unsupported-wrapping case. Net: one predicate, one behaviour, and the divergence disappears instead of being preserved.
3. The probe reinvents unique naming that already exists 25 lines away
helios/src/core/cache.rs:4206-4218 (vs token() at cache.rs:3537)
let probe = loop {
let mut random = [0u8; 16];
SystemRandom::new().fill(&mut random)
.map_err(|_| io::Error::other("could not generate publication probe name"))?;
let name: String = random.iter().map(|byte| format!("{byte:02x}")).collect();
let probe = parent.join(format!(".flare-rename-probe-{name}"));
match fs::DirBuilder::new().mode(0o700).create(&probe) {
Ok(()) => break probe,
Err(error) if error.kind() == io::ErrorKind::AlreadyExists => continue,
Err(error) => return Err(error),
}
};
token() (cache.rs:3537) is already the module's unique-name generator and is used by both neighbouring functions this PR touches — export_entry at cache.rs:2812 and commit_standalone at cache.rs:3686 — to name their staging directories in the same parent directory. The probe is created and removed inside this one call, so the "collision" the retry loop defends against cannot occur in a way that a pid+counter token would not already prevent, and the SystemRandom failure arm is untestable.
Fix — 13 lines to 2:
let probe = parent.join(format!(".flare-rename-probe-{}", token()));
fs::DirBuilder::new().mode(0o700).create(&probe)?;
(Correction to an earlier note: this is not a new dependency edge — ring is already a helios dependency gated on runtime-core (helios/Cargo.toml:43) and ring::digest is already imported at cache.rs:38. The cost is purely the 12 extra lines and the dead error arm.)
4. Three of five tests around a four-line helper prove nothing new; one proves an unenforced premise
heliopause/src/export/archive.rs:459-488, :513-533, :535-555
install_blob_after_rename_error is four effective lines (archive.rs:304-312): a predicate, a hard_link, and an error pass-through. It has five tests:
:439-456(unsupported_noreplace_rename_installs_blob_with_a_hard_link) — keep: it is the behaviour the PR exists for, and it asserts both the installed bytes and that the temporary survives.:490-511— keep: EEXIST preservation, the dataset in #54.:459-488— delete. Its whole premise isset_permissions(&staging, 0o555)at:472plus the comment at:470-471("unlinking also needs write permission. Publication must not unlink"). That premise is not enforced when the suite runs as root — the documented container build — and even when it is enforced, the only assertion it adds over:439is thatremove_temporarystill works afterwards (:484-485), which isarchive.rs:314's own behaviour and unrelated to this PR.:513-533and:535-555— merge. Both drive oneErr(error.into())pass-through atarchive.rs:312: one with a fabricatedPermissionDenied, one with aNotFoundfrom a missing source. Forty lines of scaffolding for one?; a single parameterised test covers both.
Why it matters: AGENTS.md:194-199 — "Tests must exercise the affected behavior or contract… mocks that bypass the behavior cannot establish runtime correctness." Here the extra tests do not bypass behaviour so much as restate it; and the one test with a real premise asserts something the PR does not change. Keeping ~50 fewer lines of test scaffolding also keeps the PR focused on one outcome.
Caveat, stated honestly: if the suite ever runs unprivileged, :459 does exercise "publication must not unlink". It is still redundant with :439's "temporary still exists" assertion.
5. A generic helper and a stub test exist only for each other
heliopause/src/export/binding.rs:97-118 and :1474-1520
capture_with_owners<O, T>(owners, capture, drain) is a 22-line generic abstraction over OwnerLease. Its only production call is binding.rs:87-92, and its only test is :1474-1520 — 46 lines that construct an Owner(Arc<AtomicBool>) stub, a Cell<bool> capture flag, and a fabricated Err(invalid("unsupported publication")) to stand in for the preflight. Neither OwnerLease, capture_rank, nor drain_context is ever exercised. The diff replaces 14 inline lines on main with this pair; the inline shape was shorter and the lease lifetime was visible where it matters:
let mut lease = OwnerLease(Some(owners));
let result = py.detach(capture); // main's original shape
if drain.is_ok() { drop(lease.take_after_drain()); } else { /* main's error message */ }
Fix: inline the helper back into export_capture and delete the 46-line stub test. The drain-failure message (binding.rs:106-115) moves back into export_capture where its inputs live. This satisfies AGENTS.md:188-193 ("extension points… without a concrete requirement") and :194-199 (a mock that bypasses the behaviour cannot establish correctness).
Nits
6. Cuts inside the probe itself
helios/src/core/cache.rs:4176-4261 and heliopause/src/export/conversion.rs:316-317
cache.rs:4194-4203re-checks the destination existence that every caller already checked (core.rs:618-620,cache.rs:2797-2803,:3671-3677,conversion.rs:364-366) and emits a third wording,"destination exists", alongside the callers' "export destination {} already exists". Drop it; the callers keep their established message.cache.rs:4227-4232("no-replace rename replaced an existing directory") is unreachable in the product:rename_noreplacecannot returnOkfor an existing target; its only reach is the injected-closure test at:4546. Deleting it also deletes half of theUnsupportedhandling at:4239.cache.rs:4250-4260's three-armmatch (result, cleanup)reduces toresult?; cleanupwith the cleanup error appended viamap_err— the same behaviour, four lines instead of eleven.cache.rs:4179-4183(#[cfg(not(target_os = "linux"))] { let _ = destination; Ok(()) }) exists only because the Linux armreturns; with the Linux work in a private function the public wrapper can be a single#[cfg]-selected body.conversion.rs:316runs the probe beforeverified.payload_files()(:318) andverify_stored_data(:323), and before the established "destination exists: {output}" check at:364-366; it also has to re-map toinvalid("directory export preflight: …")where:436-442already mapsAlreadyExists. Moving it after verification and reusing that mapping removes a third error string.tests/preparation/test_directory_preflight.pycarries no SPDX header; every other file intests/preparation/(~90) has one. (Moot if finding 1's deletion is taken.)
7. commit_standalone reorders synchronize for no stated reason
helios/src/core/cache.rs:3678-3679
The diff moves synchronize(&self.directory) from the top of commit_standalone (old line, cache.rs:3671 in the base) to after the new probe. Nothing in the PR description or a comment explains why, and no test covers either ordering; AGENTS.md:188-193 rules out unsolicited rearrangement that does not support the requested behaviour. If the intent is "fail before an fsync nobody needs", say so in a comment and keep it; otherwise leave the order alone. Note also that commit_standalone (:3670-3700) is now a near-duplicate of export_entry (:2796-2815) — same three lines, same staging-name construction, same rename — which is why the probe had to be added twice. Consolidating the two would remove one call site for free; that is arguably outside this PR's scope, but it is the reason finding 1's site list is long.
Scope note (one sentence, prose lens owns it)
The description presents the PR as a Heliopause blob fix plus "focused helper harness passed 3 tests", but the diff also adds a Helios preflight module, a Python pyfunction, an ignition bootstrap step and a new Python test file — docs/design-review.md (not opened) principle 16 and the four-part description rule (AGENTS.md:67-135) apply; the simplicity consequence is what makes findings 1 and 5 reportable here.
What I did not assess / open questions
- I did not assess the fallback's atomicity,
EEXISTsemantics or concurrency — original-el8's review comment covers that ground and another lens owns it. - No tests were run in this review (no tool available); every claim above is from reading code at
41f1c76. The one behavioural premise I could not execute:export_capturenow maps all post-detach failures toPyRuntimeError(binding.rs:93), whereasmainraisedPyValueErrorfor some; whether a Python caller distinguishes them would be settled by runningtests/preparation/test_runtime_core.py(which, read at:44-77, does not exercise the preflight). - An earlier reviewer blocker ("branch does not apply to main") is resolved at this head:
unpack/unpack_selectedare thin wrappers (conversion.rs:295-302) with the probe insideunpack_with(:316).
Files read in context
pr_files (7), full diff of all 7, pr_comments; heliopause/src/export/{archive,binding,core,conversion,blob}.rs, helios/src/core/{cache,conversion,export,conversion/edit}.rs, ignition/preparation/{model_core,runtime_core,core_file,core_snapshot,host_ranks}.py, ignition/cli/{serve,publishing}.py, tests/preparation/{test_directory_preflight,test_model_core,test_runtime_core}.py, helios/Cargo.toml, AGENTS.md:165-205, charter, selene/src/disk.rs:1300-1312.