Repository navigation
Conversation
re.compile raises OverflowError for a repeat count that does not fit and RecursionError for groups nested too deep, not re.error. The process_metrics and contract loaders caught only re.error, so such a pattern crashed with a traceback instead of a refusal. One compile_user_regex helper maps all three to ValueError. It is used at the two loader compile sites, and at the branch-filter glob compile (repos/l0/branches.py), which compiles user-derived text. The manifest catches ValueError from parse_counter, so it refuses too without a change of its own. The remaining re.compile in environment/instructions.py compiles module-level literals only and is unchanged. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
A list-valued matcher key was joined with `|`, each element wrapped in `(?:...)`, and only the joined pattern was compiled. `["a)|(?:b"]` joins to two groups and was accepted, though the element is not a regex. Each element is now compiled on its own and refused by name. A list whose elements are each a regex compiles to the same pattern as before. A list where one element refers to a group of another is refused now, since that element is not a regex alone. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/tests/test_context_consistency.py # dokimi/tests/test_import_architecture.py
Thread: PRRT_kwDOVBg7g87AQkB0 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
A list pattern is joined into one alternation, so a group number shifts when the elements are joined: `(a)\1` after `(x)` refers to `(x)` and the action misses a call it should match. Refuse `\1`-`\99`, `(?P=name)` and `(?(1)...)` in a list element; a single string keeps them. A digit in a character class or an escaped backslash is not a reference. The run consistency doc describes the rule. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1667 +/- ##
==========================================
- Coverage 96.44% 96.43% -0.02%
==========================================
Files 585 585
Lines 76600 76631 +31
Branches 13175 13185 +10
==========================================
+ Hits 73876 73898 +22
- Misses 1671 1675 +4
- Partials 1053 1058 +5
🚀 New features to boost your workflow:
|
This branch has not been deployed
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
A list-valued contract pattern is joined into one alternation, and group numbers shift when the elements are joined. An element
(a)\1placed after(x)then refers to(x), so the action misses a call it should match. This PR refuses\1-\99,(?P=name)and(?(1)...)inside a list element. A single-string pattern keeps them.Stacked on #1649 (arch/r14-2); this PR's diff is the one commit.
Evidence
tests/test_context_consistency.py: red first (5 of the refused cases failed before the change, the single-string case passed), green after.make ci-local: the test step passes (36273 passed).pip-auditfails for an environmental reason (platformdirs refuses the cache under/mnt/cached_oses, owned by another user), not this change.Merge danger
[(a)\1]and a backreference in the first element are refused too.mainand includes its commits until then.🤖 Generated with Claude Code