fix(engine): include inputTokenPattern in ruleSignature's deny-hook identity - #8126
Merged
Merged
Conversation
…dentity
ruleSignature previously omitted inputTokenPattern from the identity it
computes for resolveEffectiveDenyRules/synthesizeDenyRuleProposals, so a
maintainer-approved custom rule that narrowed an existing rule only by
adding/changing inputTokenPattern would be silently deduped away as an
exact duplicate.
Serializes .source + .flags rather than the RegExp object itself, since
JSON.stringify collapses every RegExp instance to "{}" regardless of its
actual pattern.
Closes #8013
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | ec0bf0d | Commit Preview URL Branch Preview URL |
Jul 22 2026, 11:47 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8126 +/- ##
==========================================
- Coverage 92.02% 92.02% -0.01%
==========================================
Files 760 760
Lines 77372 77373 +1
Branches 23386 23386
==========================================
- Hits 71203 71200 -3
Misses 5061 5061
- Partials 1108 1112 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This was referenced Jul 23, 2026
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
ruleSignature(the identity functionresolveEffectiveDenyRules/synthesizeDenyRuleProposalsuse to decide "is this the same rule") omittedinputTokenPatternfrom its computed identity, so a maintainer-approved custom rule narrowing an existing rule only byinputTokenPatternwould be silently deduped away as an exact duplicate..source+.flagsrather than theRegExpobject itself —JSON.stringifycollapses everyRegExpinstance to"{}"regardless of its actual pattern, so the naiverule.inputTokenPattern ?? nullfix would have "fixed" only the presence-vs-absence case, not two genuinely different patterns colliding. Caught this by testing before committing to the naive version.Validation
npm run typecheck— clean.npx vitest run test/unit/miner-deny-hook-synthesis.test.ts— 22/22 passing, including two new cases: three rules distinguished only byinputTokenPattern(none/--follow-tags/-f) all survive as distinct; two rules with byte-identicalinputTokenPatternsource+flags still correctly dedupe to one.packages/loopover-engine(npm run build) before testing — the root test imports the compiledpackages/loopover-miner/lib/deny-hook-synthesis.js, which wraps@loopover/engine's dist output, not the TS source directly.