Skip to content

fix(shim): preserve snapshot isolation across delete and recreate - #303

Merged
graywolf336 merged 1 commit into
devfrom
fix/shim-snapshot-lifecycle-20261028
Oct 29, 2026
Merged

graywolf336 merged 1 commit into
devfrom
fix/shim-snapshot-lifecycle-20261028

Conversation

@vinceblock99

Copy link
Copy Markdown
Contributor

With the Git shim enabled, an immediate native deletion record could report “Nothing to record” after its entry-boundary snapshot had captured the deletion. Replacing the old private snapshot realigned the shared TREE cache to the private view, hiding the pending deletion from the next record on the same handle. Keep that realignment limited to membership changes in the selected view, preserving staged working-copy paths and the existing canonical graph/closure rules.

Recreating a recorded-deleted path could also make atomic add fail during its pre-entry snapshot with “new attribute path … has no FileAdd inode”. Capture includes untracked files before add stages an inode: content assembly correctly chooses the existing claimant’s undelete, but attribute assembly expected a new FileAdd. Resolve unstaged reappearance attributes through the same canonical absent claimant, retaining its inode, mode/kind, and graph-only representation.

Fixes the reproduced behaviors in ATOM::bradley::23 and ATOM::bradley::24. There are no automatic retries, preliminary status calls in the deletion fix, new runtime flags, or relaxed validation.

Regression coverage includes same-handle snapshot replacement followed by the first durable deletion record; genuine no-op records; staged work surviving replacement; unstaged undelete identity through reopen; stale promotion rejection preserving newer bytes, membership, and the captured object; and successful fresh recapture/promotion. CLI tests cover ordinary and default rolling imports, both a one-file minimization and the Unicode move/percent-path/attributes/executable/symlink fixture, with regular/executable/symlink recreation and exact bytes, attributes, identity, Git tree, and neighbor checks. The new CLI tests are children of the existing shim suite and inherit its platform/build gates.

Validation

Local macOS validation against dev cedd877d:

  • Both minimal repository regressions failed before the fixes with the reported errors.
  • Full repository library suite: 1,512 passed, 0 failed, 3 ignored manual benchmark/sample tests.
  • Related CLI integration suites with adoption failure injection: 120 passed, 0 failed, including the new ordinary/rolling lifecycle scenarios.
  • Production and integration-target Clippy (-D warnings), formatting, and patch whitespace checks pass.
  • Real Git projects, with complete non-shallow HEAD history: antirez/sds at 5347739b (60 commits) and antirez/linenoise at a473823d (163 commits). Both rolling-import runs pass the deletion/recreation, exact bytes/mode/neighbor, subsequent Git commit/reconcile, subsequent Atomic record, and genuine no-op checks.
  • Existing real-repository daily-workflow harness on SDS: 162 passed, 0 failed, 1 skipped (directory move: the checkout has no tracked subdirectories).
  • On SDS ordinary import, the old dev CLI reproduces both Bradley failures; this branch passes deletion and recreation checks. The expanded subsequent-reconcile scenario has the known limitation below.
  • Linenoise ordinary import exceeded the local 15-minute command timeout before reaching the lifecycle checks (a fresh retry after the initial 5-minute limit). This case remains unverified; it is not counted as a pass.
  • Remote CI and other operating systems have not been run for this local branch.

Known follow-up from real-repository testing

The complete ordinary-import workflow is not all green. On SDS, native edit → delete → recreate/add/record succeeds and verifies clean, but a subsequent Git commit/reconcile fails staged semantic-closure verification for LICENSE (same byte length, different rendered content). Rolling import passes the complete scenario.

The frozen pre-fix dev CLI be83f20 also produces the same reconciliation error after a control that bypasses its earlier add failure by calling the unchanged Repository::add API solely to stage the recreated file. That helper links the current repository build but does not invoke either changed snapshot/record path; subsequent record, hooks, and reconcile use the old CLI. Simple native-edit → Git-commit and native-delete → Git-recreate controls pass on both versions. This supports treating the ordinary-import/native-undelete synthesis failure as a separate existing issue; this PR does not fix it.

@vinceblock99
vinceblock99 marked this pull request as ready for review October 28, 2026 18:43
@graywolf336

Copy link
Copy Markdown
Contributor

@vince can you expound on the last section? What exactly do you mean?

@graywolf336
graywolf336 merged commit a15891a into dev Oct 29, 2026
8 checks passed
@graywolf336
graywolf336 deleted the fix/shim-snapshot-lifecycle-20261028 branch October 29, 2026 12:32
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