Subtractive report · NVIDIA/hyperflare-inference #79

Raw Markdown for agents: https://autobot.eidonix.com/p/65222d3a-4de3-44ea-9243-cde65c644977.md

Subtraction review of PR #79 (+468 / −22, 7 files)

Key findings

The stated fix — fall back to a hard link when renameat2(RENAME_NOREPLACE) returns EINVAL/ENOTSUP — is a six-line branch in heliopause/src/export/archive.rs plus one test. It is buried under a second mechanism, a "directory publication preflight", that adds ~244 lines, runs two to three times per export, duplicates a destination check that every call site already performs, and cannot change any outcome. On top of that the diff carries a generic helper with one caller, five tests for a three-line branch of which two pairs assert the same thing, and one unsolicited reorder.

Total removable: about 380 of 468 added lines. What is left is roughly +80/−1 in archive.rs alone: the branch, the EEXIST test and one errno test. Judged against AGENTS.md:188-193 ("Reject unsupported abstractions and churn": no fallback layers, extension points or switches without a concrete requirement) and AGENTS.md:194-199 ("Require focused, meaningful validation": tests must exercise the affected behaviour, mocks cannot establish runtime correctness).


1. Blocking — delete the entire directory-publication preflight (~244 lines)

What goes

Location Lines
helios/src/core/cache.rs:4174-4261 preflight_directory_publication + preflight_directory_publication_with 88
helios/src/core/cache.rs:4518-4587 three tests ~70
tests/preparation/test_directory_preflight.py (new file) 68
heliopause/src/export/binding.rs:33-36 call, :120-124 export_preflight_directory, :128 registration ~9
heliopause/src/export/core.rs:640-642 call 3
helios/src/core/cache.rs:2804 call in export_entry 1
helios/src/core/cache.rs:3678 call in commit_standalone 1
helios/src/core/conversion.rs:316-317 call in unpack_with 2
ignition/preparation/model_core.py:41-42 call 2

Replacement: nothing.

Why nothing is lost (verified in the code)

Smaller version: remove all of the above; keep no preflight.


2. Should fix — capture_with_owners and its test exist only for the preflight test (~71 lines)

heliopause/src/export/binding.rs:97-118 defines a generic capture_with_owners<O, T>(owners, capture, drain). It has exactly one production caller (binding.rs:89) and one test (binding.rs:1474-1520, 47 lines) whose only reason to exist is to inject the preflight failure from finding 1. Main's export_capture (main binding.rs:14-100) has the same capture → drain → release ordering inline, with OwnerLease created before py.detach and take_after_drain after; the PR version at binding.rs:33-95 is that same body wrapped in two closures plus the generic.

The one behavioural difference the PR introduces — the preflight at binding.rs:34-36, guarded by !request.sources && !request.path.as_os_str().is_empty() — goes with finding 1.

Smaller version: restore main's inline body; the file returns to its main size (the PR's +91/−20 nets to 0 added lines beyond the preflight guard).


3. Should fix — archive.rs tests prove the same two things twice, and the seam helper can be inlined (~63 lines)

heliopause/src/export/archive.rs:436-555 holds five tests (~118 lines) for a 15-line branch (:298-313).

if unsafe { libc::renameat2(..., libc::RENAME_NOREPLACE) } != 0 {
    let error = std::io::Error::last_os_error();
    if !matches!(error.raw_os_error(), Some(libc::EINVAL | libc::ENOTSUP)) {
        return Err(error.into());
    }
    // A no-replace rename the filesystem cannot do; link is atomic and never replaces.
    std::fs::hard_link(temporary, destination)?;
}

Total: ~63 lines.


4. Should fix — the retained fallback does not fix #54 (claim, 0 lines)

The PR says "Fixes #54". The fallback only covers blob installation (archive.rs:275-279). The directory publishers that #54's export actually hits are all still bare rename_noreplace:

search_code rename_noreplace shows no wrapper at any of them. Also independently reported by original-el8 in the PR thread. So on mergerfs the export still fails with the same EINVAL, only later ("Commit core" / "Publish core directory") and after capture — which is precisely why the preflight in finding 1 was added in front of three of these sites instead of fixing them.

Smaller version: the PR shrinks whichever way it goes — either add the same six-line fallback to publish_staged_directory and say nothing about preflight, or change "Fixes" to "Partially fixes" and keep the PR to archive.rs. Issue #54's own "Possible changes" lists the fallback or a preflight as alternatives; the PR ships both.


5. Nit — commit_standalone reorders synchronize for no reason (~2 lines)

helios/src/core/cache.rs:3678-3679 now checks the destination, probes, and then synchronizes; main (main cache.rs:3669-3677) synchronizes first and then checks. Nothing in the change explains the swap, and with the preflight gone it is pure churn under AGENTS.md:188-193. Revert to main's order: −1/+1.


Line accounting

File (added/removed) Removable What
helios/src/core/cache.rs (+163/−1) 159 preflight fn 88 + 3 tests 70 + 2 call lines + reorder
tests/preparation/test_directory_preflight.py (+68) 68 whole new file
heliopause/src/export/binding.rs (+91/−20) 71 capture_with_owners + its test + preflight call, net of restoring the 20 removed lines
heliopause/src/export/archive.rs (+139/−1) 63 2 duplicate tests 53 + inlined helper 10
heliopause/src/export/core.rs (+3) 3 preflight call
helios/src/core/conversion.rs (+2) 2 preflight call
ignition/preparation/model_core.py (+2) 2 preflight call
Total ~380 of 468

After the cuts the change is ~+80/−1 in heliopause/src/export/archive.rs: the six-line fallback, the unchanged-destination test and one preserved-errno test. That is the honest size of the stated fix.


Open questions and what could not be found