Skip to content

Verification spike: issue #29 durable atomic skill-tree swap - #69

Merged
jon-devlapaz merged 1 commit into
mainfrom
cursor/issue-29-verification-spike-f40e
Sep 9, 2026
Merged

jon-devlapaz merged 1 commit into
mainfrom
cursor/issue-29-verification-spike-f40e

Conversation

@jon-devlapaz

Copy link
Copy Markdown
Owner

Verdict on #29 today

Mostly done for the safety invariant; still needed for consolidation and durable naming.

Post-#68 / closed-#26, the original silent TempDir drop on refresh replace is fixed. Tree replace paths (publish_staged_tree and its six callers) implement stage → live→backup → publish → restore-or-keep. Manifest pair writes and binary update follow the same “orphans are explicit” rule via independent keep() paths.

What remains open for #29:

  • No shared helper — three parallel implementations (publish_staged_tree, manifest::write_atomic, update::replace_binary)
  • No durable orphan names — recovery artifacts keep temp prefixes (.tink-update-*, .skills-manifest-backup-*, .tink-backup-*)
  • library::deposit_at divergent repairclear_path then install_local with no backup (residual data-loss class gap)

Full analysis: docs/issue-29-verification-spike.md


Call-site matrix

Site Stage Live→backup Publish Restore-or-keep Overall
publish_staged_tree + 6 callers (refresh, rollback, manage_tink, library::promote, skillsets ×2) ✓ (under temp) keep() Partial
install_local (Ready) N/A N/A Partial (first install)
library::deposit_at (Divergent) partial Missing
manifest::write_atomic ✓ (temp file) keep() Partial
update::replace_binary ✓ (temp file) keep() Partial (file shape)

Detailed inventory with file:line references is in the spike doc.


Residual risks

  1. Recovery dirs/files are temp-named beside the destination — operator-visible but not .tink-orphan-* stable names
  2. deposit_at divergent path deletes the library tree before reinstall with no recovery backup
  3. Three independent swap implementations — drift risk
  4. Concurrent target recreation during rollback window (documented; no lock)
  5. Cross-filesystem rename (explicitly out of v1)

Recommended next implement slice (one PR)

publish_staged_tree only (~1 module):

  1. Extract a private tree-swap helper implementing live→backup → publish → restore-or-keep
  2. On rollback failure, rename backup to <dest-root>/.tink-orphan-<name>-<suffix> and name it in the error
  3. One characterization test for orphan dir naming on double failure

Defer manifest/binary unification and deposit_at divergent repair to follow-up issues.


Changes in this PR

Tests run

cargo test rollback_failure_retains_recovery_backup publish_staged_tree_restores_target_when_publish_fails write_atomic_restores_manifest_when_lock_publish_fails replace_binary_retains_recovery_backup_when_rollback_fails replace_binary_rolls_back_when_published_probe_fails
cargo test --workspace --all-targets --locked
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings

All passed on Linux x86_64.

Relates to #29

Open in Web Open in Cursor 

Inventory staged-replace/rollback/keep call sites on main post-#68,
characterize gaps vs the #29 design target, and add unit tests for
manifest lock rollback and binary keep-on-restore-failure paths.

Co-authored-by: jon <jonathan10620.dev@gmail.com>
@jon-devlapaz
jon-devlapaz marked this pull request as ready for review September 9, 2026 17:19
@jon-devlapaz
jon-devlapaz merged commit 6d3ac3f into main Sep 9, 2026
6 checks passed
@jon-devlapaz
jon-devlapaz deleted the cursor/issue-29-verification-spike-f40e branch September 9, 2026 17:19
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