#1 [high] Should fix: two copies of the "no-replace rename unsupported" predicate with different errno sets
PR 79 introduces the same decision twice, with different answers:
- heliopause/src/export/archive.rs:477-480
code == libc::EINVAL || code == libc::ENOTSUP(blob hard-link fallback) - helios/src/core/cache.rs:3686-3688
matches!(error.raw_os_error(), Some(libc::EINVAL | libc::ENOTSUP | libc::ENOSYS))(directory preflight)
ENOSYS is the errno renameat2 returns on a kernel without the syscall/flag. Both paths use it (helio pause via the glibc libc::renameat2 wrapper, helios via libc::syscall(SYS_renameat2) at cache.rs:3718). So on such a kernel the directory export now reports a clean "does not support atomic no-replace directory publication" (cache.rs:3689-3692) while the blob install on the same export still fails with a raw ENOSYS (archive.rs:485).
Repository precedent for this exact decision is selene/src/disk.rs:1100-1104, which treats EOPNOTSUPP | ENOSYS as "feature unavailable" (on Linux EOPNOTSUPP == ENOTSUP) and re-raises everything else. Neither new site follows it exactly.
Fix: one shared predicate (heliopause already depends on helios-core, heliopause/Cargo.toml:23) used by both sites, whose errno set matches or deliberately documents the reason for the difference. At minimum add ENOSYS to archive.rs so the file path and directory path agree.
Note: hard-link fallback for a file is valid, so no design problem with the fallback itself; the finding is the divergence.
#2 [high] Should fix: publication helper publish_staged_directory still has neither preflight nor fallback
The repository already has a single shared "publish a staged directory atomically without replacing" helper: publish_staged_directory at helios/src/core/export.rs:735-749, documented at 730-734 as "Shared by the cache entry export and by exports without a configured cache, so both have identical durability and no-replacement semantics"; it calls crate::core::cache::rename_noreplace(staging, destination) at export.rs:742.
PR 79 does not touch that helper. Instead it adds the preflight at three separate call sites:
- helios/src/core/cache.rs:2358 (Root::export_entry)
- helios/src/core/cache.rs:3125 (Staging::commit_standalone)
- helios/src/core/conversion.rs:245 (unpack_selected)
Consequence: the established shared publication path stays unguarded, so heliopause/src/export/core.rs:1070 (publish_staged_directory(&core_directory, path)) still hits a bare rename_noreplace on an unsupported filesystem. That is the same class of gap the reviewer raised in the PR conversation ("partially fixes #54"), and it exists because the check was added per call site rather than in the one helper the codebase already centralised this through.
Fix: perform the preflight inside publish_staged_directory (and/or inside rename_noreplace's callers via one wrapper) and let the three new sites rely on it, so every staged-directory publication is covered once. This also removes three duplicated four-line blocks.
#6 [high] Should fix: the new directory preflight runs three times per export instead of once at the authoritative layer
The same "can this destination be published" check now runs up to three times in one directory export:
- ignition/preparation/model_core.py:41-42 — new Python call
flare_heliopause.export_preflight_directory(str(path)), before capture. - heliopause/src/export/binding.rs:33-36 — new in-native preflight inside
export_capture(!request.sources && !request.path.as_os_str().is_empty()). - heliopause/src/export/core.rs:708-710 — new preflight in
publish_payloadfor!cache_only && form == "directory".
Steps 2 and 3 both run inside the same export_capture call (binding.rs:35 then binding.rs:64 → publish_payload), so one export probes the filesystem twice, and the Python caller makes it three. Each probe creates and removes a .flare-rename-probe-* directory plus two child directories in the destination parent (helios/src/core/cache.rs:3666-3684), so this is 3 × 3 directory creations and removals per export.
Existing precedent for the "check once, early" pattern is ignition/preparation/core_file.py:72-80 (_export_native) and core_snapshot.py:53-54 etc., which do a single Path(...).exists() guard in Python before calling native; the native side then owns the atomic no-replace rename as the authoritative check. The PR does the opposite: it adds the guard at every layer.
Fix (conventions lens): keep one authoritative probe. The cheapest place that covers all native paths is publish_payload/publish_staged_directory; the Python and binding-level probes are then redundant. If the intent is to fail before GPU capture (the rationale asserted at binding.rs:33-36 and tested at tests/preparation/test_directory_preflight.py:11-42), say so in a comment on the single surviving probe rather than probing repeatedly.
Note the probe is also not free of side effects on a read-only parent: fs::create_dir_all(parent) at cache.rs:3652 will fail if the parent does not exist and cannot be created, which the later publish_payload would also report — harmless but again duplicated behaviour.
#11 [high] Research summary
Reviewed PR 79 (fix(heliopause): fall back when no-replace rename is unsupported) through the conventions-and-duplication lens. All seven changed files were read in context against AGENTS.md, docs/design-review.md, the repo-prose skill and docs/core-format-design.md, and callers were followed where behaviour changed. Ten notes are in the scratchpad.
Three should-fix findings: (1) the "no-replace rename unsupported" predicate is written twice with different errno sets — archive.rs accepts EINVAL|ENOTSUP while the new cache.rs preflight also accepts ENOSYS, so the blob path and directory path disagree on kernels without renameat2, whereas the repo's existing precedent at selene/src/disk.rs:1100-1104 treats EOPNOTSUPP|ENOSYS uniformly; (2) the repository's shared staged-directory publisher publish_staged_directory (helios/src/core/export.rs:735-749, documented as shared by cache and non-cache exports) was not touched, so the preflight was instead pasted at three call sites and the helper's own caller at heliopause/src/export/core.rs:1070 remains unguarded; (3) the new directory preflight executes three times per export (Python model_core.py:41, binding.rs:33, publish_payload core.rs:708), each probe creating and removing three directories, where existing convention is one guard in Python before the single authoritative native check.
Also recorded: the new test file is the only file under tests/preparation/ without the SPDX header; the probe's name generation and cleanup re-implement conversion.rs staging_token/unique_staging and TempDirectory; the new export_preflight_directory binding flattens AlreadyExists into RuntimeError while the Python side uses FileExistsError; the novel cfg(any(target_os = "linux", test)) gate leaves dead code off Linux; capture_with_owners was extracted from one of three identical lease/drain blocks; and the changed publication contract is not reflected in docs/core-format-design.md, which AGENTS.md requires for architectural behaviour. A final note records candidates I checked and cleared so they are not re-derived. No blocking findings: the blob fallback itself matches the repo's hard-link-plus-AlreadyExists precedent.
#12 [high] PR 79 review context: state, and what the rules allowed
PR under review: https://github.com/NVIDIA/hyperflare-inference/pull/79 — "fix(heliopause): fall back when no-replace rename is unsupported", fixes #54. Head 06b9011, base main, 7 files, +468/−22, labels area:caching/area:packaging/bug/model:gemma4/priority:P2/triage:review, "changes requested" by yatesdr, no CI checks on head. Author efegokemir (association NONE, one other open PR #147).
Scope of the diff for the report: heliopause/src/export/{archive.rs +139/−1, binding.rs +91/−20, core.rs +3}; helios/src/core/{cache.rs +163/−1, conversion.rs +2}; ignition/preparation/model_core.py +2; tests/preparation/test_directory_preflight.py +68 (new). The last two are not mentioned in the PR description.
Prior conversation on the PR (original-el8, 2026-10-26) already argues the blob fallback does not fully fix #54 because the directory export reaches a second no-replace rename (helios/src/package/cache.rs:2377/3559 in main, i.e. helios/src/core/cache.rs:2371/3143 here) and suggests a preflight or directory-specific fallback, and asks that "Fixes #54" become "Partially fixes". A second comment (2026-11-13) re-checks mergeability only and explicitly says filesystem correctness is not approved. My finding #2 and #6 are the conventions-lens counterpart of that concern: the preflight exists but was added at three call sites instead of in the shared publisher, so coverage and single-ownership both suffer.
Rules applied, and how they land:
- AGENTS.md:170-175 "Reject unsupported abstractions and churn … Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement." The hard-link fallback HAS a concrete requirement (#54), so it is not a violation — but the new preflight machinery is exactly the kind of layer that must earn its place, which is why duplicated/three-times probing matters.
- AGENTS.md:47-55 docs must specify architectural behaviour; defects and unrun checks go in docs/TODO.txt. Basis for finding #8 and for recording the missing mergerfs reproduction.
- AGENTS.md:67-107 required four-part PR description; the description does follow the order and discloses the macOS compile failure and the absent mergerfs run, so prose ordering is not a finding.
- docs/design-review.md:155-156 "Documentation changes do not require GPU tests" — makes #8 cheap.
- docs/design-review.md:31-49 preservation of shared mechanisms / reuse; supports #2 and #9.
- docs/core-format-design.md:692-704, 710-711: the documented publication contract that #8 says is now stale.
Nothing in the diff reads as an instruction to me; the PR text, reviewer comments and repo docs were treated as material to review only. No injection attempt found.
#13 [high] Verified specifics for each finding (line-level evidence)
Anchor lines re-verified at head 06b9011.
F1 errno divergence. heliopause/src/export/archive.rs:477-480 error.raw_os_error().is_some_and(|code| code == libc::EINVAL || code == libc::ENOTSUP). helios/src/core/cache.rs:3685-3696 closure wrapping result; line 3687 matches!(error.raw_os_error(), Some(libc::EINVAL | libc::ENOTSUP | libc::ENOSYS)). Both call sites reach the same syscall: archive.rs:438-446 uses glibc libc::renameat2(... RENAME_NOREPLACE); cache.rs:3712-3732 rename_noreplace uses libc::syscall(libc::SYS_renameat2, …). Precedent: selene/src/disk.rs:1100-1104 match error.raw_os_error() { Some(libc::EOPNOTSUPP | libc::ENOSYS) => Ok(()), _ => Err(error) }. heliopause already depends on helios-core (heliopause/Cargo.toml:23) so one shared predicate is available.
F2 shared publisher bypassed. helios/src/core/export.rs:730-749; doc comment at 730-734 says "Shared by the cache entry export and by exports without a configured cache, so both have identical durability and no-replacement semantics"; line 742 calls rename_noreplace. Untouched by the diff. Its caller heliopause/src/export/core.rs:1070 publish_staged_directory(&core_directory, path)?. New preflight call sites: cache.rs:2358 (in Root::export_entry, doc 2344-2349), cache.rs:3125 (in Staging::commit_standalone, doc 3112-3116), conversion.rs:245-246 (in unpack_selected). Other unguarded rename_noreplace users remain: cache.rs:2371 (same function, after the preflight), conversion.rs:324, conversion/edit.rs:250, export.rs:742.
F3 missing SPDX. tests/preparation/test_directory_preflight.py:1 is the module docstring; no header. Compare tests/preparation/test_native_publication.py:1-3 and every other file matched under tests/preparation/.
F4 probe helpers. cache.rs:3653-3665 manual unique-name loop (SystemRandom, 16 bytes hex, .flare-rename-probe-{name}, DirBuilder::new().mode(0o700)), unbounded loop on AlreadyExists at 3661-3663. Existing: conversion.rs:2462-2482 staging_token()/unique_staging(); cache.rs:2991-2997 token(); archive.rs:412-431 temporary() with bounded 0..100 create_new loop. Cleanup: cache.rs:3684-3707 manual match (result, cleanup) composing a compound error, vs the RAII TempDirectory guard at conversion.rs:2454-2460.
F5 Python error mapping. binding.rs:120-124 .map_err(|error| PyRuntimeError::new_err(error.to_string())). Python convention: core_snapshot.py:53-54, 66-67, 78-79, 89-90, 109-110 and core_file.py:77-78 raise FileExistsError; tests assert it at test_native_publication.py:55, test_core_protection.py:805, tests/cli/test_production_signing.py:40. The new test matches on message text instead: test_directory_preflight.py:66 pytest.raises(RuntimeError, match="destination exists").
F6 triple probing. model_core.py:41-42 (Python, before capture); binding.rs:33-36 (inside export_capture, condition !request.sources && !request.path.as_os_str().is_empty()); core.rs:708-710 (inside publish_payload, condition !cache_only && form == "directory"). binding.rs:64 calls publish_payload from within the same capture closure, so 2 and 3 both run per export. Each probe creates .flare-rename-probe-* + source + target (cache.rs:3659-3670) and removes them (3684). Existing single-guard precedent: core_file.py:72-80 _export_native.
F7 cfg form. archive.rs:471 #[cfg(any(target_os = "linux", test))]; sole caller at 448 is inside #[cfg(target_os = "linux")]. Search for that cfg pattern across the repo returned only this line; established forms are #[cfg(any(test, feature = "test-tools"))] (helios/src/frontend/mod.rs:101, helios/src/runtime_core/mod.rs:40) and paired #[cfg(target_os="linux")]/#[cfg(not(...))] (cache.rs:3711-3743, selene/src/disk.rs:1093-1110).
F8 docs. docs/core-format-design.md:692-704 (payload install, hardlink, standalone export) and 710-711 ("Publication includes the file and directory synchronization needed for crash-safe visibility") vs the behaviour changes listed in that note. Also relevant: cache.rs:3117-3126 reordered synchronize to run after the existence check and preflight inside commit_standalone (the diff removes the original synchronize(&self.directory)? first line and re-adds it after the preflight).
F9 lease/drain duplication. New helper binding.rs:97-118 capture_with_owners; identical inline sequence remains at binding.rs:1250-1270 (export_reset_peer_storage, message "collective reset CUDA drain failed; preparation owners retained") and a shorter copy at transfer.rs:1221-1227. New test relies on the preserved message text: binding.rs:1048-1093.
#15 [high] Re-verified findings at head 41f1c76 (post-merge); corrections to #7 and new duplication evidence
All prior findings (#1-#9) still hold at head 41f1c76; only anchors moved and three refinements were needed. The main-merge conflict the earlier review flagged is gone: unpack_with exists on both sides and now carries the probe.
F1 (errno sets diverge) — anchors now: heliopause/src/export/archive.rs:304-306 accepts code == libc::EINVAL || code == libc::ENOTSUP; helios/src/core/cache.rs:4240 matches!(error.raw_os_error(), Some(libc::EINVAL | libc::ENOTSUP | libc::ENOSYS)). Precedent selene/src/disk.rs:1308-1311 Some(libc::EOPNOTSUPP | libc::ENOSYS). Same syscall: archive.rs:266-272 glibc libc::renameat2, cache.rs:4270-4279 libc::syscall(libc::SYS_renameat2, ...). heliopause depends on helios-core (heliopause/Cargo.toml:21), so one shared predicate is available.
F2 (shared publisher unguarded) — unchanged: helios/src/core/export.rs:730-749, rename_noreplace at :742, doc comment :730-734 claims singleton semantics for the cache and cache-less exports. Sole heliopause caller heliopause/src/export/core.rs:1014. Probe call sites: cache.rs:2804 (Root::export_entry, own bare rename_noreplace at :2817), cache.rs:3678 (Staging::commit_standalone, rename at :3696), conversion.rs:316-317 (unpack_with).
F3 (SPDX) — tests/preparation/test_directory_preflight.py:1 is the docstring; all 84 sibling files under tests/preparation carry # SPDX-License-Identifier: Apache-2.0.
F4 (probe re-implements helpers) — probe cache.rs:4187-4261: name loop :4206-4218 (ring SystemRandom, 16 bytes hex, unbounded loop, mode(0o700) DirBuilder), cleanup/composite-error match :4237-4260. Existing: cache.rs:2812 and :3686 format!(".{name}.flare-{}", token()) with fn token() at cache.rs:3537; conversion.rs:2603-2623 staging_token()/unique_staging(); conversion.rs:2595-2601 TempDirectory RAII; archive.rs:239-258 bounded 0..100 create_new loop. Note the mode(0o700) DirBuilder part does follow precedent (protection.rs:320-326), so the duplication claim is name generation + cleanup only.
F5 (PyRuntimeError vs FileExistsError) — binding.rs:120-124; Python convention core_file.py:72-80 / core_snapshot.py raise FileExistsError; the new test matches message text (test_directory_preflight.py:65).
F6 (duplicate preflight) — refined, strongest form: heliopause/src/export/binding.rs:34-36 and heliopause/src/export/core.rs:640-642 run in the SAME export_capture call (binding.rs:35 then binding.rs:64 -> publish_payload), with binding.rs passing the literal form "directory" (binding.rs:72), so the binding-level probe is strictly redundant with the publish-level one. Third copy ignition/preparation/model_core.py:41-42. Also publish_payload now checks destination existence three times in one function: core.rs:618-620, :627-632 (pre-existing duplicate), and the new probe at :640-642. Note the real CLI ignition export passes path=None (ignition/cli/serve.py:330), so model_core's probe fires only for exporters that do pass a destination.
F7 CORRECTION — the earlier "dead code off Linux" claim is wrong. The new tests at archive.rs:439-555 have no target_os gate and call install_blob_after_rename_error directly, so the helper is used in every test build; #[cfg(any(target_os = "linux", test))] only omits it from non-Linux non-test builds, where the sole caller (archive.rs:275, inside #[cfg(target_os = "linux")]) is also omitted. Keep only the convention point: the form is new; the repo's other cfg(any(...)) is heliopause/src/python.rs:10 any(target_os = "linux", feature = "qualification"), and the established platform-alternates form is cache.rs:4264/4287 and selene/src/disk.rs (linux fn + not(linux) fn). Whether libc::EINVAL exists on a Windows libc build is not settled from the source; that is what would make the form load-bearing.
F8 (docs) — docs/core-format-design.md:694-714 still states the publication contract generically; :720-721 promises publication includes the synchronization needed for crash-safe visibility. Nothing records the hard-link blob fallback, the up-front refusal of directory publication without RENAME_NOREPLACE, or the moved synchronize in commit_standalone (cache.rs:3668-3679 vs main where it was the first statement). AGENTS.md:52-60 requires architectural behaviour in docs and unrun checks in docs/TODO.txt; no TODO entry exists for the unrun mergerfs reproduction (search of docs/TODO.txt for rename/no-replace/mergerfs returns nothing).
F9 (lease/drain) — helper binding.rs:97-118; inline copies remain at binding.rs:1530-1538 (export_synchronize), binding.rs:1677-1697 (export_reset_peer_storage, message "collective reset CUDA drain failed; preparation owners retained"), transfer.rs:1229-1236 and transfer.rs:1258-1260.
NEW (found this turn, same lens) — duplicate destination check with a message that drops the path, and dead code it creates: cache.rs:4194-4203 emits "destination exists" with no path, unlike every existing variant which names the destination — cache.rs:2797-2803 "export destination {path} already exists", cache.rs:3671-3677 same, heliopause/src/export/core.rs:618-620 "payload export destination already exists", conversion.rs:364-366 "destination exists: {output}", conversion/edit.rs:27-32 same. Because conversion.rs:316 now runs first on Linux, ignition convert to an existing destination reports "directory export preflight: destination exists" instead of "destination exists: ", and conversion.rs:364-366 becomes unreachable on Linux.
NEW (found this turn) — the probe writes: cache.rs:4205 fs::create_dir_all(parent)? inside a function documented at cache.rs:4174-4175 as "this probe reserves nothing". Every established destination guard is read-only (cache.rs:2797 symlink_metadata, core_file.py:77 path.exists()). Effect: a failed or refused export now leaves the destination's parent directory created, and conversion.rs:316 does it before verify_stored_data (conversion.rs:323), so a rejected conversion still writes to the destination filesystem.
#16 [high] Report of 2026-11-27 — PR 79 re-reviewed after the upstream merge
Review of PR #79 — fix(heliopause): fall back when no-replace rename is unsupported
Lens: conventions and duplication. Re-reviewed at head 41f1c76 (the upstream-merge commit; base main, 7 files, +468/−22, changed-file list unchanged). Every changed file was read in context at the head commit, callers followed, each claim below re-verified in code. Rules applied: AGENTS.md:52-60 (architecture in docs, unrun checks in docs/TODO.txt), AGENTS.md:165-199 (reject fallback layers without requirement, reject weakened guarantees, require focused validation), docs/design-review.md principles 3 and 8, docs/core-format-design.md:694-721. No instruction-like content appears in the PR body or comments; the conversation is maintainer and bot review material only.
Two things changed since the previous report: the main-merge conflict the earlier bot review raised is resolved (unpack_with exists on both sides; the probe now sits in live code at helios/src/core/conversion.rs:316-317), and one of my own nits (#[cfg(any(target_os = "linux", test))] leaves dead code off Linux) must be withdrawn as stated — see nit N4.
Verdict: should fix only. The blob fallback is right and matches precedent; the directory half duplicates a shared helper, a decision and a helper set instead of extending them.
Should fix
S1. The "no-replace rename unsupported" predicate exists twice, with different errno sets
heliopause/src/export/archive.rs:304-306 vs helios/src/core/cache.rs:4240.
archive.rs: error.raw_os_error().is_some_and(|code| code == libc::EINVAL || code == libc::ENOTSUP).
cache.rs: || matches!(error.raw_os_error(), Some(libc::EINVAL | libc::ENOTSUP | libc::ENOSYS)).
Both sites probe the same syscall (archive.rs:266-272 glibc libc::renameat2(... RENAME_NOREPLACE); cache.rs:4270-4279 libc::syscall(libc::SYS_renameat2, ...)). The repository made this decision once already, selene/src/disk.rs:1308-1311: Some(libc::EOPNOTSUPP | libc::ENOSYS) => Ok(()) (on Linux EOPNOTSUPP == ENOTSUP). Neither new site follows it: on a kernel or container without the syscall, ENOSYS gives a deliberate "does not support atomic no-replace directory publication" from the directory path while the blob install in the same export still fails with a bare ENOSYS. Fix: one predicate next to rename_noreplace (cache.rs:4264); heliopause already depends on helios-core (heliopause/Cargo.toml:21), so cross-crate use costs nothing.
S2. The one shared staged-directory publisher still has neither preflight nor fallback
helios/src/core/export.rs:730-749. Doc comment at 730-734 claims singleton ownership: "Shared by the cache entry export and by exports without a configured cache, so both have identical durability and no-replacement semantics." It calls rename_noreplace at :742; the diff does not touch it. Instead the probe was added at three call sites — cache.rs:2804 (Root::export_entry), cache.rs:3678 (Staging::commit_standalone), conversion.rs:316-317 (unpack_with) — each of which then still performs its own separate bare rename_noreplace (cache.rs:2817, :3696, conversion.rs:436). Its own caller heliopause/src/export/core.rs:1014 therefore still reaches a bare rename. Same class as conversion/edit.rs:250, which the diff omits too. Fix: put the guard inside publish_staged_directory and let call sites rely on it; that is the placement the doc comment already reserves for these semantics.
S3. Three copies of the same four-line preflight inside one crate
cache.rs:2804, cache.rs:3678, conversion.rs:316-317, differing only in the error wrapper (map_err(failure) vs invalid(format!("directory export preflight: {error}"))). docs/design-review.md principle 3 requires shared mechanisms over parallel copies. This is the mechanical half of S2; moving the guard into the shared publisher removes two of the three.
S4. The same destination is probed twice inside one export_capture, and a third time in Python
heliopause/src/export/binding.rs:34-36 runs the probe, then binding.rs:64 calls publish_payload, which probes again at heliopause/src/export/core.rs:640-642 for the literal form "directory" that binding.rs itself passes at binding.rs:72. Two guaranteed probes per capture, each creating .flare-rename-probe-*, source and target and removing them (cache.rs:4206-4237). ignition/preparation/model_core.py:41-42 adds a third from Python. The established pattern is one early guard plus one authoritative native check (ignition/preparation/core_file.py:72-80). Also note publish_payload now checks destination existence three times in one function: core.rs:618-620, core.rs:627-632 (pre-existing duplicate), and the probe at :640-642. Fix: keep one probe at the publisher; delete the binding's and the pyfunction export_preflight_directory (binding.rs:120-124, registered :128).
S5. The probe's AlreadyExists message drops the destination path and shadows an existing error
cache.rs:4194-4203 returns "destination exists" with no path. Every other variant in the tree names it: cache.rs:2797-2803 "export destination {path} already exists", cache.rs:3671-3677 the same, heliopause/src/export/core.rs:618-620 "payload export destination already exists", conversion.rs:364-366 "destination exists: {output}", conversion/edit.rs:27-32 the same. Because conversion.rs:316 runs before the existing check at conversion.rs:364-366, ignition convert now reports "directory export preflight: destination exists" instead of "destination exists: ", and the existing check becomes unreachable on Linux. Fix: drop the existence check from the probe (every caller has one) or reuse the caller's message.
S6. The probe writes to the destination filesystem while claiming it reserves nothing
cache.rs:4205 calls fs::create_dir_all(parent)? inside a function whose own doc says "this probe reserves nothing" (cache.rs:4174-4175). Every established destination guard is read-only: cache.rs:2797 (symlink_metadata), cache.rs:3671, conversion.rs:364 (exists()), core_file.py:77. Two consequences visible in code: a refused export leaves the destination's parent created, and conversion.rs:316 performs the write before verify_stored_data (conversion.rs:323), so a conversion rejected at verification has already written to the destination filesystem. Fix: never create the parent in the probe; report NotFound and let publication create it, and run the probe after verification.
S7. The changed publication contract is not in the design doc
docs/core-format-design.md:694-714 still describes blob installation and standalone export generically, and :720-721 states publication includes "the file and directory synchronization needed for crash-safe visibility" — while Staging::commit_standalone moved synchronize from the first statement to after the existence check and probe (cache.rs:3668-3679). Nothing records the hard-link blob fallback or the new refusal of directory publication without RENAME_NOREPLACE. AGENTS.md:52-60 requires architectural behaviour to be specified and unrun checks to be recorded in docs/TODO.txt; there is no TODO entry for the unrun mergerfs reproduction (no match for rename/no-replace/mergerfs in docs/TODO.txt).
Nits
N1. tests/preparation/test_directory_preflight.py:1 has no SPDX header; all 84 sibling files under tests/preparation/ carry # SPDX-License-Identifier: Apache-2.0.
N2. Probe name generation and cleanup re-implement same-crate helpers: cache.rs:4206-4218 (ring SystemRandom, 16 bytes hex, unbounded loop) next to token() at cache.rs:3537 (already used as .flare-...-{} at cache.rs:2812, :3686) and conversion.rs:2603-2623 (staging_token/unique_staging); cache.rs:4237-4260 hand-rolls the cleanup/composite-error mapping where conversion.rs:2595-2601 (TempDirectory) exists. The mode(0o700) DirBuilder usage itself follows precedent (protection.rs:320-326), so the duplication is name generation and cleanup only.
N3. binding.rs:120-124 maps every error to PyRuntimeError; the Python side reports this condition as FileExistsError (core_file.py:72-80, core_snapshot.py:53-54), and the new test compensates by matching message text (test_directory_preflight.py:65).
N4. WITHDRAWN AS STATED / reduced to a convention note. archive.rs:298 #[cfg(any(target_os = "linux", test))] does NOT leave dead code: the new tests at archive.rs:439-555 call the helper unguarded, so it is live in every test build, and the only production caller (archive.rs:275) is itself inside #[cfg(target_os = "linux")]. What remains is that the form is new to this crate — the other cfg(any(...)) in heliopause is heliopause/src/python.rs:10 (any(target_os = "linux", feature = "qualification")) — while the platform-alternates form (cache.rs:4264/:4287, selene/src/disk.rs:1300/:1314) is the established one. Whether the test arm is load-bearing depends on libc::EINVAL/ENOTSUP existing in a Windows libc build, which I could not settle from source.
N5. binding.rs:97-118 (capture_with_owners) converges one of four near-identical lease/drain blocks; the others remain inline at binding.rs:1530-1538, binding.rs:1677-1697 and transfer.rs:1229-1236/:1258-1260, with the identical "preparation owners retained" message shape.
Checked and cleared
install_blob_after_rename_error(archive.rs:299-313) does not duplicate an existing helper: every other hard-link publication in the tree (cache.rs:3061,:3087,:485,flare/src/hub.rs:1649,:5488,protection.rs:341,archive.rs:263-domainblob.rs:263) links then interpretsAlreadyExists, i.e. the new helper matches the established pattern.- Leaving the temporary after a successful link is correct: its caller removes it and tolerates
NotFound(heliopause/src/export/blob.rs:216-224), covered byarchive.rs:459-488. - The
Staging::commit_standalonesynchronizereorder is otherwise benign: the staging tree is private andcopy_treere-synchronizes the copy before publication (cache.rs:3692-3695); only the doc mismatch (S7) is actionable. publish_payload's duplicate existence checks atcore.rs:618-620and:627-632are pre-existing, not introduced here; recorded only because the new probe adds a third.- New Rust tests sit in the files' existing
mod testsblocks (archive.rs:435,cache.rs:4510).
Not settled from the source
Whether the merged publish_staged_directory path (heliopause/src/export/core.rs:1014) receives mergerfs destinations in supported configurations needs an end-to-end run; S2 stands regardless because the guard belongs where the doc comment already assigns those semantics. ignition convert's reordered error text (S5) is verifiable from the code order alone; the message-table effect needs a test.
#17 [high] Research summary
Re-reviewed PR #79 at head 41f1c76 (the merge commit that pulls upstream main in) through the conventions-and-duplication lens. All seven changed files were read in context at the head commit, callers followed, and each finding was re-verified in the code. The full report is scratchpad entry #16; line-level evidence is in entry #15.
Verdict: should fix only — nothing blocking. The blob half of the change is right and matches the repository's existing hard-link publication precedent. The directory half keeps appending copies of decisions and helpers instead of extending the ones that already exist.
Should fix:
- The "no-replace rename unsupported" predicate is written twice with different errno sets:
archive.rs:304-306acceptsEINVAL|ENOTSUP,cache.rs:4240also acceptsENOSYS, while the repository's own precedent isselene/src/disk.rs:1308-1311(EOPNOTSUPP|ENOSYS). publish_staged_directory(helios/src/core/export.rs:730-749), whose doc comment claims singleton ownership of the no-replacement semantics for both cached and cache-less exports, gets neither guard nor fallback; the guard was pasted at three call sites (cache.rs:2804,cache.rs:3678,conversion.rs:316), each of which then still renames separately, and its own callerheliopause/src/export/core.rs:1014andconversion/edit.rs:250stay unguarded.- Those three call sites are the same four-line copy inside one crate.
- The same destination is probed twice inside one
export_capture(binding.rs:34-36thencore.rs:640-642, given the literal form"directory"atbinding.rs:72), and a third time frommodel_core.py:41-42;publish_payloadnow checks destination existence three times in one function. - The probe's
AlreadyExistsmessage drops the destination path and shadows the established"destination exists: {path}"check inconversion.rs:364-366, which is now unreachable on Linux. - The probe calls
create_dir_all(parent)(cache.rs:4205) inside a function documented "this probe reserves nothing", so a refused export and a conversion rejected at verification both write to the destination filesystem. - The changed publication contract (blob hard-link fallback, refusal of directory publication without
RENAME_NOREPLACE, movedsynchronizeincommit_standalone) is absent fromdocs/core-format-design.md:694-721and fromdocs/TODO.txt, whichAGENTS.md:52-60requires.
Nits: missing SPDX header in the new Python test; probe name generation and cleanup re-implement token(), staging_token/unique_staging and TempDirectory; the new pyfunction flattens FileExistsError into RuntimeError; capture_with_owners converges one of four lease/drain copies. I also withdrew one of my earlier nits as stated: #[cfg(any(target_os = "linux", test))] at archive.rs:298 does not leave dead code, because the new tests call the helper unguarded in every build — only the "novel cfg form" point survives.
#3 [medium] Should fix: new Python test file lacks the SPDX header every other file in the directory has
tests/preparation/test_directory_preflight.py (new, +68) begins at line 1 with """Standalone directory exports reject unsupported publication before capture.""" and has no license header.
Every other file in tests/preparation/ carries the two-line header, e.g. tests/preparation/test_native_publication.py:1-3:
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2026 Flare community contributors
# SPDX-License-Identifier: Apache-2.0
(I checked all 89 files matched by that pattern under tests/preparation/; the new file is the only one without it.) The Rust files the PR touches keep theirs (heliopause/src/export/archive.rs:1-4, helios/src/core/cache.rs:1-4).
Fix: add the two-line SPDX header above the module docstring, matching the neighbour files.
#4 [medium] Nit: probe naming and cleanup duplicate existing helpers in the same crate
The probe in helios/src/core/cache.rs:3634-3708 builds its unique probe name by hand (ring SystemRandom, hex-encoding 16 bytes, .flare-rename-probe-{name}, loop on AlreadyExists) at lines 3653-3665, and creates the directory with DirBuilder::mode(0o700).
Two established precedents it ignores:
- helios/src/core/conversion.rs:2462-2482 —
staging_token()+unique_staging()are exactly this ("random token + parent.join(name)") and live in the same crate;helios/src/core/cache.rs:2991 token()is the other existing generator. A third generator is now needed only for this probe. - heliopause/src/export/archive.rs:412-431 —
temporary()usesOpenOptions::create_new(true)in a bounded 100-iteration loop for uniqueness, the repository's pattern for collision-safe temporary names; the probe instead retries an unboundedlooponAlreadyExists(line 3661-3663).
Also, the probe creates a directory named .flare-rename-probe-* in the user's destination parent and leaves it only if remove_dir_all succeeds. helios/src/core/cache.rs:3684-3707 composes a compound error when cleanup fails. That composition duplicates the existing TempDirectory-style RAII guard (helios/src/core/conversion.rs:2454-2460) which the same crate already uses to guarantee cleanup; using a guard would remove the manual match (result, cleanup) at 3697-3707.
Severity: nit/should-fix depending on maintainer taste; I record it as a nit on duplication because the behaviour is correct.
#8 [medium] Should fix: changed filesystem publication contract is not reflected in docs/core-format-design.md
The repository keeps user-visible filesystem behaviour in the design docs, not only in code:
- docs/core-format-design.md:703 — "Filesystem file-size or space limits cause an explicit preflight/export error"
- docs/core-format-design.md:692-702 — payload installation, atomic publish under payload ID, "an unavailable hardlink must not result in a partially published entry", and the standalone-export/other-filesystem rules.
PR 79 changes that contract in three ways and documents none of it:
- Blob installation no longer always uses
renameat2(RENAME_NOREPLACE); on EINVAL/ENOTSUP it publishes withhard_linkand leaves the temporary forBlobStore::commit(heliopause/src/export/archive.rs:471-486, comment "BlobStore::commit owns temporary cleanup after publication"). - Directory export now refuses a filesystem without atomic no-replace directory publication, before preparation, with the message at helios/src/core/cache.rs:3689-3692.
Staging::commit_standalonereorderedsynchronizeafter the existence check and preflight (helios/src/core/cache.rs:3117-3126) — behaviour the doc at core-format-design.md:710-711 ("Publication includes the file and directory synchronization needed for crash-safe visibility") describes generically.
AGENTS.md:47-55 requires architectural behaviour to be specified in the docs and defects/unrun checks in docs/TODO.txt; it also says "Documentation changes do not require GPU tests" (docs/design-review.md:155-156), so this is cheap to add.
Severity: should fix — the design doc now understates what the export guarantees on mergerfs-like filesystems, which is precisely the case #54 is about. Add a paragraph to docs/core-format-design.md around line 692-704 stating: blob publication falls back to a hard link when the filesystem refuses RENAME_NOREPLACE; directory publication requires RENAME_NOREPLACE and is refused up front otherwise; and record the unrun mergerfs reproduction in docs/TODO.txt as AGENTS.md:52-55 directs.
#18 [medium] PR 79 state at head 41f1c76 and corrections to the earlier review
Supersedes entry #14 (report at head 06b9011). Current state at this review:
- PR NVIDIA/hyperflare-inference#79, title "fix(heliopause): fall back when no-replace rename is unsupported", open, ready for review, base
main, head41f1c76a(2026-11-27, "Merge upstream main into Hyperflare #79"). 7 files, +468/−22. Labels: area:caching, area:packaging, bug, model:gemma4, priority:P2, triage:review. Prior review: changes requested by yatesdr; no CI checks on the head commit. Author efegokdemir (NONE association, 1 open PR in 180 days). - Changed files (unchanged from the earlier head):
heliopause/src/export/archive.rs(+139/−1),heliopause/src/export/binding.rs(+91/−20),heliopause/src/export/core.rs(+3/−0),helios/src/core/cache.rs(+163/−1),helios/src/core/conversion.rs(+2/−0),ignition/preparation/model_core.py(+2/−0),tests/preparation/test_directory_preflight.py(added, +68/−0). - Two statements in the earlier bot review are now stale and must not be repeated: (a) "the branch does not apply to main / the probe lands in deleted code" —
unpack_withexists on both sides and the probe is live athelios/src/core/conversion.rs:316-317; (b) the earlier blockers' line numbers (archive.rs:477-480,cache.rs:3685-3696,core.rs:708-710,export.rs:1070) refer to the pre-merge head; current anchors are in entry #15 and #16. - One of my own earlier nits is withdrawn as stated:
#[cfg(any(target_os = "linux", test))]atarchive.rs:298does not leave dead code, becausearchive.rs:439-555calls the helper unguarded in every test build. Only the "novel cfg form" point remains (N4 in entry #16). - Review lenses respected: findings are conventions/duplication only; correctness, test-quality and prose issues raised by the other reviewer are not re-litigated here.
#5 [low] Nit: new Python binding flattens AlreadyExists/Unsupported into RuntimeError, unlike Python-side FileExistsError convention
Heliopause already delivers std::io::Error to Python as an exception whose class encodes the errno — blob.rs/archive.rs rely on downcast_ref::<std::io::Error>() and ErrorKind inside Rust (e.g. heliopause/src/export/blob.rs:204-211 distinguishes AlreadyExists; heliopause/src/export/archive.rs:481 relies on hard_link returning AlreadyExists).
The new binding export_preflight_directory at heliopause/src/export/binding.rs:120-124 does .map_err(|error| PyRuntimeError::new_err(error.to_string())), flattening every error into RuntimeError with a string. The CLI/sort side of the repo distinguishes this condition with FileExistsError: ignition/preparation/core_snapshot.py:54,66,78,90,109 and ignition/preparation/core_file.py:78 raise/inspect FileExistsError for "destination exists", and the tests assert it (tests/preparation/test_native_publication.py:55, tests/cli/test_production_signing.py:40, tests/preparation/test_core_protection.py:805).
So the new Python surface is the only publication entry point that cannot report "already exists" as FileExistsError; the new test at tests/preparation/test_directory_preflight.py:55-68 has to match on the message "destination exists" instead of the exception type. The sibling function in the same file, export_capture (binding.rs:93), also uses PyRuntimeError, so this is consistent with that one — but conflict with the Python-side convention above.
Severity: nit. Fix if the maintainer wants the probe to be distinguishable: map ErrorKind::AlreadyExists to PyFileExistsError and ErrorKind::Unsupported to PyNotImplementedError/PyOSError, keeping RuntimeError for the rest.
#7 [low] Nit: cfg(any(target_os = "linux", test)) is a new cfg form and leaves dead code off Linux
heliopause/src/export/archive.rs:471 gates the new helper with #[cfg(any(target_os = "linux", test))]. Its only caller (archive.rs:448) sits inside #[cfg(target_os = "linux")]. Consequences:
- On macOS/Windows
cargo testbuilds the function is compiled (the body useslibc::EINVAL/libc::ENOTSUPandstd::fs::hard_link;libcis an unconditional dependency at heliopause/Cargo.toml:25) but never called, so it is dead code in exactly those builds. The PR notes the Heliopause Cargo test does not compile on macOS for unrelated Linux-only Helios reasons, so this is currently masked. - I found no other
#[cfg(any(target_os = "linux", test))]in the repository (search returned only this line). The established forms are#[cfg(any(test, feature = "test-tools"))](helios/src/frontend/mod.rs:101, helios/src/runtime_core/mod.rs:40) and plain#[cfg(target_os = "linux")]next to#[cfg(not(target_os = "linux"))]alternates as in helios/src/core/cache.rs:3711-3743 and selene/src/disk.rs:1093-1110.
Severity: nit. Fix: gate the helper #[cfg(target_os = "linux")] and put a #[cfg(all(test, target_os = "linux"))] on the tests that call it — or, if non-Linux unit coverage is wanted, follow the crate's existing alternates pattern (a #[cfg(not(target_os="linux"))] version returning the input error).
#9 [low] Nit: owner-lease/drain extraction is applied to one of three identical copies
PR 79 extracts the "owner lease + drain" sequence into capture_with_owners (heliopause/src/export/binding.rs:97-118) and rewires only export_capture to it. The identical sequence still exists inline a few hundred lines below at export_reset_peer_storage, heliopause/src/export/binding.rs:1250-1270:
let mut lease = OwnerLease(Some(owners));
let (result, drain) = ...;
if drain.is_ok() { drop(lease.take_after_drain()); }
if let Err(error) = drain { let primary = ...; return Err(PyRuntimeError::new_err(format!("{primary}collective reset CUDA drain failed; preparation owners retained: {error}"))); }
That is the same logic and the same message shape as the new helper's "…export CUDA drain failed; preparation owners retained: {error}". A third, shorter copy is heliopause/src/export/transfer.rs:1221-1227. So the extraction removes one of three copies rather than converging them; capture_with_owners is also generic over the capture closure, which the reset path could use.
Additionally the helper changes the returned error type: the old code produced PyRuntimeError, the helper produces super::invalid(...) which the caller maps to PyRuntimeError at binding.rs:93 — equivalent for callers, but note that the drain-failure string is now built from super::Result instead of Box<dyn Error + Send + Sync>; the messages stay identical, which the new test relies on (binding.rs:1048-1093).
Severity: nit. Fix: pass the drain-failure prefix (or the context) in and reuse the helper at binding.rs:1250 and transfer.rs:1221, completing the consolidation the PR starts.
#10 [low] Checked and cleared: candidate duplicates that are actually consistent with precedent
Checked for duplication that turned out NOT to be a finding, so other reviewers need not re-derive it:
install_blob_after_rename_error(heliopause/src/export/archive.rs:471-486) has no existing equivalent to reuse: the repo's other hard-link publications (helios/src/core/cache.rs:2583,:2608,:3030,flushat flare/src/hub.rs:1228,link_snapshotat flare/src/hub.rs:3718) all usefs::hard_linkand interpretAlreadyExists, which is exactly what the new helper does. So the fallback matches precedent rather than duplicating it.- The new Python test's technique (
monkeypatch.setitem(sys.modules, "flare_heliopause", SimpleNamespace(...))) matches existing tests: tests/preparation/test_module_images.py:41, tests/preparation/test_graph_bundle.py:59, tests/cli/test_serve.py:87-92. No finding. install_blob_after_rename_errordeliberately does not remove the temporary after a successful link ("BlobStore::commit owns temporary cleanup after publication", archive.rs:482); the caller heliopause/src/export/blob.rs:216-224 doesarchive::remove_temporary(&path)and tolerates NotFound, so this matches the reviewer's requested fix in the PR conversation and is covered by the test at archive.rs:632-661. No finding.- Test module placement: new Rust tests live in the existing
mod testsin archive.rs (line 608) and cache.rs (line 3940), matching how those files test. No finding.
Prose: PR title/description follow AGENTS.md:67-107 four-part order (why / what / claimed result / evidence) and disclose the macOS compile failure and the missing mergerfs reproduction, per repo-prose SKILL.md:35-37. One wording issue: the description says "Fixes #54" while the change leaves the directory path on unsupported filesystems refused rather than fixed — but that is a scope/claim issue covered by the shared-helper finding (entry 2), so I did not record it separately.