fix: Create the action attempts client only when waiting - #1016
Open
razor-x wants to merge 2 commits into
Open
Conversation
Every action attempt route call eagerly constructed a full SeamHttpActionAttempts client, including complete option parsing, even when the request was never awaited or waiting was disabled. Generate a thunk instead and resolve it inside execute only when the request actually waits for the action attempt. A plain client is still accepted for compatibility. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
…ttempts Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
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.
Problem
SDK audit finding L8b (low): every generated action-attempt route method eagerly constructed a fresh
SeamHttpActionAttemptsclient —fromClient→ constructor → fullparseOptions— inside the request config. SinceSeamHttpRequestis lazy, this work ran even when the request was never awaited, and even whenwaitForActionAttemptwas disabled. The client is only consumed when a wait actually happens.Fix
Codegen emits a thunk (
actionAttempts: () => SeamHttpActionAttempts.fromClient(...)) andexecute()resolves it only on the waiting path. The config still accepts a plain client for compatibility. Regenerated route files.Tests
New test hand-builds a request with a counting thunk: building the request and awaiting it with
waitForActionAttempt: falsenever constructs the client; awaiting with waiting enabled constructs it exactly once and resolves the attempt. Existing wait-for-action-attempt suite covers the generated thunk path end to end. Full suite (126 tests), lint, typecheck green.Part of applying the rev-3 SDK audit (one PR per finding). Related: #1002–#1015.
🤖 Generated with Claude Code
https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
Generated by Claude Code