Skip to content

MODEXPW-651: Always format email context createdAt with millisecond precision - #752

Merged
julianladisch merged 2 commits into
masterfrom
MODEXPW-651
Aug 12, 2026
Merged

MODEXPW-651: Always format email context createdAt with millisecond precision#752
julianladisch merged 2 commits into
masterfrom
MODEXPW-651

Conversation

@julianladisch

Copy link
Copy Markdown
Contributor

https://folio-org.atlassian.net/browse/MODEXPW-651

Purpose

OrderEmailContextMapperTest.buildContext_setsCreatedAt:177 fails in about .1 % of all runs with this error:

Expecting actual:
  "2026-08-11T15:33:47Z"
to match pattern:
  "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z"

Example: https://github.com/folio-org/mod-data-export-worker/actions/runs/31503434083/job/93819003252

Cause: Instant.toString() omits the fractional part when the nano-of-second is zero, so roughly one order email in a thousand carried a createdAt without milliseconds and OrderEmailContextMapperTest failed at the same rate.

Approach

A fixed 3-digit millisecond instant formatter makes the output deterministic.

Pre-Merge Checklist:

Before merging this PR, please go through the following list and take appropriate actions.

  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • Check logging
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • n/a Were any API paths or methods changed, added or removed?
    • n/a Were there any schema changes?
    • n/a Did any of the interface versions change?
    • n/a Were permissions changed, added, or removed?
    • n/a Are there new interface dependencies?
    • There are no breaking changes in this PR.

Instant.toString() omits the fractional part when the nano-of-second is
zero, so roughly one order email in a thousand carried a createdAt
without milliseconds and OrderEmailContextMapperTest failed at the same
rate. A fixed 3-digit instant formatter makes the output deterministic.
@sonarqubecloud

Copy link
Copy Markdown

@markusweigelt markusweigelt 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.

Thx for your work!

@julianladisch
julianladisch merged commit 3ad8bd8 into master Aug 12, 2026
16 checks passed
@julianladisch
julianladisch deleted the MODEXPW-651 branch August 12, 2026 14:50
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