Skip to content

Add rejected_at to the thread message delivery - #96

Open
piobeny wants to merge 1 commit into
mainfrom
thread-delivery-rejected-at
Open

piobeny wants to merge 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

  • InboundThreadMessageDelivery: add rejected_at: Optional[str] = None, next to bounced_at
  • Tests: rejected_at is None on a delivered copy and maps the timestamp on a rejected one

How to test

  • pytest tests/unit/api/inbound/test_inbound_threads.py passes
  • Get a thread with a reply to a suppressed address: that message's delivery.rejected_at holds a timestamp

Summary by CodeRabbit

  • New Features
    • Inbound message delivery details can now include the timestamp when a message was rejected. The field is optional and remains empty when no rejection timestamp is available. This also distinguishes rejected messages from messages with delivery or bounce timestamps.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The inbound thread delivery model adds an optional rejected_at timestamp. Tests cover missing and populated rejection timestamps in delivered and not-delivered message responses.

Changes: Inbound delivery timestamp

Layer / File(s) Summary
Rejection timestamp field and test coverage
mailtrap/models/inbound.py, tests/unit/api/inbound/test_inbound_threads.py
InboundThreadMessageDelivery adds optional rejected_at, defaulting to None. Tests check that delivered messages map to None and that not-delivered messages retain the supplied timestamp while bounced_at remains None.

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

Change: Feature

Suggested reviewers: mklocek

Merge Risk: Minimal · up to 56cbb

This adds an optional rejection timestamp to inbound thread message delivery. Existing responses without the field still parse, and the change is covered by unit tests. The merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: an optional rejected_at field added to the thread message delivery model (InboundThreadMessageDelivery). It matches the raw summary, the PR description, and the object…
Description check Passed The description covers motivation (Get a thread API now returns rejected_at for outbound messages, with a spec reference), the changes (field addition and tests), and how to test (pytest command and a…
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: an optional rejected_at field added to the thread message delivery model (InboundThreadMessageDelivery). It matches the raw summary, the PR description, and the objectives. It is specific and descriptive, not vague.

Full details: Description check

Explanation

The description covers motivation (Get a thread API now returns rejected_at for outbound messages, with a spec reference), the changes (field addition and tests), and how to test (pytest command and a manual API check). It follows the template's sections. The Images and GIFs section is omitted, but it is not critical for this backend-only change. The test checkboxes are unchecked, which is normal before merge.

  • 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: 2e4a3fde-9f60-4cf9-ad93-f71f568b849d
Commits

Reviewing files that changed from the base of the PR and between 23afc93 and 56cbbc7.

Files selected for processing: 2

  • mailtrap/models/inbound.py
  • tests/unit/api/inbound/test_inbound_threads.py

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

@piobeny
piobeny marked this pull request as ready for review November 18, 2026 09:42

This branch has not been deployed

No deployments
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.

1 participant