Skip to content

chore: use the API timestamp format in test fixtures - #121

Open
felipefreitag wants to merge 1 commit into
mainfrom
fix/timestamp-format-fixtures
Open

chore: use the API timestamp format in test fixtures#121
felipefreitag wants to merge 1 commit into
mainfrom
fix/timestamp-format-fixtures

Conversation

@felipefreitag

@felipefreitag felipefreitag commented Aug 7, 2026

Copy link
Copy Markdown
Member

Context for reviewers

The Resend API returns timestamps in Postgres text format: YYYY-MM-DD HH:MM:SS[.ffffff]+00 (for example 2023-10-06 23:47:56.678+00). It is not ISO 8601. Fractional seconds vary from zero to six digits, so no fixed width can be assumed.

Our docs, OpenAPI spec, and SDK test fixtures claimed ISO 8601 for a long time. We fixed the docs and the spec, and we are now updating every SDK so the fixtures show what the API really sends. The SDKs treat these values as opaque strings, so behavior does not change.

ISO 8601 remains correct in three places: scheduled_at as a request parameter, webhook event payloads (millisecond precision with Z), and revoked_at in the DELETE /oauth/grants/{id} response.

What

Convert 143 fixture lines across 32 files. Each *Util.java expected object mirrors the mock JSON in the matching *Test.java, so both sides change together. ContactImports, DomainClaims, and the OAuth grant list fixtures already used the correct format.

What stays ISO 8601 on purpose

  • scheduledAt in request payloads and the javadoc on the request builders. The API accepts ISO there.
  • The signed webhook payload strings in WebhooksTest (verify() tests). Webhooks emit ISO, and these exact bytes feed the HMAC signature.
  • revoked_at in the revoke OAuth grant response. That endpoint returns ISO.

Verification

  • ./gradlew test: all 22 test classes pass.

Summary by cubic

Switch test fixtures to the API’s Postgres text timestamp format (e.g., "2023-10-06 23:47:56.678+00") so mocked responses and expected objects match real API behavior. No runtime changes; timestamps remain plain strings.

  • Refactors
    • Converted timestamps in test mocks and util fixtures to Postgres text format (supports 0–6 fractional digits).
    • Kept ISO 8601 only where the API uses it: scheduledAt request params, signed webhook payloads in verify tests, and revoked_at in the OAuth grant revoke response.
    • All tests pass (./gradlew test).

Written for commit 5fa8b8f. Summary will update on new commits.

Review in cubic

The API returns timestamps in Postgres text format, not ISO 8601.
Convert the response fixtures in the util classes and the mock
JSON in the test classes together, so expected objects and mock
responses stay in sync.

Keep ISO 8601 for scheduledAt request payloads, the signed
webhook payloads in the verify tests, and revoked_at in the
revoke response.

No runtime changes: every timestamp field is a plain String.

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

No issues found across 32 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: All changes are in test fixtures—switching mock timestamp strings to match the API's actual Postgres text format. No runtime code, no behavioral change, no operational tradeoff.

Re-trigger cubic

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