Merge remote-tracking branch 'gitea-ssh/main' into codex/p0-product-manifest-standard-20260629
This commit is contained in:
@@ -132,6 +132,12 @@ def test_runtime_receipt_readback_summarizes_live_executor_closure_rows():
|
||||
project_id="awoooi",
|
||||
db_read_status="ok",
|
||||
operation_count_rows=[
|
||||
{
|
||||
"operation_type": "ansible_candidate_matched",
|
||||
"status": "dry_run",
|
||||
"total": 1,
|
||||
"recent": 1,
|
||||
},
|
||||
{
|
||||
"operation_type": "ansible_apply_executed",
|
||||
"status": "success",
|
||||
@@ -243,6 +249,24 @@ def test_runtime_receipt_readback_summarizes_live_executor_closure_rows():
|
||||
"action": "controlled_apply_result",
|
||||
},
|
||||
],
|
||||
mcp_gateway_count_rows=[
|
||||
{"status": "success", "total": 3, "recent": 1},
|
||||
],
|
||||
legacy_mcp_count_rows=[
|
||||
{"status": "success", "total": 2, "recent": 2},
|
||||
],
|
||||
service_log_count_rows=[
|
||||
{"status": "sanitized_recent_logs", "total": 2, "recent": 2},
|
||||
],
|
||||
executor_log_count_rows=[
|
||||
{"status": "success", "total": 2, "recent": 1},
|
||||
],
|
||||
timeline_count_rows=[
|
||||
{"status": "success", "total": 1, "recent": 1},
|
||||
],
|
||||
playbook_trust_count_rows=[
|
||||
{"status": "learning_active", "total": 4, "recent": 1},
|
||||
],
|
||||
)
|
||||
|
||||
assert readback["db_read_status"] == "ok"
|
||||
@@ -287,6 +311,79 @@ def test_runtime_receipt_readback_summarizes_live_executor_closure_rows():
|
||||
assert {stage["present"] for stage in ledger["stages"]} == {True}
|
||||
assert ledger["safety_contract"]["backfill_may_send_telegram"] is False
|
||||
assert ledger["safety_contract"]["live_apply_may_send_telegram_gateway_receipt"] is True
|
||||
trace = readback["trace_ledger"]
|
||||
assert trace["schema_version"] == "ai_agent_autonomous_trace_ledger_v1"
|
||||
trace_stage_ids = {stage["stage_id"] for stage in trace["stages"]}
|
||||
assert {
|
||||
"mcp_context",
|
||||
"service_log_evidence",
|
||||
"candidate",
|
||||
"check_mode",
|
||||
"executor_log_projection",
|
||||
"controlled_apply",
|
||||
"auto_repair_execution_receipt",
|
||||
"post_apply_verifier",
|
||||
"rag_km_learning",
|
||||
"playbook_trust",
|
||||
"timeline_projection",
|
||||
"telegram_receipt",
|
||||
} == trace_stage_ids
|
||||
assert trace["missing_required_stage_ids"] == []
|
||||
assert trace["recorded_stage_count"] == trace["stage_count"]
|
||||
assert "rag_km_learning" in trace["learning_source_stage_ids"]
|
||||
assert "playbook_trust" in trace["learning_source_stage_ids"]
|
||||
assert trace["public_safety"] == {
|
||||
"reads_raw_sessions": False,
|
||||
"stores_secret_values": False,
|
||||
"stores_unredacted_telegram_payload": False,
|
||||
"stores_internal_reasoning": False,
|
||||
}
|
||||
assert readback["mcp_context"]["total"] == 5
|
||||
assert readback["service_log_evidence"]["total"] == 2
|
||||
assert readback["executor_log_projection"]["total"] == 2
|
||||
assert readback["playbook_trust"]["by_status"]["learning_active"] == 4
|
||||
taxonomy = readback["log_integration_taxonomy"]
|
||||
assert taxonomy["schema_version"] == "ai_agent_log_integration_taxonomy_v1"
|
||||
assert taxonomy["normalized_event_flow"] == [
|
||||
"collect_source_log_or_receipt",
|
||||
"redact_and_hash_sensitive_fields",
|
||||
"assign_labels",
|
||||
"correlate_incident_operation_playbook",
|
||||
"write_trace_ledger",
|
||||
"retrieve_similar_context_via_rag",
|
||||
"select_or_repair_playbook",
|
||||
"run_check_mode_then_controlled_apply",
|
||||
"verify_and_write_learning_back",
|
||||
]
|
||||
assert {
|
||||
"project",
|
||||
"product",
|
||||
"website",
|
||||
"service",
|
||||
"package",
|
||||
"tool",
|
||||
"incident",
|
||||
"operation",
|
||||
"playbook",
|
||||
}.issubset(set(taxonomy["label_dimensions"]))
|
||||
source_family_ids = {item["source_family_id"] for item in taxonomy["source_families"]}
|
||||
assert {
|
||||
"mcp_gateway_tool_calls",
|
||||
"legacy_mcp_tool_calls",
|
||||
"service_package_logs",
|
||||
"executor_operation_logs",
|
||||
"auto_repair_receipts",
|
||||
"post_apply_verifier",
|
||||
"rag_km_entries",
|
||||
"playbook_trust_signals",
|
||||
"operator_timeline_projection",
|
||||
"telegram_delivery_receipts",
|
||||
} == source_family_ids
|
||||
assert taxonomy["rollups"]["source_family_count"] == 10
|
||||
assert taxonomy["rollups"]["active_source_family_count"] == 10
|
||||
assert taxonomy["rollups"]["classified_event_total"] > 0
|
||||
assert taxonomy["public_safety"]["raw_secret_collection_allowed"] is False
|
||||
assert taxonomy["public_safety"]["unredacted_payload_storage_allowed"] is False
|
||||
|
||||
|
||||
def test_runtime_receipt_readback_classifies_closed_failed_apply_as_ai_repair():
|
||||
|
||||
Reference in New Issue
Block a user