Architecture and scope review — PR #79 "fix(heliopause): fall back when no-replace rename is unsupported"
Head commit 06b9011, base main, 7 files, +468/−22. Lens: does the change belong in the repository and is the approach right, judged against read_charter, AGENTS.md, docs/design-review.md and CONTRIBUTING.md.
Key findings
- The blob fallback is the right fix and is correct as written (heliopause/src/export/archive.rs:472-486). Hard-link publication with the temporary left to
BlobStore::commitmatches the existing precedent (helios/src/core/cache.rs:2583-2603install_payload,:2608install_legacy) and weakens nothing: the no-clobber guarantee comes fromlink'sEEXIST, whichblob.rs:204-211already handles. Keep it. - The bundled directory-preflight half does not deliver its stated benefit. It is unreachable on both production export entry points, and every preflight call that does execute runs after GPU capture/preparation — so issue #54's real cost (a wasted full preparation pass) is unchanged and the "Fixes #54" claim is not true on the default path.
- One of the new checks mutates the filesystem before validation (
helios/src/core/cache.rs:3652,fs::create_dir_all(parent)), inside a function whose own doc comment says "this probe reserves nothing". - The same question — "does this filesystem support no-replace publication?" — is now answered by two different errno sets in two crates, and the shared primitive
rename_noreplacewas left unfixed. - The new filesystem requirement is undocumented, and the PR description violates the mandatory four-part description scheme.
- Net architectural recommendation: split the PR. Keep the archive.rs/blob fallback (root cause of #54 option 1, per the issue), drop the directory-preflight machinery back to a single check where a directory is actually published, and document the requirement.
Blocking
1. The directory preflight never runs before preparation, so the PR does not fix #54
File/lines: ignition/preparation/model_core.py:41-42; heliopause/src/export/binding.rs:34-36; heliopause/src/export/core.rs:708-710; helios/src/core/cache.rs:2358, :3125, :3621-3708; helios/src/core/conversion.rs:245.
What is wrong. Both production export entry points pass path=None:
- single host:
ignition/cli/serve.py:371—export_core(prepared, recorder, storage, None, options=..., publisher=...),formdefaults to'directory'; - multi host:
ignition/cli/serve.py:240—prepared.export(None, ...)→ignition/preparation/host_ranks.py:460cache_only = path is None.
Consequences, each verified in code:
model_core.py:41—if not cache_only and form == 'directory': flare_heliopause.export_preflight_directory(str(path))— is unreachable fromignition export, becausecache_onlyisTrueon both paths.binding.rs:34—if !request.sources && !request.path.as_os_str().is_empty()— is also unreachable:export_corepassessources=True(model_core.py:51-52), andhost_ranks.py:470/:686do the same. So the per-rankexport_capturepreflight never fires.core.rs:708is insidepublish_payload, whichbinding.rs:64calls aftercapture_rankreturned (binding.rs:42-45) — i.e. after all GPU capture and blob scanning; and in the default cache-only path it is skipped entirely becausepathis empty (cache_only,core.rs:683).- The checks that do run all fire after the expensive work:
helios/src/core/cache.rs:2358inexport_entryis reached fromcore.rs:990, after "Commit core";cache.rs:3125commit_standaloneandconversion.rs:245unpack_selectedare convert/commit paths after the tree is assembled.
Why it matters. On mergerfs the export still fails — after tuning, compilation, capture and blob scanning — so #54's actual cost (the issue body: a full ~20-minute preparation pass per attempt) is untouched. Only the error text changes, which is precisely the "swallow/re-word the error" outcome the charter's "bug fixes need to address the root cause" line and AGENTS.md 165-169 and 176-181 ("Do not present scaffolding or partially wired features as supported") reject. AGENTS.md 170-175 forbids speculative machinery; here that machinery is dead code in three layers plus a new public Python function (export_preflight_directory, binding.rs:120-124) that nothing in production calls. This is the same defect as the maintainer's blocking item 2 (yatesdr, 2026-11-18 review): there should be one check, where a directory is actually published.
Fix. Keep exactly one check, placed where a directory is actually published (export_entry, commit_standalone, unpack_selected, or the staged-directory publish) — or, if the goal is genuinely to fail before preparation, wire exactly one call into the real entry point (the CLI, where the destination is known) and delete the other three. Otherwise describe the PR as "partially fixes #54".
2. The preflight creates the destination parent as a side effect before validation
File/line: helios/src/core/cache.rs:3652 (fs::create_dir_all(parent)?), :3653-3665 (creates a hidden 0700 .flare-rename-probe-<32 hex> directory there), doc comment :3621-3622 ("The final publication must still use rename_noreplace: this probe reserves nothing"); caller helios/src/core/conversion.rs:245, which runs it before payloads.verify() at :248 and before staging at :292.
What is wrong. A function documented and called as a precondition check creates the destination's parent directory and a throwaway directory inside it. A conversion that then fails verification — or any export that fails after the check — now leaves newly created directories behind, where previously the "destination exists" or verification errors were produced without touching the filesystem.
Why it matters. AGENTS.md 165-169 forbids weakening guarantees, and docs/design-review.md principle 12 ("Validate the real path and report evidence honestly", 94-102) is the applicable rule: validation must observe, not mutate. Silently creating parent directories from a path that then fails contradicts the publish paths' documented property that a failed publication leaves no partial output (docs/core-format-design.md:695-710).
Fix. Refuse a missing parent (return NotFound) instead of creating it, or run the probe immediately before the rename it is validating, after the parent is known to exist and validation has passed.
Should fix
3. One no-replace policy, two divergent implementations in two crates
File/lines: heliopause/src/export/archive.rs:477-480 (fallback for EINVAL | ENOTSUP only) vs helios/src/core/cache.rs:3685-3696 (EINVAL | ENOTSUP | ENOSYS); shared primitive helios/src/core/cache.rs:3712-3732 rename_noreplace, still used unchanged by cache.rs:2371, :3143, conversion.rs:324, export.rs:742, conversion/edit.rs:250.
What is wrong. The same question — "does this filesystem support no-replace publication?" — is answered with two different errno sets in two crates. ENOSYS is fallback-worthy for the probe but a hard error for the blob. Neither the classification nor the fallback lives in the primitive that all five remaining directory publication sites use.
Why it matters. The charter asks for the smallest footprint in shared code and AGENTS.md 170-175 rejects speculative duplicate layers; two policies for one operation will drift, and a kernel/filesystem answering ENOSYS will behave inconsistently between blob and directory publication. The root-cause location for #54 is the primitive, not two callers.
Fix. Put the errno classification (and, if wanted, the fallback) once, beside rename_noreplace, with one comment naming the chosen set, and have both archive.rs and the probe call it.
4. The new filesystem requirement is undocumented
File/lines: docs/multi-host.md:275-278 (the existing "output and core cache must be on the same filesystem for hardlinks" rule); docs/core-format-design.md:703 (already promises "filesystem file-size or space limits cause an explicit preflight/export error"); issue #54's "Possible changes" item 2 asks for the rename requirement to be recorded beside these.
What is wrong. The PR makes directory publication require no-replace rename support (and a probe) but touches no documentation — none of the 7 changed files is a doc.
Why it matters. AGENTS.md review standards require stating which configurations are supported and checking that existing artifacts still load in every supported configuration; #54 exists in the first place because this constraint was undocumented. A new explicit failure mode with no doc entry converts a documented environment into an unexplained error.
Fix. One or two sentences next to docs/multi-host.md:275 (and, if the probe stays, a line at docs/core-format-design.md:703) naming the requirement, the EINVAL/ENOTSUP/ENOSYS symptom, and the supported workaround (destination on a local filesystem / same filesystem as the cache).
5. The PR description does not match the branch
What is wrong. AGENTS.md 67-135 requires four answers in order — why, exactly what changed, claimed result, evidence — and 126-127 explicitly bans process assurances that carry no technical evidence. At 06b9011 the description:
- covers only the first commit's blob fallback, and says "then the temporary name is removed", which is stale: 30ccc0de moved cleanup to the caller (
archive.rs:482-483,// BlobStore::commit owns temporary cleanup after publication.); - claims "Fixes #54" although directory publication on mergerfs still fails (finding 1);
- never mentions the directory preflight, the
preflight_directory_publicationAPI, the new Pythonexport_preflight_directorybinding,tests/preparation/test_directory_preflight.py, or the parent-directory side effect (finding 2); - offers only "a focused helper harness passed 3 tests" plus rustfmt/
git diff --check, with the Helios suite not run.
Why it matters. Under an architecture-and-scope reading this is not a formality: a reviewer cannot tell from the description which of the 7 files is the fix and which is scaffolding, nor which of the two #54 options the PR claims to implement. That is also the maintainer's blocking item 3.
Fix. Rewrite as "partially fixes #54", name the two halves separately, correct the cleanup sentence, and state exactly which commands ran and what remains untested (see the evidence gap below).
Nit
6. capture_with_owners is scope churn tied to the dropped check
heliopause/src/export/binding.rs:97-118 extracts the lease/drain logic out of export_capture (previously inline); behaviour is preserved (OwnerLease retained unless the drain succeeds), and binding.rs:1044-1090 unit-tests the extraction. It exists so a test can observe that the newly added, unreachable binding preflight (binding.rs:34-36) returns before capture. If finding 1 is fixed by dropping the binding check, capture_with_owners loses its only reason to exist and should revert to the inline form — AGENTS.md 170-175 requires refactoring to directly support the requested behaviour.
Evidence gap (supports findings 1 and 5; not a separate defect)
The five new Rust tests (archive.rs:612-720) call install_blob_after_rename_error directly with a synthetic io::Error; none drives install_blob's real renameat2 branch, and nothing exercises an actually unsupported filesystem (also the maintainer's should-fix 5). tests/preparation/test_directory_preflight.py:28-31 replaces flare_heliopause, torch and torch.distributed in sys.modules, so it asserts call order, not behaviour — AGENTS.md 176-181 states that mocks which bypass the behaviour cannot establish runtime correctness. A run of ignition export with the cache on a mergerfs (or any EINVAL-returning FUSE mount) would settle whether the PR fixes #54 at all; the description notes mergerfs was unavailable.
File-by-file coverage
| File | Read in context | Outcome |
|---|---|---|
heliopause/src/export/archive.rs |
install_blob_after_rename_error (472-486), remove_temporary, BlobStore::commit/blob.rs:190-224, tests 612-720 |
Approach correct (see Positives); policy divergence → finding 3; errno-only tests → evidence gap |
heliopause/src/export/binding.rs |
export_capture (25-95), capture_with_owners (97-118), export_preflight_directory (120-124), registration (126-130) |
Unreachable preflight → finding 1; churn → nit 6 |
heliopause/src/export/core.rs |
publish_payload (675-715), call site :990 |
Post-capture, skipped in default path → finding 1 |
helios/src/core/cache.rs |
export_entry (2350-2378), commit_standalone (3117-3143), preflight_directory_publication* (3621-3708), rename_noreplace (3710-3743), install_payload/install_legacy (2583-2610) |
Side effect → finding 2; split policy → finding 3; no regression from the commit_standalone reorder (below) |
helios/src/core/conversion.rs |
unpack/unpack_selected (235-255), publish :324, :346 |
Preflight after verification → finding 1; before verification → finding 2 |
ignition/preparation/model_core.py |
export_core (16-60) |
Unreachable call → finding 1 |
tests/preparation/test_directory_preflight.py |
28-31 and following | Mock-only assertion → evidence gap |
Verified and deliberately not reported as findings
commit_standalonereordering is durability-safe.synchronize(&self.directory)(cache.rs:3126) still runs beforecopy_tree(:3135) and before the publish rename (:3143), and the staging tree is synced at:3139.commit_standalonehas only test callers (:4441,:4447,:4557), so no production durability path changed.- The probe cannot clobber user data. It only renames paths under the freshly created 0700 random
.flare-rename-probe-*directory (cache.rs:3653-3665), with anEEXIST-retry loop. - Non-Linux behaviour is unchanged.
preflight_directory_publicationreturnsOkon non-Linux (cache.rs:3626-3630), andexport_preflight_directorybecomes a no-op, consistent with the existing non-Linuxrename_noreplace(cache.rs:3735-3743). - No new dependency.
ringis already aruntime-coredependency (helios/Cargo.toml:21,:42;heliopause/Cargo.toml:23), soSystemRandomin the probe adds nothing to pin. - No model-specific branch, flag, or environment switch. The change touches no propagation policy or prepared metadata, so the model-agnostic and explicit-configuration rules are not engaged (charter line 12).
- Pre-existing duplication of the
path.exists()check inpublish_payload(core.rs:686and:695-700) is not this PR's doing.
Positives worth stating explicitly
The blob half is the right root cause (issue #54 option 1) and is minimal: archive.rs:477-484 hard-links the staged immutable blob, blob.rs:204-211 already verifies and accepts an existing identical object on EEXIST, and blob.rs:216-224 tolerates the temporary already being gone — so the no-clobber guarantee is preserved without a new flag or path. readonly is applied at blob.rs:190 before install, and a hard link shares the inode, so sealing carries over. This is exactly the shape install_payload/install_legacy already use.
Open questions / what I could not settle
- Whether the maintainers want the directory publication requirement fixed at all inside this PR, or split out: I recommend splitting (keep archive.rs, drop the preflight scaffolding), but that is a scope call for the maintainer.
- Whether any production path ever supplies a non-empty
pathwithsources=Falsefor directory form. Everything I found passesNone, which is why finding 1 is blocking; a counter-example would downgrade it to "one call site is dead". - Commit sign-off/trailer compliance (
CONTRIBUTING.md7-20) was not re-verified per commit; it is outside this lens.