Verdict: worth it with changes — keep the blob fallback, drop the directory-preflight half
The PR is really two changes: (a) a ~15-line hard-link fallback for unsupported renameat2(RENAME_NOREPLACE) in install_blob, and (b) a ~450-line directory-publication-preflight subsystem spread over 6 other files. (a) is the right fix in the right place. (b) is dead code on the only CLI path, does not achieve its stated purpose, adds a new public API and a Python binding, and should be removed. Merge (a) after a rebase; do not merge (b).
Why (a) is worth it
- It fixes a real, reproducible user-facing bug. Issue #54's
stracepoints at exactlyinstall_blob(heliopause/src/export/archive.rs:432-470) and the failure surfaces asInvalid argument (os error 22)at "Scan and copy reachable storage" (heliopause/src/export/capture.rs:3232). Where that path runs, the patch converts a hard failure into a working export — not a swallowed error:EEXISTstill propagates asAlreadyExistsso the no-clobber guarantee is intact, and every other errno is re-raised unchanged (archive.rs:477-485). - It removes a requirement instead of adding machinery.
install_blobwas the outlier in this tree: hard-link publication is already the norm at 8 sites the issue lists, and the maintainer citeshelios/src/core/cache.rs:2583and:3030as precedent. Falling back tolink()needs no capability probe, no new API, and no user-visible policy. - Cost is minimal and off the hot path. ~15 lines of logic, runs only after a failed rename, no allocation, no new dependency (
libcalready used;std::fs::hard_link). Complexity is one extra error branch in a function that already has one. - No durability regression. Blobs are fsynced at
heliopause/src/export/blob.rs:191before install; neither the oldrenameat2path nor the newlinkpath is followed by a directory fsync for the blobs directory, so the patch neither improves nor degrades durability. The "atomic publication" claim is accurate for content: the name appears already-complete. - The earlier cleanup nit was taken. The helper no longer unlinks the temporary;
blob.rs:216-224owns cleanup and toleratesNotFound, which is the right seam. - Beneficiaries: people whose package cache sits on mergerfs/FUSE (issue's environment: Proxmox LXC pool). For them it saves a full ~20-minute preparation pass per retry. This is small but real, aligns with "help more people run Flare locally," and is not a new feature flag or per-model branch.
- One caveat on the "no-replace" claim: a
link()is notlinkat(AT_EMPTY_PATH)on the open descriptor, so a malicious local process could swap the temporary between the failed rename and the link. That exposure already exists in the linked-then-reopened pattern here and in the 8 precedent sites; worth one sentence in a comment, not a blocker.
Why (b) should be dropped
I verified the maintainer's blocking points against the tree:
- The preflight never runs from
ignition export. The only production caller,ignition/cli/serve.py:371, passespath=None, socache_only=Trueand both the new Python check (ignition/preparation/model_core.py:41-42) and the new binding check (heliopause/src/export/binding.rs:33-36) are unreachable.ignition/preparation/host_ranks.py:501does the same viacombine(None if cache_only else path, ...). - It does not fail early, so it does not fix the cost problem that motivated the issue. The probes at
helios/src/core/cache.rs:2358(Root::export_entry) and:3125(Staging::commit_standalone) run at publication, after capture, staging and CUDA work — the same place the old error already arrived. The only effect is a better error message. - Coverage is still incomplete.
helios/src/core/export.rs:735-749(publish_staged_directory, called fromheliopause/src/export/core.rs:1070) andhelios/src/core/conversion/edit.rs:250still publish with a barerename_noreplaceand are unguarded. Adding a guard to only some of five call sites produces inconsistent behaviour: some directory exports fail early with "unsupported", others still fail late withos error 22. - It contradicts the charter's "don't reinvent / smallest footprint" rule and duplicates existing structure. The probe creates a random
0700directory, usesring::rand::SystemRandomfor a nonce (cache.rs:3638), createssource/targetinside it, performs a no-replace rename, removes it again, and needs bespoke error reclassification ofEINVAL|ENOTSUP|ENOSYSto a strerror string. That is ~70 lines of filesystem self-verification for a bug whose actual fix is 15 lines of link fallback in one function. - It adds a public API and a new Python-visible symbol (
export_preflight_directory,heliopause/src/export/binding.rs:120-128) with only one caller, plus acapture_with_ownerswrapper (binding.rs:97-118) created solely to host it. - Two unremarked behaviour changes to
commit_standalone:- The probe calls
fs::create_dir_all(parent)(cache.rs:3652) beforesynchronize(&self.directory)and before the staging copy, so a failing preflight now leaves a new empty parent directory behind. synchronize(&self.directory)was moved from the start ofcommit_standaloneto after the check, so a staging tree is synchronised later than before. Harmless-looking but bootstrapped onto a change unrelated to the bug.
- The probe calls
- It makes a previously-working configuration fail by fiat. A user happily writing a directory core to a filesystem without
RENAME_NOREPLACEwould now get a hard refusal with no documented alternative, and the compensating doc change (docs/multi-host.md:275) was requested but not made. - Evidence does not match the description. The body describes only commit one and still says "the temporary name is removed," which moved to the caller; it claims "Fixes #54" when a mergerfs directory export still fails. Tests are also weaker than they look: the five
archive.rstest cases callinstall_blob_after_rename_errordirectly (including inventingEINVALto exercise the fallback), so the actualrenameat2branch ofinstall_blobhas no test, andtests/preparation/test_directory_preflight.pyreplacesflare_heliopause,torchandtorch.distributedinsys.modules, so it asserts call order rather than behaviour. Thecapture_with_ownerstest atbinding.rs:1046-1071is essentially the pre-existinglifetime.rstest again. The PR's own evidence is 3 helper tests,rustfmtandgit diff --check— the charter requires the four-part description and real evidence, not a formatter pass.
Conditions for merging
- Rebase. The conflict is real:
mainmadeunpack_selecteda wrapper overunpack_with(helios/src/core/conversion.rs:300-305), so the PR's hunk atconversion.rs:245no longer applies. Also fold the fixup commits and addSigned-off-byperCONTRIBUTING.md(not opened). - Revert everything except
heliopause/src/export/archive.rs— droppreflight_directory_publicationand its call sites (helios/src/core/cache.rs,helios/src/core/conversion.rs), the binding and its registration,capture_with_owners, theheliopause/src/export/core.rsandignition/preparation/model_core.pyhooks, andtests/preparation/test_directory_preflight.py. - Add one seam test for
install_blobthat does not require mergerfs, in the style ofpreflight_directory_publication_with's injected rename: thread a rename function throughinstall_bloband assert (i)EINVALinstalls by link and leaves the destination readable, (ii) an existing destination still reportsAlreadyExists, (iii) an unrelated errno is preserved, (iv) the caller removes the temporary. - Unify the fallback errno set and keep it minimal —
EINVALandENOTSUPas now. ConsiderENOSYS(old kernels) only if a supported target needs it; do not silently swallow anything else. - Rewrite the description to the four required parts and say "Partially fixes #54," noting explicitly which filesystems remain unsupported for directory publication and that they still fail with a clear
EINVAL. - Separate, optional follow-ups (not blockers here): document that directory core publication requires filesystem no-replace-rename support next to the same-filesystem rule at
docs/multi-host.md:275; and improve the error text ofrename_noreplace(helios/src/core/cache.rs:3712-3732) to name both paths, which fixes the opacity part of #54 for every call site for a few lines.
Answer to the framing question
The blob fallback is worth making: a genuine bug, a 15-line fix in the function the bug report fingered, no hot-path cost, no new surface, and it deletes a filesystem requirement rather than adding a policy. The rest of the branch is not worth making: it does not run where users invoke the feature, does not make the failure any earlier, leaves two of five publication sites unchanged, and costs roughly 30x the code of the actual fix. Dropping it is the simpler path to the same end.