fix: FTS5 injection, N+1 queries, and code quality audit#3
Merged
Conversation
…lity improvements Fix critical FTS5 query injection by stripping metacharacters from search terms. Eliminate N+1 queries in disambiguate_symbol and get_ast_node with new get_nodes_with_files_by_name batch query. Optimize incremental index by replacing O(N) filesystem stat calls with DirectoryCache.file_exists(). Extract duplicated risk-level logic into domain::compute_risk_level, improve read_source_context with BufReader, enhance is_test_symbol heuristics, add lock ordering docs, and replace glob import in pipeline. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
* ^ : + - ~ " ( ) { }) from search terms, keeping only alphanumeric and underscore characters to prevent FTS5 operator injectionget_nodes_with_files_by_name()batch query with JOIN, replacing per-nodeget_file_path()calls indisambiguate_symbolandtool_get_ast_nodeexists()stat calls withDirectoryCache::file_exists()which uses already-collected mtime datacompute_risk_level: Deduplicate risk assessment logic from 3 locations intodomain::compute_risk_level()is_test_symbol: Cover Go, Rust, TS, JS, JSX, TSX test file conventionspipeline.rsTest plan
cargo check --no-default-features— cleancargo test --no-default-features— 220 tests passcargo build --release— clean🤖 Generated with Claude Code