feat: add received_for to ReceivedEmail type#226
Open
lucasfcosta wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 4/5
- In
resend/emails/_received_email.py,received_foris required asList[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 toOptional[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] |
Contributor
There was a problem hiding this comment.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.