fix(test): clear persisted history filters between tests (fix rc-red history suites)#1163
Merged
jSydorowicz21 merged 1 commit intoJul 5, 2026
Conversation
HistoryPanel and UnifiedHistoryTab persist the source-type filter (USER/AUTO/CUE) to localStorage under historyPanel.filters / directorNotes.historyFilters. The suites toggle filters off but never cleared localStorage in beforeEach, so a deselection leaked into every later test in the file: resolveInitialHistoryFilters restored the restrictive set, entries of the hidden type never rendered, and all downstream entry-render assertions timed out. This was rc-red on both runners (51 failures across the two files). Clearing localStorage in each beforeEach isolates filter state; both files now pass (107 tests).
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo test files were modified to add ChangesTest Isolation via localStorage Clearing
Estimated code review effort: 1 (Trivial) | ~3 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Problem
testCI has been red onrc(both runners) with 51 failures across two files:src/__tests__/renderer/components/HistoryPanel.test.tsx(~49)src/__tests__/renderer/components/DirectorNotes/UnifiedHistoryTab.test.tsx(2)All failures were
waitFor(() => getByText(<entry text>))timeouts — entries never rendered.Root cause
Test-isolation leak, not a product bug. Both
HistoryPaneland the Director's Notes Unified History persist the source-type filter (USER/AUTO/CUE) tolocalStorage(historyPanel.filters/directorNotes.historyFilters) viasavePersistedHistoryFilters, and rehydrate it on mount viaresolveInitialHistoryFilters.The suites toggle filters off in some tests but never cleared
localStorageinbeforeEach. jsdom'slocalStorageis shared across tests in a file, so once a test deselected a type,resolveInitialHistoryFiltersrestored that restrictive set for every subsequent test — entries of the hidden type never rendered, and all downstream entry-render assertions timed out. (Each test passed in isolation, which is why this only surfaced in full runs.)Fix
Clear
localStoragein each suite'sbeforeEachso filter state can't leak between tests. Test-only change (+10 lines, no product code touched).Verification
HistoryPanel.test.tsx: 72/72 pass (was 49 failing)UnifiedHistoryTab.test.tsx: 35/35 pass (was 2 failing)Platform-independent (localStorage leak), so it fixes the same failures on the Windows runner as well.
Summary by CodeRabbit