Repository navigation
feat(webhooks): Parse feature_flags.* events into typed models - #580
Open
stanleyphu wants to merge 1 commit into
Open
stanleyphu wants to merge 1 commit into
stanleyphu wants to merge 1 commit into
Conversation
construct_event returned the eight feature_flags.* events' data as a plain Hash because EVENT_DATA_MODELS had no entries for them. Map them to the generated models the event classes already use (FeatureFlagsFlag*Data, FlagRule, FlagTarget), alongside the legacy flag.* entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stanleyphu
marked this pull request as ready for review
November 17, 2026 18:57
Contributor
[Medium impact] This PR appears safe to merge. SummaryAdds typed
No actionable issues found. Tests were reviewed but not run. Acknowledged scope: stanleyphu explicitly notes that typed Reviews (1) · Last reviewed commit: "feat(webhooks): Parse feature_flags.* ev..." · Reviewed by Greptile |
This branch has not been deployed
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.
Description
Why
Ruby is the only typed WorkOS SDK that still hands back the eight new
feature_flags.*webhook events as plain Hashes. Node, Python, Go, .NET and Kotlin already parse them into typed models. WorkOS is deprecating theflag.*events and asking customers to move tofeature_flags.*, so Ruby customers who migrate lose the typedevent.datathey had on the legacy events.The events are already in the subscription enum and the generated event classes exist, but
WebhookEvent::EVENT_DATA_MODELS(hand-maintained,@oagen-ignore-file) never got entries for them. This adds the eight mappings next to the legacyflag.*entries, which stay as they are. Each event uses the data model its generated event class already declares, which is also what the Node serializer uses:feature_flags.flag.{created,updated,deleted}→FeatureFlagsFlag{Created,Updated,Deleted}Data. All three are aliases ofFeatureFlagsFlagCreatedData, so.classprints that name.feature_flags.flag_rule.{created,updated,deleted}→FlagRulefeature_flags.flag_target.{created,deleted}→FlagTargetUnknown events still fall back to a Hash.
WebhookEventstill doesn't exposecontextfor any event, includingprevious_attributeson the update events. It's available onevent.raw["context"], the same as before.Proof
I ran the same signed payload through
client.webhooks.construct_eventand printedevent.data.class, before and after:The new
test/workos/test_webhook_event.rbsends spec-shaped payloads (the same ones the Python SDK uses as fixtures) throughconstruct_event. Before this change, everyfeature_flags.*case fails because the data is a Hash, for example:The four legacy
flag.*cases and the unknown-event case passed onmaintoo. With this change, all 16 pass, and the field checks pass as well:rule.position == 0,target.rule_id, andflag.owner.emailparsed into a typed owner.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
No. This only changes the SDK's parsed type for events that are already documented.
🤖 Generated with Claude Code