Skip to content

fix: SeamEvent union type by removing generic event resource - #964

Merged
razor-x merged 2 commits into
mainfrom
claude/seamevent-type-discriminability-6d92sn
Aug 14, 2026
Merged

fix: SeamEvent union type by removing generic event resource#964
razor-x merged 2 commits into
mainfrom
claude/seamevent-type-discriminability-6d92sn

Conversation

@razor-x

@razor-x razor-x commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

This PR fixes the SeamEvent discriminated union type by removing the generic event resource definition and updating the resource layout generation to exclude discriminated union resource types from the generic resources collection.

Key Changes

  • Removed generic event type from SeamEvent union: Deleted the first union member in SeamEvent that contained all-optional properties (created_at, event_description, event_id, event_type, occurred_at, workspace_id). This generic type was preventing proper type narrowing on the discriminant.
  • Updated resource layout context generation: Modified getResourceLayoutContexts() in codegen/lib/layouts/resources.ts to filter out discriminated union resource types (events and action attempts) from the generic resources collection before building the union.
  • Added explanatory comment: Documented why discriminated union resource types must be excluded from generic resources to maintain proper type narrowing behavior.

Implementation Details

The fix ensures that SeamEvent is a proper discriminated union where each member has a specific event_type value, allowing TypeScript to narrow the type correctly. By excluding the generic event resource from the resources collection during codegen, the union only includes the specific event type variants defined in the blueprint's events collection, preventing the all-optional generic type from interfering with type narrowing.

https://claude.ai/code/session_01L1miDUhtRigVPj3ZmPPU8y

Generate the SeamEvent union from the blueprint's top-level events
collection only, excluding the generic event resource whose all-optional
properties (including event_type) prevented TypeScript from narrowing
the union on event_type and made event_id optional everywhere.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1miDUhtRigVPj3ZmPPU8y
@razor-x razor-x changed the title Fix SeamEvent union type by removing generic event resource fix: SeamEvent union type by removing generic event resource Aug 14, 2026
@razor-x
razor-x marked this pull request as ready for review August 14, 2026 21:29
@razor-x
razor-x requested a review from a team as a code owner August 14, 2026 21:29
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1miDUhtRigVPj3ZmPPU8y
@razor-x
razor-x merged commit e5bf33e into main Aug 14, 2026
16 checks passed
@razor-x
razor-x deleted the claude/seamevent-type-discriminability-6d92sn branch August 14, 2026 21:56
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