Skip to content

Add rejected_at to the thread message delivery - #187

Merged
piobeny merged 1 commit into
mainfrom
thread-delivery-rejected-at
Nov 23, 2026
Merged

piobeny merged 1 commit into
mainfrom
thread-delivery-rejected-at

Conversation

@piobeny

@piobeny piobeny commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The Get a thread API now returns rejected_at in the delivery object of sent (outbound) messages: the time a copy was rejected before sending, for example because the recipient is on the suppression list, and null otherwise. Spec change: mailtrap/mailtrap-openapi#75.

Changes

  • ThreadMessageDelivery: add rejected_at: string | null, next to bounced_at
  • Cover it in the Threads test

How to test

  • yarn jest src/__tests__/lib/api/resources/inbound/Threads.test.ts passes
  • Get a thread with a reply to a suppressed address: that message's delivery.rejected_at holds a timestamp

Summary by CodeRabbit

  • Bug Fixes
    • Thread message delivery details now support a rejection timestamp that may be unset, helping API consumers distinguish delivered messages from rejected messages and interpret their delivery status accurately. Rejected outbound messages retain their rejection timestamp, while delivered messages have no rejection timestamp. Delivery details also continue to represent a missing bounce timestamp as null.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Walkthrough

The thread message delivery type adds a nullable rejected_at field. The thread test includes delivered and rejected outbound messages and checks their rejection timestamps and delivery fields.

Changes: Thread delivery type

Layer / File(s) Summary
Delivery type and rejection timestamp tests
src/types/api/inbound/threads.ts, src/__tests__/lib/api/resources/inbound/Threads.test.ts
ThreadMessageDelivery adds rejected_at with type string | null. The test checks a null rejection timestamp for a delivered message and a timestamp for a not_delivered message, which has a null bounce timestamp.

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

Change: Feature

Suggested reviewers: mklocek

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: adding the rejected_at field to the thread message delivery type. The raw summary confirms the interface change in src/types/api/inbound/threads.ts and the matching te…
Description check Passed The description covers the motivation (Get a thread API now returns rejected_at for outbound messages, with a link to the spec change), the changes (type addition and test coverage), and a how-to-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.
Full details: Title check

Explanation

The title names the main change: adding the rejected_at field to the thread message delivery type. The raw summary confirms the interface change in src/types/api/inbound/threads.ts and the matching test update. The title is specific and accurate.

Full details: Description check

Explanation

The description covers the motivation (Get a thread API now returns rejected_at for outbound messages, with a link to the spec change), the changes (type addition and test coverage), and a how-to-test section. It follows the repository template structure. The Images and GIFs section from the template is omitted. That section is not needed for a type-only change. The test checkbox is unchecked, which is expected for a pending verification step.

  • 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

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: CHILL
  • Plan: Advanced
  • Run ID: 1af64146-9c41-4f6a-9c53-d4c60fd1f4b6
Commits

Reviewing files that changed from the base of the PR and between 761a996 and a66aa44.

Files selected for processing: 2

  • src/__tests__/lib/api/resources/inbound/Threads.test.ts
  • src/types/api/inbound/threads.ts

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

@piobeny
piobeny marked this pull request as ready for review November 18, 2026 09:42
status: "delivered",
delivered_at: "2026-05-08T11:40:05.000Z",
bounced_at: null,
rejected_at: null,

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.

[nitpick] Could you add a rejected outbound message to the fixture (status: "not_delivered" with rejected_at set), like the other SDKs do? Then the test also shows a real timestamp, not only null.

@piobeny
piobeny force-pushed the thread-delivery-rejected-at branch from a66aa44 to 8ef57a6 Compare November 23, 2026 11:36
@piobeny
piobeny enabled auto-merge November 23, 2026 11:37
@piobeny
piobeny merged commit 1de0b99 into main Nov 23, 2026
8 of 9 checks passed
@piobeny
piobeny deleted the thread-delivery-rejected-at branch November 23, 2026 11:37
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.

3 participants