Skip to content

Conversation

@rodrigok
Copy link
Member

@rodrigok rodrigok commented Oct 10, 2025

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Tests
    • Updated a timestamp-related test to compute expectations using the current GMT offset, improving reliability across time zones and environments.
    • Reduces test flakiness and makes local and CI runs more consistent.
    • No impact on production behavior or user-facing functionality.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 10, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 10, 2025

⚠️ No Changeset found

Latest commit: 64f9bb3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rodrigok rodrigok requested a review from ggazzo October 10, 2025 02:09
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Walkthrough

A single test in packages/message-parser/tests/timestamp.test.ts was updated to compute a timestamp token dynamically using the current GMT offset, replacing a previously hard-coded value. No production code or public interfaces were modified.

Changes

Cohort / File(s) Summary
Tests — dynamic timestamp token
packages/message-parser/tests/timestamp.test.ts
Replaced static token <t:10:00+00:00> with a dynamically computed token using new Date().toString().match(/GMT([-+]\d{4})/)?.[1].replace(/(.{3})/, '$1:') to reflect the current GMT offset in test expectations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I thump my paw at ticking time,
Swap fixed for flow—offsets align.
The clock now dances, GMT in tune,
A nimble hop beneath the moon.
Tests keep pace, no static gloom—
Rabbits love a moving rune. 🐇⏱️

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely describes the main purpose of the changeset, which is to fix the timestamp unit test when running outside the UTC timezone, and it reflects the actual modifications made to the test file.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/timestamp-unit-test

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b789b4c and 64f9bb3.

📒 Files selected for processing (1)
  • packages/message-parser/tests/timestamp.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/message-parser/tests/timestamp.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

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 and usage tips.

ggazzo
ggazzo previously approved these changes Oct 10, 2025
@ggazzo ggazzo changed the title chore: fix timestamp unit test when not running at UTC test: fix timestamp unit test when not running at UTC Oct 10, 2025
@ggazzo ggazzo added this to the 7.11.0 milestone Oct 10, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6b9b1d1 and b789b4c.

📒 Files selected for processing (1)
  • packages/message-parser/tests/timestamp.test.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

],
[
'<t:10:00+00:00>',
`<t:10:00${new Date().toString().match(/GMT([-+]\d{4})/)?.[1].replace(/(.{3})/, '$1:')}>`,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fragile regex approach may fail in non-standard environments.

The regex /GMT([-+]\d{4})/ assumes a specific format from Date.toString(), which is not standardized and may vary across JavaScript engines, Node versions, or locales. If the regex fails to match, the template string will contain undefined, causing test failures.

Apply this diff to use the more reliable getTimezoneOffset() method:

- `<t:10:00${new Date().toString().match(/GMT([-+]\d{4})/)?.[1].replace(/(.{3})/, '$1:')}>`,
+ (() => {
+   const offset = -new Date().getTimezoneOffset();
+   const hours = Math.floor(Math.abs(offset) / 60).toString().padStart(2, '0');
+   const minutes = (Math.abs(offset) % 60).toString().padStart(2, '0');
+   const sign = offset >= 0 ? '+' : '-';
+   return `<t:10:00${sign}${hours}:${minutes}>`;
+ })(),

This approach is explicit, standardized, and works reliably across all JavaScript environments.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`<t:10:00${new Date().toString().match(/GMT([-+]\d{4})/)?.[1].replace(/(.{3})/, '$1:')}>`,
// …
(() => {
const offset = -new Date().getTimezoneOffset();
const hours = Math.floor(Math.abs(offset) / 60)
.toString()
.padStart(2, '0');
const minutes = (Math.abs(offset) % 60)
.toString()
.padStart(2, '0');
const sign = offset >= 0 ? '+' : '-';
return `<t:10:00${sign}${hours}:${minutes}>`;
})(),
// …
🤖 Prompt for AI Agents
In packages/message-parser/tests/timestamp.test.ts around line 106, the code
uses Date.toString() with the fragile regex /GMT([-+]\d{4})/ which can fail in
non-standard environments; replace this with a deterministic calculation using
Date.prototype.getTimezoneOffset(): compute offsetMinutes =
-date.getTimezoneOffset() (note the sign inversion), derive sign ('+' or '-')
and absolute hours/minutes with zero-padding to produce a string in "+HH:MM"
format, and inject that into the template string instead of relying on the regex
match returning undefined.

@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.39%. Comparing base (6b9b1d1) to head (64f9bb3).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37195      +/-   ##
===========================================
+ Coverage    67.38%   67.39%   +0.01%     
===========================================
  Files         3287     3287              
  Lines       111684   111684              
  Branches     20409    20409              
===========================================
+ Hits         75258    75270      +12     
+ Misses       33738    33731       -7     
+ Partials      2688     2683       -5     
Flag Coverage Δ
e2e 57.30% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants