Repository navigation
refactor(index): single seam for resolving project root and opening the index - #574
Merged
Merged
Conversation
…he index Evolve IndexBridge into the one module that resolves the project root (via resolve_project_root), opens the index with shared PRAGMAs, and ensures the project id. Tolerant mode for review, strict mode for CLI/MCP. Index scanners and brain context take the bridge, so a review run from a subdirectory resolves the same project_id as indexing from the root. Closes #566 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
ajianaz
added a commit
that referenced
this pull request
Oct 8, 2026
) Covers security hardening (#563, #572, #573), fixes (#553, #561, #562, #564, #565, #574-#576), and the ignore-pattern semantic changes from #577 that can alter which files existing configs exclude. Signed-off-by: ajianaz <ajianaz@users.noreply.github.com> Co-authored-by: ajianaz <ajianaz@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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
Evolves
IndexBridgeinto the single seam for "resolve project root + open the index + ensure project id", and migrates all call sites to it.Why
Closes #566. Callers answered "which project am I in?" differently: review-time scanners used raw
current_dir()whilecora indexusedresolve_project_root, so a review from a subdirectory or workspace member could resolve a different/emptyproject_idthan the one indexed. PRAGMAs also differed per open path (6 vs 2).How
IndexBridgealways normalises its start path withresolve_project_root. Modes: tolerantopen(review; never creates the DB, never fails), strictopen_strict(CLI/MCP;NoIndexErrorwhen absent),open_or_create(index/serve/watch/dead-code/routes/query),from_connection(tests).index::open_index_at+apply_pragmasare the only place PRAGMAs/migrations are applied;open_global_indexanddb_writer::open_dbdelegate to it.resolve_project_idremoved.scan_unused_imports,scan_dead_code_in_review,scan_breaking_changes,scan_project_index,build_brain_context,build_scan_brain_contexttake&IndexBridge(the oldscan_breaking_changes_withpattern, generalised) instead of opening their own connection.open_index_db, serve/watch/routes/query, review.rs and scan.rs go through the bridge.cora.dbwhen none exists; the MCP/CLI "no index" message is unchanged for users.Not included: index-session/config (#567), affected-tests (#568). Read-only
db_writer::open_db_for_read(no PRAGMAs/migrations by design) and the context resolver's ownIndexBridge::open(project_root)are left as is.Testing
cargo test --features tree-sitterpassescargo fmt --all -- --checkpassescargo clippy --all-targets --features tree-sitter -- -D warningspassescargo build --release --features tree-sitternot run locally (disk)NoIndexError, subdirectory/workspace-member resolves same project_id as root, scanner run from a subdirectory finds callers indexed from root, PRAGMAs applied by the shared opener.Closes #566
🤖 Generated with Claude Code