fix: name Prompt variants via schema titles#28
Merged
Conversation
The Prompt oneOf branches had no titles, so typify fell back to
positional Variant0/Variant1 names in the Rust model — every match
site needed a comment decoding which was which, and reordering the
branches would silently swap the meanings while still compiling.
Titling the branches Text / Audio gives Prompt::Text(String) and
Prompt::Audio { audio } in Rust, and named Text / Audio aliases in
the TS union. Annotation-only: the wire format, validation, and
conformance corpus are untouched.
Rust consumers matching on the old positional names must rename on
upgrade (0.0.x). The TS Prompt union is structurally unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hj93UCb3RKjF6mBwzhsp9f
wavekat-eason
marked this pull request as ready for review
July 19, 2026 10:15
Merged
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
Adds
titleannotations (Text,Audio) to the twoPromptoneOfbranches inschema/flow.v1.schema.json, and regenerates both languages' types.Before, the branches were untitled, so typify fell back to positional names —
Prompt::Variant0(String)/Prompt::Variant1 { audio }. Every match site needed a comment decoding which was which, and a future reordering of theoneOfbranches would silently swap the meanings while still compiling.After:
Prompt::Text(String)/Prompt::Audio { audio }; the decoder comment inmodel_ext.rsis gone.export type Prompt = Text | Audiowith namedText/Audioaliases (new public exports via the barrel; thePromptunion itself is structurally unchanged).Compatibility
titleis pure annotation — the wire format, ajv/jsonschema validation, and the conformance corpus are untouched. Noschema_versionchange.Tests
Both suites green:
cargo test -p wavekat-flow(conformance ×3),pnpm --filter @wavekat/flow-schema test(79 tests). No new tests: the change is name-only, and the existing conformance corpus already exercises both Prompt forms end-to-end through the generated types.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hj93UCb3RKjF6mBwzhsp9f