Skip to content

feat: Restore discriminated variants in the Ruby SDK - #561

Merged
razor-x merged 1 commit into
mainfrom
better-union-types
Aug 19, 2026
Merged

feat: Restore discriminated variants in the Ruby SDK#561
razor-x merged 1 commit into
mainfrom
better-union-types

Conversation

@razor-x

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

Copy link
Copy Markdown
Member

Summary

  • generate event subclasses by event_type and action-attempt subclasses by action_type
  • generate per-code error and warning subclasses while retaining generic fallbacks for unknown discriminants
  • dispatch variants from BaseResource.load_from_response without changing shared mergeProperties semantics
  • document enum values and correct action-attempt error/result nullability in YARD
  • preserve is_a?(SeamEvent) and is_a?(ActionAttempt) compatibility through inheritance
  • rename event payload method access to event_method so it no longer shadows Object#method
  • update webhook documentation and variant behavior specs

Compatibility

This removes off-variant accessors that previously existed on flattened classes. Although variant instances remain subclasses of the existing base classes, this behavior change should receive a major-version decision before release.

Unknown event types, action types, error codes, and warning codes fall back to their generic base classes for forward compatibility.

Verification

  • npm run generate
  • npm run typecheck
  • npm run lint
  • rake lint
  • rake test — 224 examples, 0 failures

@seamapi/types remains pinned at 1.1001.0. RBS signatures are intentionally left out of this change.

@razor-x
razor-x marked this pull request as ready for review August 19, 2026 21:02
@razor-x razor-x changed the title Restore discriminated variants in the Ruby SDK feat: Restore discriminated variants in the Ruby SDK Aug 19, 2026
@razor-x
razor-x merged commit 36ce153 into main Aug 19, 2026
17 checks passed
@razor-x
razor-x deleted the better-union-types branch August 19, 2026 21:02
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.

1 participant