Skip to content

Fix time-zone flake in token activity test - #890

Merged
Finesssee merged 1 commit into
mainfrom
fix/token-activity-test-zone
Oct 15, 2026
Merged

Finesssee merged 1 commit into
mainfrom
fix/token-activity-test-zone

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Test-only fix. codex_activity_leaves_the_shared_cost_coverage_alone built its day window from Utc::now().date_naive(), but the fixture and production (cost_bucket_zone().date(Utc::now())) bucket by the local zone. When the local date was ahead of UTC (for example 00:00–07:00 at UTC+7), the fixture's day fell outside the window and the test failed. CI runs in UTC, so it never hit this. The test now uses the same cost_bucket_zone() date as production.

Tests

  • Reproduced on main at local 03:16 UTC+7 (UTC still the previous day): the test failed.
  • With the fix, at the same time: cargo test --manifest-path rust/Cargo.toml --lib token_activity 12 passed.
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings: clean.

Summary by CodeRabbit

  • Tests
    • Updated activity-cache test date ranges to follow the configured timezone, making test results consistent when the timezone differs from UTC.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3ae3291a-518e-4e88-a335-ea0fc05d1ef9
📥 Commits

Reviewing files that changed from the base of the PR and between 34353ff and ea05c85.

📒 Files selected for processing: 1
  • rust/src/cost_scanner/token_activity.rs

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

📝 Walkthrough

The Codex activity cache test now derives its ending date from the configured cost bucket timezone instead of UTC.

Changes: Activity cache test

Layer / File(s) Summary
Timezone-aware test date window
rust/src/cost_scanner/token_activity.rs
The test uses cost_bucket_zone() to derive the activity window's ending date.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to ea05c

The test now follows the activity scanner’s date zone. No actionable merge risk is established by this change.

Pre-merge checks: Passed 8
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title is a short imperative summary that accurately describes the time-zone fix in the token activity test.
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.
Provider Data Stays Siloed Passed PASS. The pull request changes one test line in rust/src/cost_scanner/token_activity.rs. It changes the test window date from Utc::now().date_naive() to cost_bucket_zone().date(Utc::now()). It d…
Secrets Handled Safely Passed PASS. The pull request changes only the test window date calculation in rust/src/cost_scanner/token_activity.rs. It adds no token, cookie, API key, OAuth credential, authorization header, logging, e…
No Unapproved Dependencies Passed The pull request changes only rust/src/cost_scanner/token_activity.rs. The diff changes one test expression from Utc::now().date_naive() to cost_bucket_zone().date(Utc::now()). It does not add o…
Ui Changes Include Windows Proof Passed PASS: The pull request changes only rust/src/cost_scanner/token_activity.rs, inside the test module. It changes a test date calculation and has no user-visible UI effect. The Windows screenshot or p…
✨ 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

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.

❤️ Share

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

@Finesssee
Finesssee merged commit 971d4e1 into main Oct 15, 2026
4 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