filter: seed regex Presets only on first run#274
Merged
Conversation
The Presets default regex group was re-created on every extension startup whenever no regex group existed in storage, which meant a user who deleted the Presets group always saw it reappear after a window reload — violating spec #2 (deletion must persist across restarts). Track a DefaultRegexPresetsSeeded flag in globalState so the seeding in the FilterManager constructor runs exactly once per install. The clearRegexFilterData command path is unchanged: it calls initDefaultFilters() directly without consulting the flag, satisfying spec #3 (explicit reset still restores defaults). Add three regression tests covering: first-run seeding, no auto-restore after delete + reconstruct, and clear-still-restores even when the flag is set.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
==========================================
+ Coverage 62.55% 62.57% +0.01%
==========================================
Files 91 91
Lines 18519 18528 +9
Branches 1416 1418 +2
==========================================
+ Hits 11584 11593 +9
Misses 6907 6907
Partials 28 28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Artifact ReadyDownload the extension package here: |
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
Presetsgroup was re-seeded on every extension startup whenever no regex group existed in storage, so deleting the group only stuck until the next window reload.DefaultRegexPresetsSeededflag inglobalStateand seed defaults in theFilterManagerconstructor exactly once per install. After the first run, deletion of the Presets group persists across restarts.clearRegexFilterDatacommand path is unchanged — it callsinitDefaultFilters()directly without checking the flag, so an explicit reset still restores the defaults.Spec
clearRegexFilterDatareset shows the default preset again — preserved (direct call bypasses the flag).Test plan
npm test— 622 passing, including 3 new regression tests inFilterManager Default Presets Seeding.LogMagnifier: Clear Regex Filter Data→ Presets is restored.