Skip to content

W2-T12: pre-compile achievement-scanner regex patterns at module load - #16

Merged
blaketyndall-eng merged 1 commit into
pr-25159from
post-audit-sprint/W2-T12
May 14, 2026
Merged

blaketyndall-eng merged 1 commit into
pr-25159from
post-audit-sprint/W2-T12

Conversation

@blaketyndall-eng

Copy link
Copy Markdown
Owner

Audit W2-T12 (P2 #19). 28 of 35 patterns pre-compiled into _COMPILED_SCAN_PATTERNS at module load. Single-alternation regex was tested and rejected — it silently under-counts overlapping patterns (e.g. manifest.json stolen from config_events by plugin_events). 6 patterns kept separate because they have conditional AND-gate semantics that can't be expressed via findall counts.

…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>
@blaketyndall-eng
blaketyndall-eng merged commit c9421b8 into pr-25159 May 14, 2026
3 checks passed
@blaketyndall-eng
blaketyndall-eng deleted the post-audit-sprint/W2-T12 branch May 14, 2026 16:50
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant