fix(flow-schema): decode audio prompt transcript#32
Merged
Conversation
#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>
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.
Why
The platform bakes a
transcriptinto every audio prompt when it publishes a flow ({ audio: vprompt_…, transcript: "…" }). On re-parse, the shared schema logged a warning for each such node:Root cause
#30 made
transcripta first-class optional field on the audio-prompt model — it regenerated the TS model and bundled JSON schema and addedpromptTranscript()/Prompt::transcript(). But the hand-written safe-subset YAML parser inpackages/flow-schema/src/parse.tswas never updated. ItsdecodePromptstill knew only['audio'], so it:transcriptwas an unknown field, andpromptTranscript()returnednullfor any audio prompt decoded viaparseFlow, contradicting what feat: carry an audio prompt's transcript text #30 shipped.Fix
Teach
decodePromptthe field:transcriptto the known-field list (no more spuriousunknown_fieldwarning), andtranscriptis now anexpected_stringerror, consistent with the model'stranscript?: string).The Rust twin already carries it (serde silently ignores unknowns and the
Audiostruct has the field), so this closes the TS-only gap and brings both twins back in sync.Tests
transcriptround-trips through decode,promptTranscript()returns the words, and zerounknown_fieldwarnings are emitted.transcriptyieldsexpected_string.flow-schemasuite (88 tests) +tsc --noEmitgreen.🤖 Generated with Claude Code