Repository navigation
Fix clock-dependent command palette ordering fixtures - #6472
Merged
Merged
Conversation
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.
Human comments
What was wrong
Two command-palette fixtures expected six threads to sort by index but calculated each row's
updatedAtusing a freshDate.now() - index. If the clock advances 2ms before the final row, row 5 becomes newer than row 4. The production comparator correctly reorders them, violating the fixture's intended input and producing the Fix 4/Fix 5 reversal in CI 40754458406, attempt 1.What changed
Capture one base timestamp per fixture and derive every row's read/update timestamps from it. Both full test bodies, interactions and assertions remain intact. Only one test file changes; no production code, timers, timeouts, retries or CI configuration changes.
How you verified
Date.now()by 2ms between fixture rows 4 and 5, then restored the real clock before rendering. On baseline, the full file had exactly two failures: the observed Fix 4/Fix 5 reversal and the neighboring highlighted-row assertion. With this change, all 71 tests pass under the same diagnostic. Diagnostic instrumentation was removed afterward.pnpm exec turbo run test --filter=@bb/app -- src/components/commands/CommandPalette.test.tsx src/lib/command-palette/palette-thread-search.test.ts: all 100 tests pass.pnpm exec turbo run lint typecheck --filter=@bb/apppasses (existing lint warnings, zero errors).49f67b1d3a, without a rerun. The existing UI-only selection policy skips Windows jobs for this change.