Skip to content

feat: add received_for to ReceivedEmail type#226

Open
lucasfcosta wants to merge 1 commit into
mainfrom
feat/received-for
Open

feat: add received_for to ReceivedEmail type#226
lucasfcosta wants to merge 1 commit into
mainfrom
feat/received-for

Conversation

@lucasfcosta

@lucasfcosta lucasfcosta commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Adds the received_for field to the received email response type, matching the API.


Summary by cubic

Add the received_for field to the ReceivedEmail response type to mirror the API and expose forwarding recipients; update the async receiving test to assert this field.

Written for commit 08251e2. Summary will update on new commits.

Review in cubic

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 2 files

Confidence score: 4/5

  • In resend/emails/_received_email.py, received_for is required as List[str] while analogous fields are optional, so responses that omit it could fail model parsing for some non-forwarded emails and break email ingestion for those cases — align it to Optional[List[str]] (or add a default) before merging.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="resend/emails/_received_email.py">

<violation number="1" location="resend/emails/_received_email.py:155">
P2: `received_for` is typed as `List[str]` (required) while similar optional list fields (`bcc`, `cc`, `reply_to`) are all `Optional[List[str]]`. If the API omits `received_for` for non-forwarded emails, this will cause a KeyError or type-checking issue.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

"""
Reply-to addresses.
"""
received_for: List[str]

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.

P2: received_for is typed as List[str] (required) while similar optional list fields (bcc, cc, reply_to) are all Optional[List[str]]. If the API omits received_for for non-forwarded emails, this will cause a KeyError or type-checking issue.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At resend/emails/_received_email.py, line 155:

<comment>`received_for` is typed as `List[str]` (required) while similar optional list fields (`bcc`, `cc`, `reply_to`) are all `Optional[List[str]]`. If the API omits `received_for` for non-forwarded emails, this will cause a KeyError or type-checking issue.</comment>

<file context>
@@ -152,6 +152,10 @@ class _ReceivedEmailDefaultAttrs(_ReceivedEmailFromParam, BaseResponse):
     """
     Reply-to addresses.
     """
+    received_for: List[str]
+    """
+    Addresses the email was received for (forwarding recipients).
</file context>

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