| 123456789101112131415161718192021222324252627282930313233343536373839 |
- from content_agent.integrations.runtime_files import RUNTIME_FILENAMES
- from content_agent.run_service import RunService
- from content_agent.schemas import RunStartRequest
- from tests.p1_helpers import FakeQueryVariantClient, REAL_SOURCE_FIXTURE
- def test_v1_graph_generates_all_runtime_files(tmp_path):
- service = RunService(
- runtime_root=tmp_path / "runtime" / "v1",
- query_variant_client=FakeQueryVariantClient(),
- )
- state = service.start_run(
- RunStartRequest(platform_mode="mock", source=str(REAL_SOURCE_FIXTURE))
- )
- run_id = state["run_id"]
- assert state["status"] == "success"
- assert state["policy_run_id"].startswith("policy_run_")
- assert state["policy_bundle_id"] == "douyin_policy_bundle_v1"
- status = service.runtime.file_status(run_id)
- assert all(status[name] for name in RUNTIME_FILENAMES)
- final_output = service.read_json(run_id, "final_output.json")
- assert final_output["policy_run_id"] == state["policy_run_id"]
- assert final_output["summary"]["pooled_content_count"] == 0
- assert final_output["summary"]["review_content_count"] == 0
- assert final_output["summary"]["pending_content_count"] == 0
- assert final_output["summary"]["rejected_content_count"] == 3
- assert final_output["summary"]["effect_status_counts"] == {
- "success": 0,
- "pending": 0,
- "failed": 3,
- "rule_blocked": 0,
- }
- assert (
- final_output["policy"]["policy_bundle_hash"]
- == state["policy_bundle"]["policy_bundle_hash"]
- )
- assert final_output["walk_strategy"]["walk_strategy_version"] == "V1.0"
|