fix(scoring): harden label glob translation - #1450
Merged
Merged
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1450 +/- ##
=======================================
Coverage 95.42% 95.42%
=======================================
Files 193 193
Lines 21026 21037 +11
Branches 7614 7619 +5
=======================================
+ Hits 20064 20075 +11
Misses 383 383
Partials 579 579
🚀 New features to boost your workflow:
|
This was referenced Jun 27, 2026
Closed
12 tasks
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.
Motivation
RegExpcould throw or mis-match for certain fnmatch-style bracket expressions (e.g.[z-a],[!],[^x]) and thereby crash the scoring preview or produce incorrect multiplier matches.fnmatchsemantics which tolerate these cases; the preview must preserve parity and fail-safe behavior for untrusted registry keys.Description
labelPatternToRegExpto mirror Pythonfnmatchedge-case behavior by treating empty/bare bracket classes (like[]or[!]) as literals and by emitting a never-match fragment ((?!)) for descending/invalid ranges instead of compiling a throwingRegExp.[^x]/[!x]while avoiding accidental RegExp caret-interpretation for literal leading^in classes.escapeRegExpLiteralandhasDescendingCharacterRangeto support safe translation and range validation.test/unit/scoring.test.tsfor[^x],[z-a], and[!]patterns and other bracket-class edge cases to guard against regressions.Testing
npx vitest run test/unit/scoring.test.ts -t "matches configured label keys"and the full file: both completed and passed (72 testspassed).npm run typecheckcompleted with no type errors.npm run test:coverageandnpm run test:ciwere started during validation but did not complete in this environment (coverage run was terminated due to local runtime constraints andtest:ciwas interrupted during coverage); the unit-level tests validating the fix passed.npm audit --audit-level=moderatecould not complete due to the registry audit endpoint returning403in this environment.Codex Task