feat(cli): add index rebuild recovery flow#143
Merged
Merged
Conversation
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.
Summary
Add a guided recovery path for Darc users whose local SQLite index was created by an older CLI schema and can no longer be opened or migrated by the current CLI.
This introduces
darc index --rebuild, improves rebuild recommendations across human and JSON error surfaces, makes rebuild safer around partial failures and concurrent writers, and removes leftover Windows support paths now that Darc CLI is intentionally unsupported on Windows.Background
Darc’s
sync,index, and read/query commands assume the current SQLite index schema. Users upgrading from an older CLI can have an existingindex.sqlitethat fails to open or migrate cleanly. For most users, rebuilding the local SQLite cache from archived sessions is cheap, but the CLI needs to recommend that only when the existing cache is actually unusable.What Changed
darc index --rebuilddarc index --rebuildas a workspace-wide rebuild mode.index.sqlite.darc indexremains active-project scoped.darc index --provider ...still works for normal indexing.darc index --rebuild --provider ...is rejected because rebuild is intentionally all-provider/all-project.Rebuild Safety
index.sqliteis preserved until the full rebuild succeeds.index.sqlitepath after replacement.refresh, watch refreshes, or normal index writes.User Guidance
darc index --rebuildcommanddarc index --rebuild --root '/custom/root'root.issuesinstead of swallowing the recommendation.darc index --rebuildprints a short interactive progress line before work starts:Rebuilding shared index from archived sessions...Read-Only Paths
Windows Support
User-Facing Behavior
A user with a bad existing
index.sqlitewill now see actionable guidance to rundarc index --rebuildonly when Darc determines the cache cannot be opened or migrated.The command rebuilds the local SQLite cache from archived sessions. It does not delete archived sessions.
Tests
Added or updated coverage for:
darc index --rebuild.--rebuild --provider.root.issuesrebuild guidance.Verification
cargo +nightly fmtcargo test --workspace --all-featurescargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::allscripts/check-linux-clippy.sh