test(workspace): pin the clock in sessions-panel date-bucket test - #498
Draft
albertoperdomo2 wants to merge 3 commits into
Draft
albertoperdomo2 wants to merge 3 commits into
albertoperdomo2 wants to merge 3 commits into
Conversation
The 'groups sessions by date buckets' test used Date.now() - 30 days as its 'Older' fixture, but groupByDateBucket has a 'This month' tier: on month-boundary days (every 31st), now - 30d is still inside the current calendar month and buckets as 'This month', so the 'Older' header never renders and the test fails. It broke CI on 2026-08-31 with no code change. Pin the clock to a fixed mid-month instant with fake timers so the buckets are deterministic on any date and in any timezone.
…only, skip_specs)
4 tasks
albertoperdomo2
marked this pull request as draft
August 31, 2026 08:53
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
Unblocks #497: the
Verify Web Coverage Badgescheck currently fails onmain(and therefore on any PR branch) becausesessions-panel.test.tsx > groups sessions by date bucketsis calendar-dependent — no code change involved.Root cause: the test's "Older" fixture is
Date.now() - 30 days, butgroupByDateBucket(src/lib/date-buckets.ts) has a "This month" tier. Whenevernow − 30dis still inside the current calendar month, the fixture groups as "This month" and theOlderheader never renders. That happens on the 31st of every month — which is why the suite passed on Aug 30 and failed on Aug 31 (today) in CI with an identical tree.Fix: pin the clock in that one test (
vi.useFakeTimers()+vi.setSystemTime(2026-06-17T12:00:00Z), real timers restored infinally) so Today / Yesterday / Older are deterministic on any date and in any timezone. Chose a mid-month instant so the 30-day fixture always lands in the previous month.OpenSpec
deterministic-session-date-bucketschange doc included withskip_specs: true— test-only, no behavior changes (openspec/changes/deterministic-session-date-buckets/).Test plan
TZ=UTC,TZ=Pacific/Kiritimati(UTC+14),TZ=America/New_YorkMerge order
Merge this first, then rebase/merge #497 — its coverage-badge check is red only because of this shared-main test.