from app.execution_view_payload import compact_execution_view def test_main_payload_removes_decision_details_and_runtime_previews(): source = { "schemaVersion": "8", "objective": { "decision": { "semanticKind": "decision", "card": {"primary": {"value": "目标"}}, "detail": {"blocks": [{"value": "完整业务详情"}]}, } }, "rounds": [ { "branches": [ { "dataDecisions": [ { "id": "data-decision:1", "recordId": 1, "reasoning": "原始理由", "sources": [{"post_id": "secret"}], "node": {"id": "data-decision:1", "card": {}}, }, ] }, { "retrievalStage": { "agentRuns": [ { "businessLabel": "知识 Agent", "agentType": "retrieve_data_knowledge", } ] } }, ], "convergenceBatches": [ { "review": { "id": "multipath-review:7", "eventId": 7, "roundIndex": 1, "branchIds": [1, 2], "status": "ok", "inputPreview": "完整任务", "outputPreview": "完整评审报告", "achievements": ["很长的报告内容"], "detailRef": "event:7", "decisionProjection": { "semanticKind": "decision", "card": {"primary": {"value": "通过"}}, "detail": {"blocks": [{"value": "完整评审"}]}, }, } } ] } ], } result = compact_execution_view(source) assert "detail" not in result["objective"]["decision"] review = result["rounds"][0]["convergenceBatches"][0]["review"] assert "inputPreview" not in review assert "outputPreview" not in review assert "achievements" not in review assert "detail" not in review["decisionProjection"] data_decision = result["rounds"][0]["branches"][0]["dataDecisions"][0] assert data_decision == { "id": "data-decision:1", "node": {"id": "data-decision:1", "card": {}}, } agent_run = result["rounds"][0]["branches"][1]["retrievalStage"]["agentRuns"][0] assert agent_run == {"businessLabel": "知识 Agent"} assert "retrieve_data_" not in str(result) assert source["objective"]["decision"]["detail"]