fix(agents): parse direct log consumer receipts
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m12s
CD Pipeline / build-and-deploy (push) Successful in 4m53s
CD Pipeline / post-deploy-checks (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m12s
CD Pipeline / build-and-deploy (push) Successful in 4m53s
CD Pipeline / post-deploy-checks (push) Has been cancelled
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
@@ -302,6 +304,88 @@ async def test_log_controlled_writeback_consumer_loader_uses_direct_fallback(
|
||||
assert payload["operation_boundaries"]["metadata_ledger_read_performed"] is True
|
||||
|
||||
|
||||
def test_log_controlled_writeback_consumer_direct_rows_parse_json_text():
|
||||
dispatch_row = _ledger_rows()[0]
|
||||
consumer_row = _consumer_receipt_rows()[0]
|
||||
|
||||
direct_dispatch_rows = consumer_module._direct_result_rows(
|
||||
[
|
||||
{
|
||||
"op_id": dispatch_row["op_id"],
|
||||
"operation_type": dispatch_row["operation_type"],
|
||||
"actor": dispatch_row["actor"],
|
||||
"status": dispatch_row["status"],
|
||||
"created_at": dispatch_row["created_at"],
|
||||
"input_json": json.dumps({
|
||||
"semantic_operation_type": dispatch_row[
|
||||
"semantic_operation_type"
|
||||
],
|
||||
"ledger_operation_type": dispatch_row["ledger_operation_type"],
|
||||
"dispatch_receipt_id": dispatch_row["dispatch_receipt_id"],
|
||||
"batch_id": dispatch_row["batch_id"],
|
||||
"target": dispatch_row["target"],
|
||||
"target_surface": dispatch_row["target_surface"],
|
||||
"risk_tier": dispatch_row["risk_tier"],
|
||||
"project_id": dispatch_row["project_id"],
|
||||
"raw_payload_included": False,
|
||||
}),
|
||||
"output_json": json.dumps({
|
||||
"next_action": dispatch_row["next_action"],
|
||||
"post_apply_verifier_refs": dispatch_row[
|
||||
"post_apply_verifier_refs"
|
||||
],
|
||||
}),
|
||||
}
|
||||
],
|
||||
row_kind="dispatch",
|
||||
)
|
||||
direct_consumer_rows = consumer_module._direct_result_rows(
|
||||
[
|
||||
{
|
||||
"op_id": consumer_row["op_id"],
|
||||
"operation_type": consumer_row["operation_type"],
|
||||
"actor": consumer_row["actor"],
|
||||
"status": consumer_row["status"],
|
||||
"created_at": consumer_row["created_at"],
|
||||
"input_json": json.dumps({
|
||||
"semantic_operation_type": consumer_row[
|
||||
"semantic_operation_type"
|
||||
],
|
||||
"ledger_operation_type": consumer_row["ledger_operation_type"],
|
||||
"consumer_receipt_id": consumer_row["consumer_receipt_id"],
|
||||
"source_dispatch_receipt_id": consumer_row[
|
||||
"source_dispatch_receipt_id"
|
||||
],
|
||||
"target": consumer_row["target"],
|
||||
"target_surface": consumer_row["target_surface"],
|
||||
"consumer_surface": consumer_row["consumer_surface"],
|
||||
"runtime_target_write_performed": True,
|
||||
"raw_payload_included": False,
|
||||
}),
|
||||
"output_json": json.dumps({
|
||||
"target_context_receipt_write_performed": True,
|
||||
"post_apply_verifier_refs": consumer_row[
|
||||
"post_apply_verifier_refs"
|
||||
],
|
||||
}),
|
||||
}
|
||||
],
|
||||
row_kind="consumer",
|
||||
)
|
||||
|
||||
assert direct_dispatch_rows[0]["dispatch_receipt_id"] == (
|
||||
dispatch_row["dispatch_receipt_id"]
|
||||
)
|
||||
assert direct_dispatch_rows[0]["raw_payload_included"] == "false"
|
||||
assert direct_dispatch_rows[0]["post_apply_verifier_refs"] == (
|
||||
dispatch_row["post_apply_verifier_refs"]
|
||||
)
|
||||
assert direct_consumer_rows[0]["source_dispatch_receipt_id"] == (
|
||||
dispatch_row["dispatch_receipt_id"]
|
||||
)
|
||||
assert direct_consumer_rows[0]["runtime_target_write_performed"] == "true"
|
||||
|
||||
|
||||
def test_log_controlled_writeback_consumer_endpoint_returns_readback(monkeypatch):
|
||||
async def fake_loader():
|
||||
fake_db = _FakeDb(_ledger_rows())
|
||||
|
||||
Reference in New Issue
Block a user