Fail closed when Grok STT words is not a JSON array - #149
Open
jmjava wants to merge 2 commits into
Open
Conversation
A string words field iterated characters and wrote empty timing.json. Non-object items were skipped, shifting token indices. Require arrays of objects; missing words still means no word stream. Co-authored-by: jmjava <jmjava@gmail.com>
jmjava
marked this pull request as ready for review
September 8, 2026 01:19
Co-authored-by: jmjava <jmjava@gmail.com>
Contributor
|
Stopping this loop. This is another sibling fail-closed type check, not product progress. Do not reopen. Do not mint #150. |
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.
Problem
_grok_stttreatedparsed.get("words") or []as a list and skipped anynon-dict item. A string
wordsfield was iterated character-by-character, anda scalar/list item inside
words/segmentssilently dropped that token. Whisperword indices and
wait_wordthen pointed at the wrong spoken times.This is the leftover from PR #146 (
_stt_json_numberonstart/enddid notcover the list shape).
Fix
words/segmentsmust be JSON arrays.words[i]/segments[i]).wordsstill becomes[](no word-level timestamps).segments: []still synthesizes a segment from words (or duration).Tests
test_grok_stt_string_words_raisestest_grok_stt_non_object_word_raisestest_grok_stt_object_segments_raisestest_grok_stt_missing_words_still_okLocal:
ruff check src/ tests/green;pytest tests/ -v --tb=short825 passed, 1 skipped;docgen benchmarkmeetssrc/docgen/benchmark_data/baseline.json(no--update-baseline).Out of scope
word: "") are still skipped; remaining token indices stay dense.verbose_jsontyped.words/.segments).wait_wordsemantic matching).