Durable orphan naming for publish_staged_tree double failure (#29 slice 1) - #70
Merged
Merged
Conversation
When publish_staged_tree publish and rollback both fail, move staging/old to a durable .tink-orphan-<skill>-<unique> path beside the destination root instead of keeping a temp-prefixed staging directory. Fall back to TempDir::keep() only if the orphan rename itself fails. Updates characterization tests and reliability docs for issue #29 slice 1. Co-authored-by: jon <jonathan10620.dev@gmail.com>
jon-devlapaz
marked this pull request as ready for review
September 9, 2026 17:29
This was referenced Sep 9, 2026
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.
What changed and why
On publish+rollback double failure,
rollback_or_retain_backup(used byskills::publish_staged_tree) now renames the displaced original tree fromstaging/oldto a durable path beside the destination root:.tink-orphan-<skill-name>-<pid>-<nanos>The error message names that orphan path. The temp staging directory is dropped when the orphan move succeeds. If the orphan rename itself fails, behavior falls back to the prior
TempDir::keep()recovery under the temp prefix.This addresses the first #29 slice: operators no longer need to hunt inside
.tink-update-*/.tink-promote-*staging dirs for the original tree after a double failure. All existing callers (replace_verified, library promote, skillset replace) pick up the behavior automatically.Happy-path publish and single-failure rollback are unchanged.
How to prove
Key tests:
skills::tests::rollback_failure_retains_recovery_backup_at_durable_orphan_path— double failure leaves bytes at.tink-orphan-*and error names itskills::tests::publish_staged_tree_restores_target_when_publish_fails— single failure rollback restores live tree; no orphan dirs leftDocs:
docs/RELIABILITY.md(orphan naming),docs/TESTING.md,docs/issue-29-verification-spike.md(status refresh).What remains on #29
publish_staged_tree,manifest::write_atomic, andupdate::replace_binarylibrary::deposit_atdivergentclear_pathrepairDo not close #29 with this PR.