From 230ee54faa879c468344bb82f454579fd51944c8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 30 Jun 2026 22:14:22 +0800 Subject: [PATCH] test(agent): align log loop writeback counts --- ...t_log_controlled_writeback_executor_readback_api.py | 2 +- .../test_ai_agent_log_feedback_receipt_dry_run_api.py | 10 ++++++++++ docs/LOGBOOK.md | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/api/tests/test_ai_agent_log_controlled_writeback_executor_readback_api.py b/apps/api/tests/test_ai_agent_log_controlled_writeback_executor_readback_api.py index 2d51a93c3..869d4128b 100644 --- a/apps/api/tests/test_ai_agent_log_controlled_writeback_executor_readback_api.py +++ b/apps/api/tests/test_ai_agent_log_controlled_writeback_executor_readback_api.py @@ -94,7 +94,7 @@ def _assert_executor_readback(payload: dict): assert "km_rag_playbook_learning_loop" in context["consumable_by"] assert len(context["evidence_chain"]) == 4 assert len(context["next_action_queue"]) == 6 - assert set(item["target"] for item in context["next_action_queue"]) == set(batches) + assert {item["target"] for item in context["next_action_queue"]} == set(batches) assert context["learning_feedback_targets"] == [ "km", "rag", diff --git a/apps/api/tests/test_ai_agent_log_feedback_receipt_dry_run_api.py b/apps/api/tests/test_ai_agent_log_feedback_receipt_dry_run_api.py index cea2eb2f9..cfafeedd0 100644 --- a/apps/api/tests/test_ai_agent_log_feedback_receipt_dry_run_api.py +++ b/apps/api/tests/test_ai_agent_log_feedback_receipt_dry_run_api.py @@ -81,6 +81,16 @@ def _assert_feedback_dry_run_payload(payload: dict): assert all(receipt["write_enabled"] is False for receipt in receipts) assert all(receipt["raw_log_payload_persisted"] is False for receipt in receipts) assert {receipt["source_sample_id"] for receipt in receipts} == expected_source_sample_ids + p0_receipts = [ + receipt + for receipt in receipts + if receipt["source_sample_id"] == "p0_110_harbor_runner_control_path_sample" + ] + assert len(p0_receipts) == 6 + assert {receipt["target"] for receipt in p0_receipts} == targets + assert {receipt["service"] for receipt in p0_receipts} == { + "awoooi-110-control-path" + } boundaries = payload["operation_boundaries"] assert boundaries["dry_run_only"] is True diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index 95859f948..0efdc76a1 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -50699,7 +50699,7 @@ production browser smoke: - Controlled writeback plan / autonomous runtime control 的候選 receipt 由 12 增為 18,代表 6 個 writeback target(KM / RAG / PlayBook / MCP / verifier / AI Agent)都已包含這條 P0 blocker metadata receipt;仍維持 read-only,未執行 KM/RAG/PlayBook/MCP runtime write。 **本地驗證結果**: -- `DATABASE_URL=postgresql+asyncpg://test:test@localhost:5432/test PYTHONPATH=apps/api python3.11 -m pytest apps/api/tests/test_ai_agent_log_intelligence_integration_readback_api.py apps/api/tests/test_ai_agent_autonomous_runtime_control_api.py apps/api/tests/test_ai_agent_autonomous_runtime_control.py apps/api/tests/test_ai_agent_log_controlled_writeback_plan_readback_api.py -q`:`17 passed`。 +- `DATABASE_URL=postgresql+asyncpg://test:test@localhost:5432/test PYTHONPATH=apps/api python3.11 -m pytest apps/api/tests/test_ai_agent_log_intelligence_integration_readback_api.py apps/api/tests/test_ai_agent_log_feedback_receipt_dry_run_api.py apps/api/tests/test_ai_agent_log_post_write_verifier_dry_run_api.py apps/api/tests/test_ai_agent_log_controlled_writeback_plan_readback_api.py apps/api/tests/test_ai_agent_log_controlled_writeback_executor_readback_api.py apps/api/tests/test_ai_agent_log_controlled_writeback_dispatch_api.py apps/api/tests/test_ai_agent_autonomous_runtime_control_api.py apps/api/tests/test_ai_agent_autonomous_runtime_control.py -q`:`26 passed`。 - `PYTHONPATH=apps/api python3.11 -m ruff check ...`:通過。 - `PYTHONPATH=apps/api python3.11 -m py_compile ...`:通過。 - `python3.11 -m json.tool docs/operations/ai-agent-log-intelligence-runtime-sample-readback.snapshot.json`:通過。