Make library divergent deposit repair restore-or-orphan safe (#29) - #71
Merged
Merged
Conversation
Replace clear_path + install_local in library::deposit_at divergent repair with repair_divergent_deposit, which stages beside the library and publishes via skills::publish_staged_tree. Install failure after displacing the live tree now restores the original or leaves a durable .tink-orphan-* beside the library root with the path named in the error. Add characterization tests for success, single-failure restore, and double-failure orphan retention. Update RELIABILITY.md and the issue-29 spike matrix for deposit_at. Co-authored-by: jon <jonathan10620.dev@gmail.com>
jon-devlapaz
marked this pull request as ready for review
September 9, 2026 17:43
jon-devlapaz
deleted the
cursor/deposit-at-divergent-repair-safe-7b39
branch
September 9, 2026 17:43
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 / why
library::deposit_atonPreflightOutcome::Divergentpreviously calledclear_paththeninstall_local. If install failed after the clear, the only library copy was gone with no recovery path — a #29-class gap distinct from refresh replace (which already uses restore-or-keep viapublish_staged_tree/ #70).This PR replaces that path with
repair_divergent_deposit: stage the incoming tree beside the library (.tink-deposit-*), then publish viaskills::publish_staged_tree. On publish failure the live tree is restored; on double failure the displaced original is renamed to.tink-orphan-<skill-name>-<unique>beside the library root and the error names that path.Success semantics are unchanged: divergent repair still reports
LibraryWrite::Repaired.Proof commands + test names
library::tests::deposit_diverge_repairsRepairedand replaces bodylibrary::tests::deposit_divergent_repair_restores_original_on_publish_failurelibrary::tests::deposit_divergent_repair_retains_orphan_on_double_failure.tink-orphan-demo-skill-*beside library root; error names pathWhat remains on #29
publish_staged_tree,manifest::write_atomic, andupdate::replace_binary.tink-orphan-*naming for manifest/binary paths (tree swap already uses it)install_localReady path)