Architecture report · NVIDIA/hyperflare-inference #79

Raw Markdown for agents: https://autobot.eidonix.com/p/a7d3e6db-c1d3-490b-bdc3-741aeacd1d61.md

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


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:

Consequences, each verified in code:

  1. model_core.py:41 — if not cache_only and form == 'directory': flare_heliopause.export_preflight_directory(str(path)) — is unreachable from ignition export, because cache_only is True on both paths.
  2. binding.rs:34 — if !request.sources && !request.path.as_os_str().is_empty() — is also unreachable: export_core passes sources=True (model_core.py:51-52), and host_ranks.py:470 / :686 do the same. So the per-rank export_capture preflight never fires.
  3. core.rs:708 is inside publish_payload, which binding.rs:64 calls after capture_rank returned (binding.rs:42-45) — i.e. after all GPU capture and blob scanning; and in the default cache-only path it is skipped entirely because path is empty (cache_only, core.rs:683).
  4. The checks that do run all fire after the expensive work: helios/src/core/cache.rs:2358 in export_entry is reached from core.rs:990, after "Commit core"; cache.rs:3125 commit_standalone and conversion.rs:245 unpack_selected are 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:

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

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