From ad02ce36398c2a2732769c4f56324a8bf88b80d7 Mon Sep 17 00:00:00 2001 From: calesthio Date: Thu, 9 Jul 2026 07:32:21 -0700 Subject: [PATCH] fix(ci): stabilize character HyperFrames contract test --- .../test_character_animation_pipeline.py | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tests/contracts/test_character_animation_pipeline.py b/tests/contracts/test_character_animation_pipeline.py index 4c765936..0227ebd3 100644 --- a/tests/contracts/test_character_animation_pipeline.py +++ b/tests/contracts/test_character_animation_pipeline.py @@ -10,6 +10,7 @@ sys.path.insert(0, str(PROJECT_ROOT)) from lib.pipeline_loader import get_required_tools, get_stage_order, load_pipeline from schemas.artifacts import ARTIFACT_NAMES, validate_artifact +from tools.base_tool import ToolResult from tools.character.character_animation import ( ActionTimelineCompiler, CharacterAnimationReviewer, @@ -235,12 +236,7 @@ def test_character_style_is_normalized_for_schema(tmp_path): } -def test_character_renderer_can_handoff_to_video_compose(tmp_path): - hyperframes = HyperFramesCompose() - runtime = hyperframes._runtime_check() - if not runtime["runtime_available"]: - pytest.skip("HyperFrames runtime is required for character render handoff") - +def test_character_renderer_can_handoff_to_video_compose(tmp_path, monkeypatch): character_design = CharacterSpecGenerator().execute( {"characters": [{"id": "mouse_lead", "role": "lead", "body_type": "mouse with tail"}]} ).data["character_design"] @@ -286,6 +282,21 @@ def test_character_renderer_can_handoff_to_video_compose(tmp_path): assert Path(render_result.data["composition_path"]).exists() output_path = tmp_path / "renders" / "final.mp4" + captured_handoff = {} + + def fake_hyperframes_execute(self, inputs): + captured_handoff.update(inputs) + Path(inputs["output_path"]).write_bytes(b"fake mp4") + return ToolResult(success=True, data={"output": inputs["output_path"]}) + + monkeypatch.setattr(VideoCompose, "_hyperframes_available", lambda self: True) + monkeypatch.setattr( + VideoCompose, + "_run_final_review", + lambda self, *args, **kwargs: {"status": "pass", "issues_found": []}, + ) + monkeypatch.setattr(HyperFramesCompose, "execute", fake_hyperframes_execute) + compose_result = VideoCompose().execute( { "operation": "render", @@ -301,3 +312,8 @@ def test_character_renderer_can_handoff_to_video_compose(tmp_path): assert compose_result.success, compose_result.error assert output_path.exists() + assert captured_handoff["operation"] == "render" + assert captured_handoff["workspace_path"] == render_result.data["hyperframes_workspace"] + assert captured_handoff["output_path"] == str(output_path) + assert captured_handoff["edit_decisions"]["render_runtime"] == "hyperframes" + assert captured_handoff["skip_contrast"] is True