Repository navigation
Validate video duration limits and audio parameter types - #204
Conversation
|
Still need readability approvals from:
|
Validate duration capability constraints even when resolution is omitted by checking duration against the union of allowed durations across all supported resolutions for the model. Also validate that generate_audio, when present, is a boolean. When resolution is omitted, the union check provides a fail-closed floor (rejecting out-of-bounds durations such as 9999) rather than skipping the check. Outright rejection of omitted resolution is not applied here because actions.json does not express parameter requiredness; deriving requiredness from execute() signatures or schema annotations should be addressed in a dedicated follow-up. Impact clarification: earlier reviews overstated omission of resolution as a Veo cost vector. Omitting resolution is not a cost risk because generate_video.execute raises TypeError before any Veo call is dispatched. The actual defect is a fail-open contract violation and wasted worker queue work. TAG=agy CONV=1ece3a5d-2611-4c94-b69e-9e85c2753833
54ee975 to
a4314fe
Compare
|
Still need readability approvals from:
|
|
Still need readability approvals from:
|
|
Still need readability approvals from:
|
|
Still need readability approvals from:
|
Review: merge after a retitleMulti-agent review (reviewer → independent critique agent re-verifying each claim against the code). The critique pass overturned two of the reviewer's refactor suggestions; details below. The two checks this PR adds are correct, and the fail-closed change is safe to ship. The union-vs-pairwise distinction is well reasoned and the comment explains why it's a floor rather than a guarantee — the existing pairwise cross-product test still holds. Important The title claims work the body explicitly defersTitle: "Fail closed when required action parameters are absent." Nothing in the diff enforces required parameters. Merging under this title closes SM-11 silently. Suggest retitling to what it does — e.g. "Validate duration when resolution is omitted; require boolean Fail-closed risk assessment: benign, no announcement neededI checked whether this rejects previously-accepted submissions, and it can't meaningfully:
Worth fixing
Suggested deletions (~20 of 47 test lines)These three pass against old code, so they guard nothing new:
Keepers (these genuinely fail on old code): the two Explicitly not recommended
On the follow-up for real requirednessThe body says this needs "establishing a source of truth (e.g. deriving requiredness from Python
So the body's other suggestion — Two more notes
Spec caveat: I could not locate SM-11 ( |
Consolidated ReviewVerdict: Merge after a retitle, no code change needed. This note reconciles the 19:50 comment on this PR against head Do before merge
Nothing else is required before merge. Optional, does not block
Rejected or superseded, do not re-litigate
Evidence
Way forward
|
|
Still need readability approvals from:
|
Follow-up on Consolidated ReviewI addressed the scope mismatch from the Consolidated Review on head
There were no code changes in this follow-up. Verification: Current-head GitHub CI is complete: Python 3.11/3.12/3.13, UI build/lint/tests, deploy checks and security scans passed. Conditional zizmor jobs were skipped. |
victor-paunescu
left a comment
There was a problem hiding this comment.
Minor improvement for a test.
| @pytest.mark.parametrize('bad_audio', ('true', 'false', 1, 0, None, [1])) | ||
| def test_non_bool_generate_audio_rejected(bad_audio): | ||
| params = {**_FULL_VALID_VIDEO, 'generate_audio': bad_audio} | ||
| assert _code(_sub('generate_video', params)) == 'MALFORMED_SUBMISSION' |
There was a problem hiding this comment.
Since commit 0d6a560 hoisted the generate_audio boolean check before the model loop specifically so that non-boolean values (such as 1 or 'true') return MALFORMED_SUBMISSION rather than falling through to _capability_violation's AUDIO_REQUIRED check (if value is not True:) on audio_always_on: true models, adding an assertion with _OMNI here directly locks in that error-code precedence.
| @pytest.mark.parametrize('bad_audio', ('true', 'false', 1, 0, None, [1])) | |
| def test_non_bool_generate_audio_rejected(bad_audio): | |
| params = {**_FULL_VALID_VIDEO, 'generate_audio': bad_audio} | |
| assert _code(_sub('generate_video', params)) == 'MALFORMED_SUBMISSION' | |
| @pytest.mark.parametrize('bad_audio', ('true', 'false', 1, 0, None, [1])) | |
| def test_non_bool_generate_audio_rejected(bad_audio): | |
| params = {**_FULL_VALID_VIDEO, 'generate_audio': bad_audio} | |
| assert _code(_sub('generate_video', params)) == 'MALFORMED_SUBMISSION' | |
| assert _code(_sub('generate_video', {**_OMNI, 'generate_audio': bad_audio})) == 'MALFORMED_SUBMISSION' |
There was a problem hiding this comment.
Agreed, thanks. I merged #204 on the head you approved (rather than pushing and invalidating the approval) and applied this suggestion in #207, wrapped to 80 columns.
Your assertion catches something the existing test misses. If the type check is moved back after _capability_violation, the existing test still passes 6/6, while the new _OMNI assertion fails 6/6 with AUDIO_REQUIRED.
Assert that a non-boolean generate_audio on an audio_always_on model (gemini-omni) is reported as MALFORMED_SUBMISSION, not AUDIO_REQUIRED. Without this, moving the type check back after the capability check passes the existing test unnoticed. Follow-up to review feedback from victor-paunescu on #204.
Summary
Evaluates resolution-dependent duration capability constraints independently of whether
resolutionis present inparams(validating against the union of all allowed durations across the model's supported resolutions when omitted), and validates thatgenerate_audio, when present, is a boolean.Impact Characterization
An earlier review overstated the omission of
resolutionongenerate_videosubmissions as a runaway Veo cost risk. The omission is NOT a cost vector:generate_video.executeraisesTypeErrorimmediately before any Veo generation call is dispatched. The actual harm is a fail-open contract violation plus wasted worker queue work — a request that should have been rejected at the front door instead travels to a worker and fails there. This change ensures front-door validation fails closed on invalid durations.Design Decisions & Follow-up Note
resolutionis omitted,duration_secondsis checked against the union of allowed durations across all supported resolutions for the model. This provides a minimal fail-closed floor (rejecting durations like 9999 or non-integers). Outright rejection of omitted resolution was not applied becauseui/definitions/actions.jsondoes not currently express parameter requiredness.execute()signatures or adding an explicit"required": trueannotation inactions.json). This should be addressed in a separate PR with dedicated design discussion and deliberate test updates.generate_audioelements are booleans, rejecting non-boolean types withMALFORMED_SUBMISSION.Verification
TZ=UTC python -m pytest -q test/test_submission_validation.py: 161 passed on the unchanged code heada4314fe.TAG=agy
CONV=1ece3a5d-2611-4c94-b69e-9e85c2753833