Skip to content

fix: name Prompt variants via schema titles#28

Merged
wavekat-eason merged 1 commit into
mainfrom
fix/prompt-variant-names
Jul 19, 2026
Merged

fix: name Prompt variants via schema titles#28
wavekat-eason merged 1 commit into
mainfrom
fix/prompt-variant-names

Conversation

@wavekat-eason

Copy link
Copy Markdown
Contributor

What

Adds title annotations (Text, Audio) to the two Prompt oneOf branches in schema/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 the oneOf branches would silently swap the meanings while still compiling.

After:

  • Rust: Prompt::Text(String) / Prompt::Audio { audio }; the decoder comment in model_ext.rs is gone.
  • TS: export type Prompt = Text | Audio with named Text / Audio aliases (new public exports via the barrel; the Prompt union itself is structurally unchanged).

Compatibility

  • title is pure annotation — the wire format, ajv/jsonschema validation, and the conformance corpus are untouched. No schema_version change.
  • Rust crate: variant rename is API-breaking for consumers matching on the positional names; fine under the 0.0.x posture (every 0.0.x release is treated as incompatible). The voice daemon's match sites will be renamed when it bumps its pin.
  • npm package: additive only.

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

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
wavekat-eason marked this pull request as ready for review July 19, 2026 10:15
@wavekat-eason
wavekat-eason merged commit 4318260 into main Jul 19, 2026
3 checks passed
@wavekat-eason
wavekat-eason deleted the fix/prompt-variant-names branch July 19, 2026 10:16
@github-actions github-actions Bot mentioned this pull request Jul 19, 2026
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