Architecture and scope review — PR #79, "fix(heliopause): fall back when no-replace rename is unsupported"
Reviewed at head 41f1c76 (7 files, +468/−22, after the 2026-11-27 merge of main; the earlier "branch no longer applies" blocker is resolved — unpack_selected is again a one-line wrapper at helios/src/core/conversion.rs:300-302). Judged against the charter, AGENTS.md, docs/design-review.md and CONTRIBUTING.md (not opened). Lens: architecture and scope only — this review does not re-litigate the concurrency/durability and test-design findings other reviewers raised, except where they bear on scope.
Key findings
- Keep the blob half.
install_blob_after_rename_error(heliopause/src/export/archive.rs:298-313) is the correct, minimal, root-cause fix for #54's blob install. It matches in-tree precedent (install_payload/install_legacyin helios/src/core/cache.rs usehard_link, treat EEXIST as no-clobber, and leave cleanup to the caller), and it weakens no guarantee (see "Positives" below). - The directory-probe half is dead where it matters.
ignition exporthas exactly two entry points and both passpath=None, so none of the five new probe call sites and neither new entry point (export_preflight_directory,preflight_directory_publication) can execute on the command #54 reports. Nothing in the change reduces the ~20-minute wasted preparation pass the issue is about. - The probe half also misses the two publishers that do run (
publish_staged_directory,ignition edit), so the class of failure is only half-covered, and the one place it does cover (ignition convert) it changes behaviour: it creates the destination parent and a throwaway directory before validation, inside a function documented "this probe reserves nothing". - One no-replace policy is now implemented twice, with different errno sets (blob:
EINVAL|ENOTSUP; probe:EINVAL|ENOTSUP|ENOSYS), and the shared primitiverename_noreplacewas left unchanged — the wrong layer for the fix. - Documentation and PR description do not match the diff (new filesystem requirement undocumented; "Fixes #54" and a temporary-removal that head no longer performs; test count understated).
- Recommendation: split. Keep
archive.rsand its tests; drop the probe scaffolding, the new publicpreflight_directory_publication/export_preflight_directoryAPI,capture_with_owners, and the Python test; document the requirement. If a pre-flight check is genuinely wanted, put exactly one call where the destination is known (the CLI), not five speculative ones.
Blocking
1. The directory preflight never runs before preparation in any production export path, so the PR does not do what its title and description claim — ignition/preparation/model_core.py:41-42
What the code shows. export_core computes cache_only = path is None (model_core.py:27) and gates the probe on if not cache_only and form == 'directory' (:41-42). ignition export reaches export in two ways, and both pass None:
- single-host:
prepared.export(None, options=..., ...)— ignition/cli/serve.py:229; - multi-host:
export_core(prepared, recorder, storage, None, ...)— ignition/cli/serve.py:330.
Consequently, on the reported command:
- model_core.py:41-42 cannot run;
- heliopause/src/export/binding.rs:34 cannot run either, because it requires
!request.sources, andexport_corecallsexport_model(..., sources=True)(model_core.py:51-52); publish_payload's probe is skipped whencache_only(heliopause/src/export/core.rs:615, :640-642), and when there is a destination it runs insidepublish_payload, i.e. after capture, not "before preparing a standalone export" as its doc comment claims (helios/src/core/cache.rs:4174);export_entry's probe (cache.rs:2804) sits insideif !cache_onlyafter the entry is committed (core.rs:917-947);commit_standalone's probe (cache.rs:3678) has only test callers (cache.rs:5011, 5017, 5132);unpack_with's probe (conversion.rs:316) is theconvertpath only.
Why it matters. #54's reported cost is a full preparation pass (~20 minutes) burned before the failure; the change cannot affect that, because the only no-replace publication the export performs is the blob install (archive.rs:275) and the cache entry is published with plain fs::rename (cache.rs:3644), which mergerfs supports. So the PR adds dead code in three layers plus a new public Python function, while the description presents it as the fix — precisely the "present scaffolding as supported" failure AGENTS.md 176-181 forbids, and speculative machinery per AGENTS.md 170-175 ("Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement").
Fix. Delete the probe half — the blob fallback alone is the fix for #54. If a pre-export failure is genuinely wanted, add exactly one call in the CLI where the destination is known, and delete the other four sites and the pyfunction.
2. A per-caller probe fixes a symptom rather than the class, and leaves the two reachable publishers unguarded — helios/src/core/export.rs:742, helios/src/core/conversion/edit.rs:250
rename_noreplace (helios/src/core/cache.rs:4265-4295) is the single primitive every directory publication goes through. This PR adds a separate probe in front of three of its five callers and leaves the primitive untouched, so:
publish_staged_directory(export.rs:742) — used by the cache-less payload export, heliopause/src/export/core.rs:1013-1015 — still fails with a bareEINVALand no actionable message;ignition edit(conversion/edit.rs:250) — likewise.
The change therefore introduces a new, undocumented filesystem requirement in one place while the same requirement is neither detected nor explained two other places. The charter's "solve the right problem in the right place, and keep the smallest footprint in shared code" and "Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error" both point at the primitive, not at five call sites.
Fix. Classify the errno once, inside or beside rename_noreplace, and have blob install and every directory caller use that classification — or restrict this PR to the blob fallback and file the directory work separately.
3. One no-replace policy, two different errno sets, in two crates — heliopause/src/export/archive.rs:304-306 vs helios/src/core/cache.rs:4238-4249
The blob fallback treats only EINVAL|ENOTSUP as "unsupported" (archive.rs:304-306). The probe treats EINVAL|ENOTSUP|ENOSYS as unsupported and converts them to a friendly Unsupported error (cache.rs:4238-4249). Same question — "does this filesystem support atomic no-replace publication?" — two answers, in two crates, with no shared predicate. A filesystem that answers ENOSYS gets a working fallback for blobs and a hard failure for directories; a future change to one set silently diverges from the other.
There is in-tree precedent for including ENOSYS (selene/src/disk.rs, unsupported-error classification), so the sets should be reconciled deliberately, in one place, with the chosen set stated in one comment. AGENTS.md 170-175 and 311-317 (policy separation) both cut against duplicating a policy decision across the Helios/Heliopause boundary.
Fix. Hoist the predicate next to rename_noreplace (cache.rs:4265) and have both the blob error path and the directory probe use it.
Should fix
4. The probe mutates the filesystem inside a "check" and reorders established errors — helios/src/core/cache.rs:4205, helios/src/core/conversion.rs:316
preflight_directory_publication_with does fs::create_dir_all(parent) (cache.rs:4205) and then creates a .flare-rename-probe-<32 hex> directory inside it (cache.rs:4206-4218) — directly contradicting its own doc comment "this probe reserves nothing" (cache.rs:4175), the export_entry doc "a failure never exposes a partial export or replaces existing output" (cache.rs:2793-2795) and the commit_standalone doc "a failed or interrupted export never exposes a partial tree and never replaces an existing output" (cache.rs:3667-3669). Three of the call sites already check destination exists themselves without touching the disk (cache.rs:2797-2803, :3671-3677; conversion.rs:364-366), so the probe's own duplicate check at cache.rs:4194-4200 is redundant on those paths.
In unpack_with the ordering is worse: the probe runs at conversion.rs:316, before payload verification (verify_stored_data, conversion.rs:323) and before the established if output.exists() { "destination exists: …" } at conversion.rs:364-366. So an ignition convert to a path under a no-replace-less filesystem now: creates the parent directory and a throwaway probe directory, then reports directory export preflight: … where it previously reported destination exists: … — a behaviour change on the error path, plus leftover directories after a failed conversion.
Fix. Never create the parent in a check — return NotFound and let the publishing path create it. Run the check after validation (and after the existing existence check) so error text and ordering are preserved.
5. The new filesystem requirement is undocumented — no doc file in the diff
docs/multi-host.md states the same-filesystem rule for output vs core cache (docs/multi-host.md:311-317) and says nothing about no-replace rename support; docs/core-format-design.md:713 promises "explicit preflight/export error" for filesystem limits. Issue #54's own "Possible changes" list asks for exactly this note. The change makes directory publication on such filesystems either fall back (blobs) or fail with a specific message (directories) — a supported-configuration statement with no home in the docs. AGENTS.md review standards require checking which configurations are supported and stating new requirements where they belong.
Fix. One or two sentences beside the same-filesystem rule, stating what is required, what falls back, and what is reported.
6. The PR description does not describe this diff — .github PR #79 body
AGENTS.md 67-135 requires, in order: why, exactly what changed, the claimed benefit, and the evidence — and forbids leaving answers to be guessed. At 41f1c76 the description:
- says "Fixes #54", which the code does not do (finding 1);
- says "then the temporary name is removed", which head moved to
BlobStore::commit(archive.rs:309 comment; blob.rs:216-224); - describes only the blob half of a diff that is mostly directory-probe code, never mentioning
export_preflight_directory, the parent-directory side effect, or the two unguarded publishers; - reports "the focused helper harness passed 3 tests" where the diff adds six archive tests, one binding test and three cache tests plus a Python test file, and it names the Helios suite as unrun without saying what it would have covered.
Fix. Rewrite as "partially fixes", name the two halves, state the parent-directory side effect, and give the real test counts and what remains untested.
Nit
7. New public API and machinery for a path nothing calls — helios/src/core/cache.rs:4176, heliopause/src/export/binding.rs:97-124
preflight_directory_publication is pub in Helios's cache module solely so the Heliopause preparation-side extension can call it; export_preflight_directory (binding.rs:120-124, registered :126-130) is a new Python entry point called only from model_core.py:42, which production never reaches. capture_with_owners (binding.rs:97-118) is a behaviour-preserving extraction whose only purpose is to make binding.rs:34 observable from a test (binding.rs:1473-1520). The probe also re-implements random-name generation (cache.rs:4207-4211) where token() (cache.rs:3537) already exists for exactly this purpose for sibling staging names (cache.rs:2812, :3686). AGENTS.md 188-193 ("refactoring must directly support the requested behavior"; no speculative machinery) and 330-338 (keep Helios simple) apply. All of this disappears with finding 1; no change is needed if the probe half is dropped.
Verified clean / positives the change deserves credit for
- The blob fallback is correct and minimal.
linkis atomic, and itsEEXISTpreserves no-clobber;blob.rsalready reuses an identical existing object (blob.rs:204-211) and owns temporary cleanup (blob.rs:216-224); the read-only seal at blob.rs:190 carries across the shared inode. Nothing about content identity, sealing or durability is weakened. - No new dependency, flag, environment switch or per-model branch —
ringis already a runtime-core dependency; propagation policy and prepared metadata are untouched, so the model-agnostic rule (charter;AGENTS.md311-317) is not engaged. - Non-Linux is a no-op (cache.rs:4179-4183), consistent with the existing non-Linux
rename_noreplace(cache.rs:4288-4295). - The probe cannot clobber user data — it only touches paths under its own 0700 random directory, and a pre-existing destination is detected first (cache.rs:4194-4200).
Coverage (all seven changed files read in context, callers followed)
heliopause/src/export/archive.rs—install_blob:259-297, new error path :275,install_blob_after_rename_error:298-313,remove_temporary:314-, tests :436-560. → positive, finding 3, evidence gap.heliopause/src/export/binding.rs—export_capture:17-95 (probe :34-36),capture_with_owners:97-118,export_preflight_directory:120-124, registration :126-130, test :1473-1520. → findings 1, 7.heliopause/src/export/core.rs—publish_payload:597-1030 (existence checks :618, :627-632, probe :640-642, staging :643-647, standalone publish :917-947, uncached path :1013-1015). → findings 1, 2.helios/src/core/cache.rs—export_entry:2796-2824,commit_standalone:3670-3704,preflight_directory_publication/_with:4174-4261,rename_noreplace:4265-4295, cache rename :3644,token():3537, tests :4515-4585. → findings 2, 3, 4, 7.helios/src/core/conversion.rs—unpack_selected:300-302,unpack_with:305-451 (probe :316, verify :323, exists check :364-366, publish :436-442). → findings 1, 4.ignition/preparation/model_core.py—export_core:16-84 (cache_only :27, probe :41-42, sources=True :51-52). → finding 1.tests/preparation/test_directory_preflight.py(new, 68 lines) — mocksflare_heliopause/torch(:28-31) and asserts call order; it tests the unreachable path. Covered by findings 1 and 7.
Evidence gap (supports findings 1–3; not a separate defect)
No test drives install_blob's real renameat2 branch, and none exercises the probe against a filesystem that actually returns EINVAL: the new Rust tests call install_blob_after_rename_error directly with a synthetic io::Error, and the Python test mocks the extension module. AGENTS.md 176-181 explicitly says mocks that bypass the behaviour cannot establish runtime correctness. What would settle it: a mergerfs (or any EINVAL-returning FUSE mount) run of ignition export — which would also demonstrate, as finding 1 argues from the code, that the blob half alone fixes #54.
Dropped candidates (checked, not reported as findings)
- The earlier "branch does not apply to main /
unpack_selectedrewritten" blocker is resolved at41f1c76. commit_standalone'ssynchronizereordering (cache.rs:3679) remains durability-safe and the function has test-only callers.- The duplicate
path.exists()check inpublish_payload(core.rs:618 and :627-632) predates this PR.
Open question for the maintainer
Should the directory-publication requirement be handled in this PR at all? My recommendation is no: split it — merge archive.rs with its tests and a documentation sentence, and let a follow-up move the errno classification into rename_noreplace, at which point publish_staged_directory and ignition edit are covered for free and no probe is needed.