Skip to content

fix(flow-schema): decode audio prompt transcript#32

Merged
wavekat-eason merged 1 commit into
mainfrom
fix/parse-carry-prompt-transcript
Jul 20, 2026
Merged

fix(flow-schema): decode audio prompt transcript#32
wavekat-eason merged 1 commit into
mainfrom
fix/parse-carry-prompt-transcript

Conversation

@wavekat-eason

Copy link
Copy Markdown
Contributor

Why

The platform bakes a transcript into every audio prompt when it publishes a flow ({ audio: vprompt_…, transcript: "…" }). On re-parse, the shared schema logged a warning for each such node:

node "welcome" prompt: unknown field "transcript" is ignored by the engine

Root cause

#30 made transcript a first-class optional field on the audio-prompt model — it regenerated the TS model and bundled JSON schema and added promptTranscript()/Prompt::transcript(). But the hand-written safe-subset YAML parser in packages/flow-schema/src/parse.ts was never updated. Its decodePrompt still knew only ['audio'], so it:

  1. warned that transcript was an unknown field, and
  2. dropped it — promptTranscript() returned null for any audio prompt decoded via parseFlow, contradicting what feat: carry an audio prompt's transcript text #30 shipped.

Fix

Teach decodePrompt the field:

  • add transcript to the known-field list (no more spurious unknown_field warning), and
  • carry it onto the returned prompt, validated as a string (a non-string transcript is now an expected_string error, consistent with the model's transcript?: string).

The Rust twin already carries it (serde silently ignores unknowns and the Audio struct has the field), so this closes the TS-only gap and brings both twins back in sync.

Tests

  • New parse test: an audio prompt with transcript round-trips through decode, promptTranscript() returns the words, and zero unknown_field warnings are emitted.
  • New negative test: a non-string transcript yields expected_string.
  • Full flow-schema suite (88 tests) + tsc --noEmit green.

🤖 Generated with Claude Code

#30 added an optional `transcript` to the audio-prompt model (regenerated
the TS model + bundled schema, added `promptTranscript()`), but the
hand-written safe-subset parser in `parse.ts` was never taught the field.
So `decodePrompt` both warned "unknown field \"transcript\" is ignored by
the engine" and dropped it — `promptTranscript()` returned null for any
audio prompt decoded via `parseFlow`.

Teach `decodePrompt` the field: add it to the known-field list (no more
spurious warning) and carry it onto the returned prompt (validated as a
string, so a non-string transcript is an `expected_string` error). The
Rust twin already carries it — serde ignores unknowns and `Audio` has the
column — so this only closes the TS-side gap.

Surfaced by the platform baking transcripts into published flows: every
audio prompt logged a warning on re-parse.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wavekat-eason
wavekat-eason merged commit dd8761a into main Jul 20, 2026
3 checks passed
@wavekat-eason
wavekat-eason deleted the fix/parse-carry-prompt-transcript branch July 20, 2026 09:51
@github-actions github-actions Bot mentioned this pull request Jul 20, 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