W2-T12: pre-compile achievement-scanner regex patterns at module load - #16
Merged
Merged
Conversation
…scan Pre-compile all 28 independently-countable patterns once at module load into _SCAN_PATTERNS / _COMPILED_SCAN_PATTERNS; analyze_messages() now iterates them with zero re.compile() cost per call instead of 35 ad-hoc re.findall(raw_string, ...) calls that each paid compilation overhead. Six patterns with conditional/AND guards (install_error_events, install_success_events, restart_after_error_events, yaml_error_events, tiny_patch_after_errors_events, port_conflict) are intentionally kept as separate calls to preserve exact semantics. Also reduces two duplicate PORT_RE.search() calls to one. Co-Authored-By: Claude Sonnet 4.6 <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.


Audit W2-T12 (P2 #19). 28 of 35 patterns pre-compiled into
_COMPILED_SCAN_PATTERNSat module load. Single-alternation regex was tested and rejected — it silently under-counts overlapping patterns (e.g.manifest.jsonstolen fromconfig_eventsbyplugin_events). 6 patterns kept separate because they have conditional AND-gate semantics that can't be expressed viafindallcounts.