Skip to content

feat(logs): add logs API support#194

Merged
drish merged 4 commits intomainfrom
feat/logs-api
Apr 1, 2026
Merged

feat(logs): add logs API support#194
drish merged 4 commits intomainfrom
feat/logs-api

Conversation

@drish
Copy link
Copy Markdown
Member

@drish drish commented Mar 31, 2026

Adds resend.Logs.get() and resend.Logs.list() (+ async variants) mapping to the new GET
/logs/{id} and GET /logs endpoints.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 9 files

Confidence score: 3/5

  • There is a concrete medium-high risk in resend/logs/_logs.py: new /logs SDK methods appear to lack an explicit API-key permission verification step (severity 7/10, high confidence), which could lead to authorization/behavior inconsistencies in production usage.
  • resend/logs/_logs.py also has a likely runtime regression where AsyncRequest may be undefined if async extras are not installed, causing NameError instead of a clear dependency error path.
  • The example scripts in examples/logs.py and examples/async/logs_async.py have smaller but user-facing robustness issues (os.environ[...] can raise unexpected KeyError, and missing __main__ guard can trigger import side effects), which are fixable but worth addressing.
  • Pay close attention to resend/logs/_logs.py, examples/logs.py, and examples/async/logs_async.py - permission checks, async dependency handling, and example startup/env-guard behavior need validation.
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/logs/_logs.py">

<violation number="1" location="resend/logs/_logs.py:1">
P1: Custom agent: **API Key Permission Check SDK Methods**

New Logs SDK methods were introduced without an explicit API-key permission verification step for the new `/logs` operations. Please confirm production keys have Logs read permissions before release to prevent permission-denied failures.</violation>

<violation number="2" location="resend/logs/_logs.py:13">
P2: `AsyncRequest` can be undefined when async extras are missing, causing a runtime `NameError` in async methods. Guard this case and raise a clear `ImportError` message.</violation>
</file>

<file name="examples/logs.py">

<violation number="1" location="examples/logs.py:5">
P2: Use `os.getenv` (or membership check) for the API key guard; direct `os.environ[...]` access raises `KeyError` before your intended error handling.</violation>
</file>

<file name="examples/async/logs_async.py">

<violation number="1" location="examples/async/logs_async.py:6">
P2: Use `os.getenv` for the API key check so missing keys raise the intended `EnvironmentError` instead of `KeyError`.</violation>

<violation number="2" location="examples/async/logs_async.py:45">
P2: Wrap `asyncio.run(main())` in a `__main__` guard to avoid side effects when the module is imported.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

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/logs/_logs.py">

<violation number="1" location="resend/logs/_logs.py:14">
P2: Leaving the ImportError handler empty means `AsyncRequest` is undefined when async extras aren’t installed. Calls to `get_async`/`list_async` will now crash with a `NameError` instead of the intended `ImportError` message.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@drish drish merged commit db679b1 into main Apr 1, 2026
22 checks passed
@drish drish deleted the feat/logs-api branch April 1, 2026 20:54
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