feat: Generate a status-discriminated action attempt union - #1022
Merged
Conversation
Bump @seamapi/blueprint to 1.10.0 and consume the new actionAttemptStatuses property annotation. Each action attempt now generates one union member per status from its status enum: the status property is rendered as the status literal, and any property annotated with actionAttemptStatuses is rendered as null for statuses it does not list. SucceededActionAttempt and FailedActionAttempt extract the real success and error members from the union instead of intersecting with a status that recovered nothing. Code that dereferences error or result without narrowing on status stops typechecking; runtime API behavior is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EdWS7o3htQ9cNxhCWL5Frp
This was referenced Aug 27, 2026
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
ActionAttemptis now a union with one member peraction_type×status, so TypeScript knows exactly whenerrorandresultare real objects and when they arenull:SucceededActionAttempt<T>/FailedActionAttempt<T>now actually extract those members:Runtime behavior is unchanged — the API always sent
null; the types just stopped lying about it.How
Bumps
@seamapi/blueprintto ^1.10.0. Blueprint now annotates each action-attempt property with the statuses that populate it (error→['error'],result→['success']). Codegen expands each action attempt into one union member per status:statusbecomes the literal, annotated properties keep their type in listed statuses and render asnullotherwise. Nothing is keyed off the nameserror/result. Supersedes #1007.Verification
Type-level tests cover the four snippets above plus
resolveActionAttemptreturning the success type. 177 tests, typecheck, lint green. Regeneration from a clean install reproduces the diff exactly; tsc time and editor completion latency are unchanged (generated file 61 KB → 79 KB).🤖 Generated with Claude Code
https://claude.ai/code/session_01EdWS7o3htQ9cNxhCWL5Frp