Fail closed when timing.json stems are not JSON objects - #126
Merged
Conversation
load_bundle_timing only typed the JSON root, so a list or scalar under a stem looked like missing words at compile and crashed sync_audio_tail_waits with AttributeError. Reject non-object stem values with TimestampError. Co-authored-by: jmjava <jmjava@gmail.com>
Co-authored-by: jmjava <jmjava@gmail.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.
Problem
load_bundle_timingalready rejects corrupt JSON and a non-object root. Per-stem values were untyped.A list, string, number, or
nullunder a stem then:scene-spec-generatetreated the stem as missingwords(pace: nonecompiled as if timestamps had never been run).sync_audio_tail_waits_in_scenescalled.geton a list and raisedAttributeError.Change
Every present
timing.jsonstem value must be a JSON object. Missing file is still{}. A present non-object stem raisesTimestampError(timing.json['stem'] must be a JSON object, not …).sync_audio_tail_waits_in_scenesskips a stem only when the payload is a dict withoutsegments.Tests
Local:
ruff check src/ tests/green;pytest tests/725 passed, 1 skipped;docgen benchmarkmeetssrc/docgen/benchmark_data/baseline.json(no--update-baseline).load_bundle_timing/extract_allreject list and scalar stems without rewriting the filelinted_class_block_from_spec(pace: none) fails on a list stemtiming_sync, scene-asset checks, and wizard statuses surface the errorsync_audio_tail_waits_in_scenesraisesSceneGenerationErrorinstead ofAttributeErrorOut of scope
segments.allstill leavestiming.jsonunchanged (Fail-closed timestamps, concat, and Anthropic base_url #78)words/segmentslist typing (paced compile already fails whenwordsis missing)_load_timinghelpers inside compiledscenes.py