Skip to content

STF-2206: Send second-level UTC offsets as whole minutes - #753

Merged
marselester merged 2 commits into
mainfrom
greg/stf-2206-minfraud-api-java-zoneddatetime-offsets-with
Nov 18, 2026
Merged

marselester merged 2 commits into
mainfrom
greg/stf-2206-minfraud-api-java-zoneddatetime-offsets-with

Conversation

@oschwald

@oschwald oschwald commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Fixes STF-2206, from the review of #724.

Jackson wrote a ZonedDateTime offset with seconds as ±HH:MM:SS. For example, Africa/Monrovia in 1971 gave 1971-06-01T10:00:00-00:44:30. RFC 3339 has no seconds in the offset, so the web service ignored the value and returned an INPUT_INVALID warning.

Mapper now registers a ZonedDateTime serializer. If the offset has seconds, the serializer rounds the offset to the nearest minute and keeps the same instant, as in the last example in RFC 3339 section 5.8. The Monrovia example becomes 1971-06-01T10:00:30-00:44. All other values serialize as before. The fix covers Event.time, phoneVerificationTime on Billing and Shipping, and Email.verificationTime.

MapperTest covers 6 offsets with seconds and 3 values that must not change. The 6 offset cases fail on main.

Impact is low. Since 1972, no time zone has used an offset with seconds.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Request timestamps with UTC offsets that include seconds are now sent with offsets rounded to the nearest minute, while preserving the represented instant. This applies to event times, phone verification times, and email verification times, preventing the web service from ignoring these values and returning a warning.
  • Documentation
    • Updated the 4.5.0 changelog to describe the timestamp serialization behavior and affected values.

@oschwald
oschwald requested review from horgh and a balanced review from Copilot November 17, 2026 20:25

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Mapper serializes ZonedDateTime values with offsets rounded to the nearest minute when the original offset contains seconds. The serializer preserves the instant. Parameterized tests cover serialization and instant preservation. The 4.5.0 changelog identifies affected request values.

Changes: ZonedDateTime request serialization

Layer / File(s) Summary
Offset serialization and validation
src/main/java/com/maxmind/minfraud/Mapper.java, src/test/java/com/maxmind/minfraud/MapperTest.java, CHANGELOG.md
Mapper registers a custom ZonedDateTime serializer that rounds offsets containing seconds to the nearest minute while preserving the instant. Parameterized tests cover offset values, fractional seconds, and UTC, and verify instant preservation. The changelog names affected request fields and notes that the web service previously ignored these values and returned a warning.

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

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 541e2

The change makes second-level UTC offsets serialize as whole minutes so the web service accepts them. Only unusual historical offsets are affected, and other values serialize as before. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: ZonedDateTime request offsets that contain seconds are now sent as whole minutes. The raw summary and PR objectives confirm that Mapper registers a serializer that rou…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: ZonedDateTime request offsets that contain seconds are now sent as whole minutes. The raw summary and PR objectives confirm that Mapper registers a serializer that rounds such offsets to the nearest minute while keeping the instant. The title uses the ticket ID, which is acceptable because it does not replace the descriptive part. The title is specific and matches the changeset.

Finishing Touches

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

A rabbit checks the clock at night
And rounds the seconds just right
The instant stays, the offset neat
The tests confirm the timestamps meet
Then hops away on paws so light

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8538fa99-9742-4c6f-8ac7-cc1093e64796
Commits

Reviewing files that changed from the base of the PR and between d989024 and 541e2ab.

Files selected for processing: 3

  • CHANGELOG.md
  • src/main/java/com/maxmind/minfraud/Mapper.java
  • src/test/java/com/maxmind/minfraud/MapperTest.java

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

Jackson wrote a ZonedDateTime offset with seconds as +HH:MM:SS, for
example 1971-06-01T10:00:00-00:44:30 for Africa/Monrovia. RFC 3339 has
no seconds in the offset, so the web service ignored the value and
returned a warning.

Mapper now truncates such an offset to whole minutes and keeps the same
instant. The offset stays, because the server uses it for the local time
of day. All other values serialize as before.

This applies to Event.time, phoneVerificationTime on Billing and
Shipping, and Email.verificationTime.

Fixes STF-2206.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oschwald
oschwald force-pushed the greg/stf-2206-minfraud-api-java-zoneddatetime-offsets-with branch from d989024 to 92ec873 Compare November 17, 2026 20:34
Copilot AI balanced review requested due to automatic review settings November 17, 2026 20:34

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

marselester
marselester previously approved these changes Nov 17, 2026
@oschwald
oschwald requested review from marselester and removed request for horgh November 17, 2026 22:43
The last example in RFC 3339 section 5.8 shows an offset with seconds.
It keeps the instant and uses the closest whole-minute offset. Round the
offset to match it, not truncate. For example, +05:30:45 becomes +05:31,
not +05:30.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 22:52

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@marselester
marselester merged commit 6eff43f into main Nov 18, 2026
30 checks passed
@marselester
marselester deleted the greg/stf-2206-minfraud-api-java-zoneddatetime-offsets-with branch November 18, 2026 14:03
@oschwald oschwald mentioned this pull request Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants