Repository navigation
refactor(scan): scanners take file lines; MCP snippet scan uses postprocess (#610) - #641
Merged
Merged
Conversation
…rocess (#610) Add engine::scan_input::ScanFile as the single scanner input shape (path, language, numbered lines). secrets/security scanners, run_rules and the inline cora-ignore filter get *_in(&[ScanFile]) implementations; the diff entry points are thin adapters, files_as_chunks is removed. cora.check_snippet now runs through postprocess_report (ignore.rules, cora-ignore, FP filters, max_findings). Unit test opening an index session uses a per-test temp DB. brain_search_process sandboxes use unique temp dirs so concurrent test runs cannot delete each other's. 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
Final steps of #610.
engine::scan_input::ScanFile { path, language, lines: Vec<(u32, &str)> }is the one input shape.secrets_scanner::scan_secrets_in,security_scanner::scan_security_in,rules::run_rules_inandinline_suppress::apply_linesare the single implementations;scan_secrets/scan_security/run_rules/inline_suppress::applykeep their signatures and are thin diff adapters (ScanFile::added_lines/post_image).postprocessfeedscora scanthroughScanFile::from_entry.files_as_chunksis deleted.cora.check_snippetnow goes throughpostprocess_reportas a syntheticsnippet.<language>file (language sanitized to one path segment). It loads the project config like the other MCP tools (errorFailed to load config: ..on failure), honorsignore.rules, inlinecora-ignore:, the false-positive filters andrules_engine.max_findings, and appends the dropped count when > 0. Output format is unchanged.IndexSessionuses a per-test temp DB (IndexBridge::open_or_create_at/IndexSession::open_at_db, test-only). The migration mutex stays.tests/brain_search_process.rssandboxes now use uniquetempfiledirs (they used fixedcora-545-*names in the system temp dir, so two concurrentcargo testruns deleted each other's sandbox and both tests failed withNo such file or directory; not a data-dir/vector-lock race).Why
The scanners were written for diffs, so a full-file scan and the MCP tool had to fake a diff, and the MCP tool skipped every filter. One line-based seam means a scanner fix lands once and every entry point applies the same suppression.
Testing
cargo fmt,cargo clippy --all-targets -- -D warningsclean; fullcargo testrun 3x clean (1130 unit tests + integration).secret_heuristics_tests.rstable (CASES/KNOWN_GAPS) unchanged and green.scan_inputadapters, and MCP snippet tests (rule id,ignore.rules,cora-ignoresame line / next line / other rule, FP shapes, path from language, cap + dropped count). None use a real data dir.origin/developbuild:cora scan --format jsonandcora review --staged --format jsonon a sample project (TS typed/env/interpolation, Python env reads +cora-ignore, Go:=, YAML, JSON, SQL, tests path, Markdown) produce byte-identical output.cora mcp): before,cora-ignoreandignore.ruleswere ignored and 7 findings were listed (cap 10); after, the marker andignore.rulessuppress, and the default cap of 5 applies with "2 more deterministic finding(s) not shown".Closes #610
🤖 Generated with Claude Code