Skip to content

Test: pin the Earlier alerts clock so it stops failing just after midnight - #3561

Merged
gitar-bot[bot] merged 1 commit into
mainfrom
claude/my-day-alerts-clock-ahst6n
Oct 15, 2026
Merged

gitar-bot[bot] merged 1 commit into
mainfrom
claude/my-day-alerts-clock-ahst6n

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

User description

Summary

Before: the Earlier alerts test file used the real clock. In the first minutes after Perth midnight, alerts made "a few minutes ago" fell under Yesterday, and two tests failed on any PR that ran then.

After: the file pins the clock to midday in Perth, so the tests give the same result at any hour.

How: vi.useFakeTimers({ toFake: ["Date"] }) with vi.setSystemTime in beforeEach, and vi.useRealTimers() in afterEach. Only Date is faked, so timers stay real for waitFor.

Areas touched: Delivery and assurance (test only)

Verification

Risk and rollout

  • Risk: none. Test file only.
  • Rollback: revert the commit.
  • Provider or production effects: None.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KhogQUCHgdtFBHFtpjnd1n


Generated by Claude Code


Summary by cubic

Pins the Earlier alerts test clock to midday in Perth so the tests no longer fail just after midnight.

The file previously used the real clock, so alerts made "a few minutes ago" fell under Yesterday in the first minutes after Perth midnight and two tests failed. vi.useFakeTimers now fakes only Date in beforeEach, keeping timers real for waitFor, and vi.useRealTimers() restores them in afterEach.

Written for commit 0ec2cb4. Summary will update on new commits.

View guided diff Turn on auto-fix


CodeAnt-AI Description

Prevent Earlier alerts tests from failing after Perth midnight

What Changed

  • Earlier alerts tests now use a fixed Perth midday date, so “minutes ago” alerts remain under Today.
  • The tests restore the real clock afterward and keep timers real for asynchronous waits.

Impact

✅ Stable Earlier alerts tests after Perth midnight
✅ Real timers remain available for test waits

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The file used the real clock, so alerts made a few minutes ago landed
under Yesterday in the first minutes after Perth midnight and two tests
failed. Faking only Date keeps timers real for waitFor.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KhogQUCHgdtFBHFtpjnd1n
@supabase

supabase Bot commented Oct 15, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 87 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: BigSimmo/PsychSift/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: fbcc4727-42bf-4bc0-acab-ba9fc7b37d0b
📥 Commits

Reviewing files that changed from the base of the PR and between 258d8e7 and 0ec2cb4.

📒 Files selected for processing: 1
  • tests/work-screens-my-day-earlier-alerts.dom.test.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@codeant-ai

codeant-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: 0ec2cb41
Scan Time: 2026-10-15 17:42:24 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED No IAC issues

View Full Results

@BigSimmo
BigSimmo marked this pull request as ready for review October 15, 2026 17:19

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

BigSimmo has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@gitar-bot

gitar-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
CI failed: The required 'PR required' aggregate check went red because static-pr and both browser lanes were cancelled with no genuine failing job; the cancellation looks like a superseded or hand-cancelled run, not a break caused by this test change.

Overview

One unique error template was found across 1 log. The aggregate check failed only because three jobs (static-pr, production-ui-critical, production-ui) reported a cancelled result, and no job actually failed. The log explicitly states the cancellation does not describe the diff.

Failures

Required 'PR required' aggregate check failed on cancelled jobs (confidence: high)

  • Type: infrastructure
  • Affected jobs: 116565088682
  • Related to change: no
  • Root cause: The aggregate gate intentionally stays red when jobs are cancelled, because a cancelled job verified nothing. The likely cause is a newer push superseding this run via cancel-in-progress, though a manual cancellation is also possible; the log does not establish which.
  • Suggested fix: Check for a newer 'PR required' run on the PR's current head SHA. If none exists, re-run the workflow so the required checks complete before merging.

Summary

  • Change-related failures: None. The only failing check is the aggregate gate, and its verdict is marked unrelated to the PR.
  • Infrastructure/flaky failures: One cancellation-driven failure of the aggregate check, likely from a superseded or hand-cancelled run.
  • Recommended action: Confirm whether a newer run on the current head SHA exists; if not, re-run CI rather than merging past the red check.
Code Review ✅ Approved

🟢 Low risk · Pins Date in one test file and restores real timers afterward, limiting impact to deterministic test behavior without changing production code.

Pins the Earlier alerts test clock to midday in Perth by faking only Date in beforeEach and restoring real timers in afterEach, so the tests no longer fail in the first minutes after Perth midnight. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Approved

For more verification details, comment gitar display:verbose.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 6 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

@codeant-ai

codeant-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 0ec2cb4 Oct 15, 2026 · 17:19 17:22

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@gitar-bot
gitar-bot Bot enabled auto-merge (squash) October 15, 2026 17:19

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gitar has auto-approved this PR (configure)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T17:21:34.062900Z 0ec2cb4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Oct 15, 2026
@claude

claude Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Pin Earlier alerts tests to Perth midday

🧪 Tests 🕐 Less than 10 minutes

Grey Divider

AI Description

• Pin the test clock to Perth midday so recent alerts remain under Today after midnight.
• Fake only Date and restore it after each test, leaving asynchronous test timers operational.
Diagram

graph TD
  Clock["Pinned Date"] --> Fixtures["Alert fixtures"] --> Page["Earlier alerts page"] --> Today["Today assertions"]
  Timers["Real timers"] --> Async["Async waits"] --> Today
Loading
High-Level Assessment

Keep the file-scoped Date-only fake: it addresses the midnight-dependent assertions without changing production behavior or blocking real timers used by asynchronous tests. Changing the application’s grouping rules would not address this test-fixture problem.

Files changed (1) +5 / -0

Tests (1) +5 / -0
work-screens-my-day-earlier-alerts.dom.test.tsxStabilize Earlier alerts tests against Perth midnight +5/-0

Stabilize Earlier alerts tests against Perth midnight

• The beforeEach hook fixes Date at Perth midday so recently created alerts consistently group under Today. The afterEach hook restores real timers, while Date-only faking leaves asynchronous waits operational.

tests/work-screens-my-day-earlier-alerts.dom.test.tsx

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo Fixer

No findings are available for this PR yet. Findings appear here once Qodo has reviewed the PR.

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge.
  • The test pins the clock to midday in Perth and restores real time afterward, preventing alerts near midnight from changing date-sensitive results.

Assessed commit: 0ec2cb4105e2

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Cancelled. View session →

@gitar-bot
gitar-bot Bot merged commit c5fc332 into main Oct 15, 2026
60 of 69 checks passed
@gitar-bot
gitar-bot Bot deleted the claude/my-day-alerts-clock-ahst6n branch October 15, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🕐 Less than 10 minutes size:XS This PR changes 0-9 lines, ignoring generated files 🟡 Small blast radius

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants