Skip to content

Report rules skipped at the rule limit when importing - #2

Merged
Dszae merged 1 commit into
mainfrom
fix/report-rules-dropped-on-import
Nov 23, 2026
Merged

Dszae merged 1 commit into
mainfrom
fix/report-rules-dropped-on-import

Conversation

@Dszae

@Dszae Dszae commented Nov 23, 2026

Copy link
Copy Markdown
Owner

importRules() stopped with break once the store held LIMITS.maxRules rules, 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

  • Each rule past the limit is added to rejected with its position in the file and the reason Not 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.
  • The loop continues instead of breaking, so later duplicates are still counted.
  • To name the position, parseRulesImport() returns each accepted rule with its file index ({ index, rule }). Its one caller and its test are updated.

Tests

  • New: reports the rules it skips once the rule limit is reached seeds 498 rules and imports 5 (2 duplicates, 3 new). It fails on main (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

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>
@Dszae
Dszae merged commit 653554a into main Nov 23, 2026
2 checks passed
@Dszae
Dszae deleted the fix/report-rules-dropped-on-import branch November 23, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant