Skip to content

fix(sleep): revalidate transient unlinked latest pointers - #305

Merged
Yifan Yang (Yif-Yang) merged 1 commit into
mainfrom
fix/latest-pointer-revalidation-20261006
Oct 6, 2026
Merged

Yifan Yang (Yif-Yang) merged 1 commit into
mainfrom
fix/latest-pointer-revalidation-20261006

Conversation

@Yif-Yang

Copy link
Copy Markdown
Contributor

Summary

Concurrent staging publications can fail when .latest is atomically replaced while its metadata is being inspected. A snapshot of the replaced regular inode can report zero links, which the publisher currently treats as permanently unsafe.

  • Revalidate only the derived .latest pointer after a zero-link regular-file observation.
  • Require a non-link regular inode with exactly one link before publication; repeat link/junction and file-type checks on every attempt.
  • Keep hard links, nonregular files, missing paths, and persistent zero-link states rejected.
  • Bound retries to 21 observations / 20 backoffs (at most 1.05 seconds of requested sleep, not a wall-clock deadline).

The atomic writer, pointer reader, adoption-target authorization, receipt/backup validation, and transaction recovery code are unchanged. This is not a claim to eliminate every filesystem replacement race.

Validation

Tests used isolated synthetic data on Linux with no real user transcripts or paid model calls. Junction detection was simulated; native Windows validation is not claimed. Local evidence does not replace official CI.

Concurrent atomic publication can leave a .latest metadata snapshot describing
the replaced regular inode with zero links. Recheck only this derived pointer
with bounded backoff, and publish only after observing a safe single-link file.

Keep link, junction, nonregular-file and multi-link rejection on every attempt.
Do not change live-target, receipt, backup, transaction or atomic-write guards.

Extend the regression to cover unsafe transitions, exhaustion and recovery at
the final allowed attempt. Preserve the original local fix's author credit.
@Yif-Yang
Yifan Yang (Yif-Yang) merged commit 61d178e into main Oct 6, 2026
13 checks passed
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.

1 participant