Skip to content

Add atomic managed rollback for database replacement - #4960

Merged
Widthdom merged 8 commits into
mainfrom
fix-issue4857
Jul 28, 2026
Merged

Add atomic managed rollback for database replacement#4960
Widthdom merged 8 commits into
mainfrom
fix-issue4857

Conversation

@Widthdom

@Widthdom Widthdom commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Create a verified managed rollback snapshot before import, checkpoint restore, or restore-by-ID replaces an existing database, unless the caller explicitly passes --no-backup.
  • Add cdidx db restore-backups --restore <id> with non-mutating dry-run, bounded manifest parsing, SHA-256 and schema validation, free-space checks, atomic replacement, and rollback preservation on failure.
  • Keep restore-backup list/prune compatibility while exposing managed IDs and path-free provenance metadata.
  • Cover missing destinations, corrupt payloads/imports, insufficient space, supported older schemas, cancellation, rollback failures, filesystem case semantics, Windows locking, and pooled SQLite handles before Windows replacement.

Validation

  • dotnet format CodeIndex.sln --verify-no-changes --no-restore
  • dotnet build CodeIndex.sln -c Debug --no-restore (0 warnings, 0 errors)
  • dotnet build CodeIndex.sln -c Release --no-restore (0 warnings, 0 errors)
  • After the latest origin/main sync, Release Issue4857ManagedRestoreBackupTests and ConsoleUiTests: 292/292 passed on both net8.0 and net9.0
  • Earlier Debug merge-sensitive tests: 379/379 passed on both net8.0 and net9.0
  • Earlier Release Issue Provide atomic rollback for database import and pre-restore backups #4857 / restore tests: 35/35 passed on both net8.0 and net9.0
  • Earlier full Release suite:
    • net9.0: 10,251 passed, 419 skipped, 0 failed
    • net8.0: 10,723 passed, 7 skipped; one unrelated watcher timing test failed during the full run and then passed 1/1 on isolated retry
  • dotnet run --project tools/CodeIndex.Changelog -- check (38 fragments validated)
  • cdidx status --check --json (index_matches_workspace: true, no failed checks)
  • Two Codex adversarial review passes completed; all actionable findings were addressed and regression-tested.

Documentation and changelog

  • Updated the English and Japanese sections of USER_GUIDE.md, DEVELOPER_GUIDE.md, and TESTING_GUIDE.md.
  • Added changelog.d/unreleased/4857.fixed.md, with English/Japanese release notes and references to the prior rollback/retention issues.

Follow-up candidates

  • None.

Fixes #4857

@Widthdom
Widthdom marked this pull request as ready for review July 28, 2026 19:55
@Widthdom
Widthdom merged commit add9173 into main Jul 28, 2026
12 checks passed
@Widthdom
Widthdom deleted the fix-issue4857 branch July 28, 2026 19:55
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.

Provide atomic rollback for database import and pre-restore backups

1 participant