Correctness report · NVIDIA/hyperflare-inference #79

Raw Markdown for agents: https://autobot.eidonix.com/p/6c40b13f-0ded-4f73-afe5-08671ea1cf79.md

Review: PR #79 — fix(heliopause): fall back when no-replace rename is unsupported

Head 41f1c76, base main, 7 files, +468/−22. Lens: correctness (callers, platforms, error paths, state, resources). All 7 changed files were read in surrounding code and every caller traced: ignition export → model_core.export_core → host_ranks/rank_group → heliopause capture/publish → helios cache/conversion/export.

Key findings

Verdict: should-fix issues only. No blockers.

The blob hard-link fallback itself (heliopause/src/export/archive.rs:298-313) is correct, atomic, EEXIST-preserving, and its caller is compatible. The problem is the second half of the PR — the directory-publication preflight. Three of its five added call sites are unreachable from ignition export, the one reachable publisher it left aside (conversion::edit) still fails bare with EINVAL on mergerfs, one of the new tests cannot fail on its subject, and in unpack_with the probe was placed before verification and before the established destination check, which changes user-visible errors and creates the output parent on a failure path.

Should-fix findings: 5 (edit.rs uncovered; unreachable preflight call sites; test passes for the wrong reason; unpack_with placement; two errno policies for one syscall). Nits: 6.


Should fix

1. helios/src/core/conversion/edit.rs:250 — core edit still fails on mergerfs with no preflight and no fallback

edit builds and syncs its staging tree, then publishes with a bare no-replace rename:

// edit.rs:249-251
crate::core::cache::synchronize(&staging)?;
crate::core::cache::rename_noreplace(&staging, request.output)
    .map_err(|e| invalid(format!("publish edited core: {e}")))?;

There is no preflight_directory_publication call and no hard-link fallback. The only exists-check is the early if request.output.exists() at edit.rs:27-32, which runs before the costly companion copy, so it does not help on an unsupported filesystem. This is reachable in production from ignition edit → heliopause/src/export/conversion.rs:206 (export_payload_edit → helios_core::core::conversion::edit).

On a mergerfs destination the user still gets publish edited core: Invalid argument (os error 22) after every companion has been copied — the exact #54 symptom the PR exists to close. Fix: route edit publication through the same path as unpack_with — preflight after verification, or accept the hard-link fallback for the directory tree (with the same-directory guarantee checked).

2. ignition/preparation/model_core.py:41-42, heliopause/src/export/binding.rs:34-36, heliopause/src/export/core.rs:640-642, helios/src/core/cache.rs:3678 — the new preflight is unreachable on the path issue #54 hits

ignition export always passes path=None:

so cache_only = path is None (model_core.py:27) is always true on that path, and every guard is conditioned on the negation:

What production actually reaches: cache.rs:2804 (Root::export_entry, from heliopause/src/export/core.rs:921/934 and heliopause/src/export/conversion.rs:351) and conversion.rs:316 (unpack_with). helios/src/core/export.rs:742 (publish_staged_directory) is reached only from core.rs:1014 when path is non-empty and no cache is configured — no Python caller produces that.

So the PR's claim that directory publication is preflighted does not hold for the paths production uses. Fix: either wire the probe into the cache-only publication in Staging::commit, or drop the unreachable sites and keep only the ones with a real caller — plus fix finding 1.

3. tests/preparation/test_directory_preflight.py:43-52 — the new test cannot fail on its subject

with pytest.raises(RuntimeError, match="configured core cache"):
    model_core.export_core(None, None, None, destination, options={}, publisher=object(), form=form)

The test never enters an export_options(...) context, so core_snapshot._OPTIONS.get() is None and model_core.py:31-33 raises RuntimeError("export requires the configured core cache") before line 41 is reached. The assertion matches that earlier error, so the unexpected probe installed at :45-46 can never run and the test passes whether or not the guard at model_core.py:41-42 exists. It cannot detect the regression its name describes. Fix: wrap in with export_options(tmp_path / "cache"): as the first test does (:33), then assert only that the probe is not called. Note the first test (:11-40) does exercise line 41-42 but fakes flare_heliopause/torch (:28-31), so it asserts call order only, not filesystem behaviour.

4. helios/src/core/conversion.rs:316-317 — probe runs before verification and before the destination check

unpack_with now probes immediately after the directory-form check (:313-315) and before verify_stored_data (:323) and the established destination check at :364-366. Two behaviour changes on error paths:

(a) Changed error text for an existing destination. preflight_directory_publication returns AlreadyExists with the message destination exists (cache.rs:4196-4199), so the user now sees directory export preflight: destination exists from conversion.rs:316-317 instead of destination exists: <path> from :364-366. The tests at :4254/:4263 assert only contains("destination exists"), so they still pass while the message users see changed, and the condition is now reported twice.

(b) Parent directory created on a failure path. preflight_directory_publication calls fs::create_dir_all(parent) (cache.rs:4205) although its own doc comment says "this probe reserves nothing" (cache.rs:4174-4175). A corrupt or unreadable source core now creates the output parent before being rejected, while the failure path at conversion.rs:447-449 only removes staging.

Fix: move the probe after verify_stored_data, and put the output.exists() check before it — or make the probe tolerate a missing parent with NotFound.

5. heliopause/src/export/archive.rs:304-307 vs helios/src/core/cache.rs:4238-4249 vs selene/src/disk.rs:1308-1311 — two errno policies for one syscall

For renameat2(RENAME_NOREPLACE):

A filesystem (or seccomp filter / older kernel) returning ENOSYS therefore gains the blob fallback but not the directory probe, so the two halves of this PR disagree on the same syscall. Fix: one predicate function next to rename_noreplace (cache.rs:4265) used by both sites, covering the union and matching the selene precedent.


Nits


Verified correct


Open questions / not settled by code

Governing rules cited