mirror of
https://github.com/calesthio/OpenMontage.git
synced 2026-08-05 15:20:40 +08:00
fix(schema): allow empty files[] in source_media_review artifact
review_source_media deliberately returns files:[] with a 'no source media — fully generated production' summary when no user media is supplied or none can be reviewed, but the schema declared files.minItems:1, so that intended artifact failed its own validation. Relax files.minItems to 0 to match the code's deliberate empty-media state (planning_implications still carries an entry, so its minItems:1 remains satisfied). Adds a regression test validating the no-source-media artifact. Closes #269
This commit is contained in:
29
tests/lib/test_source_media_review_empty.py
Normal file
29
tests/lib/test_source_media_review_empty.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Regression test for source_media_review empty-files artifact validity.
|
||||
|
||||
review_source_media deliberately returns an artifact with files:[] when no user
|
||||
media was supplied (or none could be reviewed) — a valid "fully generated
|
||||
production" state. The schema declared files.minItems: 1, so that intended
|
||||
artifact failed its own schema validation.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
|
||||
sys.path.insert(0, str(PROJECT_ROOT))
|
||||
|
||||
from lib.source_media_review import review_source_media # noqa: E402
|
||||
from schemas.artifacts import validate_artifact # noqa: E402
|
||||
|
||||
|
||||
def test_no_source_media_produces_schema_valid_artifact(tmp_path):
|
||||
art = review_source_media([tmp_path / "does-not-exist.mp4"], {})
|
||||
assert art["files"] == []
|
||||
# Must not raise — this is a legitimate no-source-media artifact.
|
||||
validate_artifact("source_media_review", art)
|
||||
|
||||
|
||||
def test_no_files_at_all_is_schema_valid():
|
||||
art = review_source_media([], {})
|
||||
assert art["files"] == []
|
||||
validate_artifact("source_media_review", art)
|
||||
Reference in New Issue
Block a user