feat: scope action-attempt error and result accessors by status - #568
Merged
Conversation
Consume the actionAttemptStatuses property annotation from @seamapi/blueprint 1.10.0. Properties annotated with statuses are documented as only present for those statuses, typed as nullable, and their generated accessors return nil for any other status. Also guard ActionAttemptFailedError against a failed action attempt missing its error, falling back to a generic message instead of raising NoMethodError. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EdWS7o3htQ9cNxhCWL5Frp
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EdWS7o3htQ9cNxhCWL5Frp
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EdWS7o3htQ9cNxhCWL5Frp
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EdWS7o3htQ9cNxhCWL5Frp
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.
What this means for SDK users
errorandresulton an action attempt now behave and read the way the API actually works — populated only in their status,nileverywhere else:The generated docs say so on every accessor:
And a failed attempt whose payload is missing the error object now raises a proper error instead of
NoMethodError:Runtime API behavior is unchanged; per this SDK's dynamic style there is no new class hierarchy — just correct accessors and docs.
How
Bumps
@seamapi/blueprintto ^1.10.0, which annotates each action-attempt property with the statuses that populate it. Codegen turns the annotation into a genericavailable_only_for_statuses :error, ["error"]declaration on the resource (the reader returnsniloutside the listed statuses) plus the doc sentence. Nothing is keyed off the nameserror/result. The old hardcoded["error", "result"]nullability patch in codegen is removed.Verification
New specs cover: pending attempts returning
nileven when the payload carries data, per-status exposure, theActionAttemptFailedErrorfallback (directly and through the resolver), and the generated doc sentences.rake(standardrb + rspec): 236 examples, 0 failures. Regeneration from a clean install reproduces the diff exactly; onlylib/seam/resources/action_attempt.rbchanged among generated files.🤖 Generated with Claude Code
https://claude.ai/code/session_01EdWS7o3htQ9cNxhCWL5Frp