Skip to content

fix(fleet): publish immutable files by exclusive rename - #6432

Closed
Hmbown wants to merge 1 commit into
mainfrom
fix/fleet-exclusive-rename-publication
Closed

Hmbown wants to merge 1 commit into
mainfrom
fix/fleet-exclusive-rename-publication

Conversation

@Hmbown

@Hmbown Hmbown commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Unix no-replace publication used linkat followed by unlinkat, which
briefly leaves the entry with two links. A concurrent reader correctly
rejects that under the singly-linked-file guard, so identical concurrent
tool-media publications produced different metadata
(tool_media_publication_is_immutable_and_replay_preserves_manifest on
macOS CI).

Publish with the native exclusive rename (renameatx_np RENAME_EXCL on
Apple, renameat2 RENAME_NOREPLACE on Linux/Android) so the entry is
singly linked the instant it becomes visible. No-overwrite semantics,
fd-relative confinement and the hard-link guard are unchanged. Where
the kernel, filesystem or platform lacks exclusive rename
(EINVAL/ENOSYS/ENOTSUP), degrade to the old link+unlink path instead of
failing; that known limitation is documented at the fallback.

Evidence:

  • 18 passed, 0 failed (13,226 skipped): four new Unix publication
    tests, the tool-media test above, and artifact/Fleet artifact and
    tool-media artifact publication tests.
  • Before/after: the new concurrent-publication test fails against the
    previous linkat implementation (0 passed, 1 failed; readers hit the
    hard-link guard) and passes with this change.
  • TUI all-target/all-feature Clippy with CI flags and fmt passed.
    Refs feat(web): move legal/terms and legal/privacy onto the dictionary spine (#5337) #6417 (an earlier macOS run of that PR hit this race; it is not caused by that PR).

🤖 Generated with Claude Code

Unix no-replace publication used linkat followed by unlinkat, which
briefly leaves the entry with two links. A concurrent reader correctly
rejects that under the singly-linked-file guard, so identical concurrent
tool-media publications produced different metadata
(tool_media_publication_is_immutable_and_replay_preserves_manifest on
macOS CI).

Publish with the native exclusive rename (renameatx_np RENAME_EXCL on
Apple, renameat2 RENAME_NOREPLACE on Linux/Android) so the entry is
singly linked the instant it becomes visible. No-overwrite semantics,
fd-relative confinement and the hard-link guard are unchanged. Where
the kernel, filesystem or platform lacks exclusive rename
(EINVAL/ENOSYS/ENOTSUP), degrade to the old link+unlink path instead of
failing; that known limitation is documented at the fallback.

Evidence:
- 18 passed, 0 failed (13,226 skipped): four new Unix publication
  tests, the tool-media test above, and artifact/Fleet artifact and
  tool-media artifact publication tests.
- Before/after: the new concurrent-publication test fails against the
  previous linkat implementation (0 passed, 1 failed; readers hit the
  hard-link guard) and passes with this change.
- TUI all-target/all-feature Clippy with CI flags and fmt passed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 23, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Hmbown Hmbown closed this Sep 23, 2026
@Hmbown
Hmbown deleted the fix/fleet-exclusive-rename-publication branch September 23, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants