test(scanner): pin required-substring prefilter semantics - #1089
test(scanner): pin required-substring prefilter semantics#1089seonghobae wants to merge 2 commits into
Conversation
…_substrings This avoids the overhead of instantiating generator objects in a hot loop that is executed for every rule and every file, resulting in roughly a 2x speedup for this check.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| if required_substrings: | ||
| # ⚡ Bolt: Unroll generator expression to avoid iterator instantiation | ||
| # overhead in the hot path. Measured ~2x speedup for this check. | ||
| skip_rule = False | ||
| for substring in required_substrings: | ||
| if substring not in content: | ||
| skip_rule = True | ||
| break | ||
| if skip_rule: | ||
| continue |
Current repair state — 2026-09-05
develop@e71d37e7c58118e6764c96ab7c4492fe33eed6f82a3a8f47b09df32ed69610e0c16c4c142988e2f7tests/test_required_substring_prefilter_contract.pyReview finding and repair
The original Bolt commit changed the production
_scan_fileprefilter fromall(...)to an explicit loop, added a source comment claiming a measured ~2x speedup, and promoted the local microbenchmark into repository-wide.jules/bolt.mddoctrine. The branch had no production-path equivalence regression and no representative end-to-end benchmark/profile proving a buyer-visible scan improvement. In a security scanner hot path, that is insufficient evidence to retain a speculative implementation change.Normal descendant
2a3a8f47...therefore restores bothscanner/cli/appguardrail.pyand.jules/bolt.mdbyte-for-byte to protecteddevelop. No performance claim, Python micro-optimization, or global doctrine remains in the effective diff.The retained valid delta is an executable security contract around the existing required-substring prefilter. It drives the real
_scan_fileboundary and proves:This protects the false-negative boundary independently of any future optimization technique. A future hot-path optimization must start from representative/right-cleared production profiling and preserve this contract; if the prefilter is materially hot, the Rust-first extraction/migration boundary must be evaluated rather than normalizing repeated unsupported Python micro-tuning.
Promotion gate
Fresh exact-head unit/coverage/security/SAST/review evidence is required. Keep Draft until one unchanged head has terminal required checks, 100% owned coverage/docstrings where applicable, zero valid unresolved findings, and qualifying independent review under live protection.
No self-approval, bypass, force update, destructive rebase, dummy/no-op retrigger, performance overclaim, or predecessor evidence transfer.