Repository navigation
fix(cli): keep a downloaded drop recoverable when the inbox keep fails - #240
Merged
Merged
Conversation
A failed sync or noclobber persist dropped the tempfile and lost a drop the server had already consumed. The bytes now persist as <slot>.rcv, synced with the inbox directory, and the error names the path and says if durability could not be confirmed. Receive opens the kept .age first and falls back to the .rcv copy when the primary is unreadable or fails the share code's key check, keeping both files until one opens. Only a copy that opened is promoted, with a hard link so an existing .age is never replaced, and prune treats a file another receive already removed as nothing to do. Fixes #237
philbert440
force-pushed
the
fix/issue-237
branch
from
November 25, 2026 17:31
9a48409 to
299e76e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #237
Why
A once-only drop is consumed on the server when
rh memory receivedownloads it. IfInbox::keepthen failed onsync_allorpersist_noclobber(disk full, permissions, a name collision), the tempfile was deleted and the bundle was lost. The sender had to share again. Recovery has to bring that drop back without promoting bad bytes or replacing a good copy.What changes
On a keep failure the bytes persist as
<slot>.rcvin the inbox, without replacing an existing one. The recovered file and the inbox directory are synced, and if that sync fails the error says the file may not survive a crash. The error names the path and says to rerunrh memory receivewith the same code. If even the rename fails, the tempfile is kept under its own name and the error says where it is and what to rename it to.The recovery suffix is
.rcv, no longer than.age, so the recovery name fits whenever the ciphertext name fits..partialcould exceed the 255-byte filename limit for long server authorities.Receive now reads both the
.ageand the.rcvcopy and opens them with the share code's key and the trust store. The.ageis tried first. If it is unreadable or fails to open, the.rcvcopy is tried, and both files stay on disk until one opens. If neither opens, the error is the.agecopy's.A
.rcvcopy that opened is promoted with a hard link and an unlink, so an existing.age, including one written by a concurrent receive, is never replaced. If the destination exists the candidate stays where it is. A copy that fails the key check is never promoted. The "ciphertext stays in" messages name the copy that actually opened.pruneskips a file that another receive already removed instead of failing.mark_receivedremoves both names.Not changed: retention is still measured from the file's write time.
Proved with: unit tests in
inbox.rsfor an unreadable primary falling back to the recovery copy, both copies staying on disk, no-clobber promotion, a 255-byte.agename still fitting its.rcvname, and prune skipping a vanished file. Integration tests that plant a corrupt.agebeside a valid.rcvand receive with zero GETs, plant a forged.rcvand assert no.ageappears, and plant a valid.rcvand receive with zero GETs. The long-name unit test and the two new integration tests fail on the previous commit.cargo xtask checkGATE OK,cargo xtask commits origin/release/0.8.19-rc..HEADGATE OK, and nextest oncliandrivethubat 754 passed.