perf(store): speed up redaction scanning#155
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
This PR speeds up Darc's store redaction path while preserving the existing redacted index output.
The main change is a redaction prefilter and targeted scanner rewrite in
darc-store. Instead of sending every text field through every expensive detector, Darc now first checks for cheap literal indicators of redactable content. When there is no candidate signal, it skips the heavier redaction pipeline. Hot regex-based paths for generic secret assignments and base64-like blobs were also replaced with targeted scanners that preserve the previous matching behavior.A benchmark helper script was added to make cold-refresh and index-rebuild timing easier to reproduce, including optional redaction snapshot comparison.
Changes
aho-corasick-based prefilter for text redaction candidates.cfg(test)as an oracle for behavior checks.scripts/bench-cold-refresh.shfor repeatable timing and snapshot checks.CHANGELOG.mdunderUnreleased.Correctness
The intended behavior is no regression in redaction output.
Validation performed:
sessionsturnsturn_searchtool_callsfile_accessesturn_evidence0diffs.snapshot_match=yes.Performance
Observed local results:
Fresh temp-root cold refresh:
29.34s9.59sFrozen archive index rebuild:
28.82s7.85sOld regex-oracle rebuild:
30.37sThe speedup comes mostly from avoiding expensive regex work on text that has no plausible redaction candidate.
Risk
The main risk is false negatives in redaction correctness. This PR mitigates that by preserving the old detector semantics through oracle tests and by comparing full redacted index snapshots before and after the change.
The new scanners are intentionally scoped to match the previous behavior rather than expanding the redaction policy in this PR.