Repository navigation
Python regex_execution: count finditer/fullmatch/subn and methods on compiled patterns (Closes #8858) - #9001
Conversation
…compiled patterns (Closes #8858) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
No description provided. |
|
PR #9001 @ 723ed39: 1 failed check(s) == graph-accuracy-audit (failure) -- real |
|
No description provided. |
|
No description provided. |
|
PR #9001 @ b7b36d1: 1 failed check(s) == graph-accuracy-audit (failure) -- real |
|
No description provided. |
|
No description provided. |
|
PR #9001 @ eb83460: 1 failed check(s) == graph-accuracy-audit (failure) -- real |
|
Waiting on an owner decision (asked privately, 2026-11-22). Nothing is needed from contributors; work resumes once it is answered. |
|
No description provided. |
|
This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push. |
|
CI shepherd: |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
No description provided. |
|
No description provided. |
1 similar comment
|
No description provided. |
What
Python
regex_execution(arch_regex) now counts the same operations when run as a method on a compiled pattern, and the module forms it was missing.Rule (
languages/python.py):\bre\.(?:compile|search|match|fullmatch|sub|subn|findall|finditer|split)\bor(?<!\bre)\.(?:finditer|fullmatch|findall|subn|match|search)[ \t]*\(. The lookbehind keepsre.search(a single site instead of module plus method. Both alternatives are fixed alternations with no nested quantifiers (ReDoS-safe).Closes #8858.
Class / Sibling gaps
Class: a regex-execution rule built from a closed list of module-level calls with no method-on-object form (recall 0.53 / precision 1.00 on the engine's own code per the issue). Python is the only member that shares this mechanism and is fixed here, with a test per call form (module forms, method forms, near-miss identifiers).
Sibling gaps (none filed):
go.pyregex_execution: matches.MatchStringonly; missesFindAllString,ReplaceAllString,FindStringSubmatchand similar. Different mechanism (Go method names), needs its own precision check.java.pyregex_execution:Pattern.compile,Matcher.find,.matches(; otherMatcher/Stringmethods (replaceAll,split,lookingAt) not audited.Precision / recall (engine's own
gitgalaxy/, per function, vsast)Truth proxy: the function calls
re.<fn>, a method on an inlinere.compile(..), or a match/search/... method on a name that the same file assigns fromre.compile(..).The proxy under-counts truth (compiled patterns held in dicts/lists are invisible to it), so the FP column is an upper bound; precision stays above the 0.9 bar, so bare
.match(/.search(are kept.Timing
Rule alone, CPU time best of 3, 696 Python files / 14.3 MB (gitgalaxy + language-crucible + keyword-rosetta): 0.147 s before, 0.381 s after (measured while a bless ran alongside). About +0.23 s over 14 MB; the added work is a single extra alternation.
Golden masters
Blessed with
golden-lock.sh python tests/tools/crucible_check.py --update --yes: 13 fixture parts in both legs, Python files only (numpycrackfortran.pyregex_string_matching and the repository fingerprint/cluster floats it feeds, plus the scan snapshots).scope_check.py --expect pythonalso lists drift under the fortran and cpp corpora (wrf/configure_reader.py,NVDA/braille.py); each is a.pyfile in another language's corpus, so the Python rule applies to it. Every moved value is a Python-file regex_string_matching count or the cluster floats and digests derived from it.Gates
audit_check.py: all clear.pytest tests/extraction/languages/test_python_regex_execution_8858.py test_python_strict.py test_python.py: 327 passed.Cross-repo
keyword-rosetta counts may move (Python control corpus); if so this PR needs
rosetta:rebless-owed, applied by the orchestrator. No companion PR yet.Lessons for agents
None.
🤖 Generated with Claude Code