Skip to content

test(digest): pin the digest-hour case to fixed summer and winter instants (unblocks CI) - #3121

Merged
lilyshen0722 merged 2 commits into
mainfrom
stack/digest-hour-dst-test
Nov 1, 2026
Merged

lilyshen0722 merged 2 commits into
mainfrom
stack/digest-hour-dst-test

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Unblocks the merge queue. Every PR's backend shard 3, and the queue's own runs (the #3107 group, for one), have been red since 00:00Z on 11-01 on a single test:

dailyDigestService.membership.test.js › "a scheduled run takes only the people for whom it is the hour"

Cause: the test built laEight as 15:01 UTC on the current date and asserted that this is 08:00 in America/Los_Angeles. That holds only under PDT (UTC-7). Daylight saving ended at 09:00Z on 2026-11-01, so from that UTC date on, 15:01Z is 07:01 PST and the assert fails. It would have stayed red until 2027-03-14. The service isn't involved.

Fix (test only): the case now runs on fixed instants, never today's date. generateAllDailyDigests takes at and reads no other clock on the scheduled path. So pinning at, and deriving lastActive from it, fixes the test for good, with no fake timers. It's now three cases:

  • 2026-10-17T15:01Z, 08:01 PDT: Los Angeles is due.
  • 2026-12-15T15:01Z, 07:01 PST: Los Angeles is not due. This is the reverse case.
  • 2026-12-15T16:01Z, 08:01 PST: Los Angeles is due.

The no-zone person is never due at any of them, because its hour is 06:00 UTC.

Tests:

  • The whole file passes, 26 of 26, on Node 22 in a container with in-memory Mongo.
  • Mutation check: with dueAt hard-coded to 15 UTC for any zone, both winter cases fail.
  • The only other Los Angeles test in the backend (timeZone.test.js) already uses a fixed date.

Tier 1, test only. Its one review round is the writer's subagent review, then CodeRabbit and CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_015AKgpQmb6BbxDrAtw45bgN

…tants

15:01 UTC is 08:00 in Los Angeles only under PDT. The test built 15:01 on
the current date, so it went red for every PR and the merge queue when
daylight saving ended on 2026-11-01, and would have stayed red until March.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015AKgpQmb6BbxDrAtw45bgN
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5ecd7b3 and f23cb04.

Files selected for processing: 1
  • backend/__tests__/unit/services/dailyDigestService.membership.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Walkthrough

The daily digest membership test now uses fixed summer and winter instants to check due-hour selection for Los Angeles and no-timezone users.

Changes: Daily digest timezone test

Layer / File(s) Summary
Scheduled-run timezone assertions
backend/__tests__/unit/services/dailyDigestService.membership.test.js
The test checks Los Angeles selection at 15:01 UTC in summer and 16:01 UTC in winter. It also checks no-timezone user selection at 06:01 UTC in winter. The comment notes that Los Angeles’s 08:00 UTC offset depends on the date.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to f23cb

This test-only change provides reliable coverage for summer, winter, and no-timezone digest scheduling behavior.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title names the changed test and the fix: it pins the digest-hour case to fixed summer and winter instants, which matches the test-only change in dailyDigestService.membership.test.js. It also sta…
Description check Passed The description states the failing test, the root cause (a fixed UTC-to-Los Angeles assumption that breaks after DST ended on 2026-11-01), and the test-only fix with three fixed-instant cases. It also…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the changed test and the fix: it pins the digest-hour case to fixed summer and winter instants, which matches the test-only change in dailyDigestService.membership.test.js. It also states the CI-unblocking purpose. The title is specific and accurate, so it passes.

Full details: Description check

Explanation

The description states the failing test, the root cause (a fixed UTC-to-Los Angeles assumption that breaks after DST ended on 2026-11-01), and the test-only fix with three fixed-instant cases. It also lists the test results and a mutation check. It directly describes the changeset, so it passes.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One review round (D218), recorded at f23cb04: the writer's own subagent review, then CodeRabbit and CI.

  • Subagent review: 0 blocking, 4 non-blocking. It verified the 2026 DST dates, checked that generateAllDailyDigests reads only at on the scheduled path, and found no other today-dependent zone test in backend/__tests__. Two nits are fixed in f23cb04: a stale comment, and a no-zone 06:01Z row so the no-zone assertion isn't vacuous. The other two (a redundant helper check, the assertion shape) were folded in.
  • CodeRabbit: passed, with no threads.
  • CI: Test & Coverage passed, and Backend tests 3/3 is green again, which is the shard this fixes. E2E Tests hit its 30-minute limit. It isn't a required check, and this PR changes one backend unit-test file.

GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit dbf531b Nov 1, 2026
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant