Repository navigation
Report rules skipped at the rule limit when importing - #2
Merged
Merged
Conversation
importRules() stopped with `break` once the store held LIMITS.maxRules
rules, so every remaining rule in the file was dropped without being
counted as imported, duplicate or rejected. Importing 50 rules into a
store with 497 reported "3 imported" and said nothing about the other
47. Duplicates after that point were not counted either.
Each rule past the limit is now added to `rejected` with its position
in the file and the reason ("Not imported: you can store at most 500
rules."), which the import dialog already lists, and the loop keeps
going so later duplicates are still counted. To name the position,
parseRulesImport() now returns each accepted rule with its index.
Co-authored-by: Claude <noreply@anthropic.com>
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.
importRules()stopped withbreakonce the store heldLIMITS.maxRulesrules, so every remaining rule in the file was silently dropped. Those rules weren't counted as imported, duplicate or rejected. Importing 50 rules into a store holding 497 reported "3 imported" and said nothing about the other 47. Duplicates after that point weren't counted either.Fix
rejectedwith its position in the file and the reasonNot imported: you can store at most 500 rules.The import dialog already lists rejected rules as "Rule N: reason", so no UI change is needed.parseRulesImport()returns each accepted rule with its file index ({ index, rule }). Its one caller and its test are updated.Tests
reports the rules it skips once the rule limit is reachedseeds 498 rules and imports 5 (2 duplicates, 3 new). It fails onmain(one rule vanishes, one duplicate uncounted) and passes now.npm run typecheck,npm run lint,prettier --check: clean.npm test: 199 passed.Co-authored-by: Claude noreply@anthropic.com