Cover storage setRuleEnabled / setAllRuleStates / normalize paths#148
Merged
Conversation
Brings src/lib/storage.ts from 86.48% to 100% statements (66.66% to 100% functions, 82.35% to 94.11% branches). The existing tests covered DEFAULT_STATES + parseOverrides env-var paths; this PR extends with the missing mutators and the stored-value normalize paths: - parseOverrides null / array / primitive guard (covers the `!parsed || typeof parsed !== "object" || Array.isArray(parsed)` short-circuit that none of the existing cases exercised) - normalize via getRuleStates: corrupt stored values (non-boolean for a rule id) fall back to defaults; missing rule ids fill from defaults - setRuleEnabled: flips one rule, preserves the rest, notifies subscribers - setAllRuleStates: normalizes partial input + drops non-boolean values before writing - subscribe cleanup stops further notifications Ratchet global thresholds 69/64/67/68 → 69/65/70/69. The statements and lines ratchets stay at 69 because src/lib went from 96.11/95.09 to 97.41/97.35 — meaningful but not enough to bump the cross-stratum global past 70%. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Brings `src/lib/storage.ts` from 86.48% → 100% statements (66.66% → 100% functions, 82.35% → 94.11% branches). The existing tests covered `DEFAULT_STATES` composition and `parseOverrides` env-var paths; this PR extends with the missing mutators and the stored-value normalize paths.
What the new tests cover
Ratchet
Global thresholds 69/64/67/68 → 69/65/70/69. `src/lib` overall: 96.11% → 97.41% statements, 94.97% → 95.89% branches.
Test plan
🤖 Generated with Claude Code