Skip to content

Commit 8ae6c46

Browse files
authored
Merge pull request #471 from QuantStrategyLab/codex/reconciliation-receipt-log-20260905
Emit reconciliation report URI for evidence collection
2 parents 9ad8cf8 + e4431a6 commit 8ae6c46

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,8 +1992,15 @@ def _handle_reconciliation():
19921992
)
19931993
try:
19941994
if report is not None:
1995-
persist_reconciliation_report(report)
1996-
print("broker reconciliation report persisted", flush=True)
1995+
report_path = persist_reconciliation_report(report)
1996+
if (
1997+
isinstance(report_path, str)
1998+
and report_path.startswith("gs://")
1999+
and not any(character.isspace() for character in report_path)
2000+
):
2001+
print(f"execution_report {report_path}", flush=True)
2002+
else:
2003+
print("broker reconciliation report persisted", flush=True)
19972004
except Exception as persist_exc:
19982005
print(
19992006
"failed to persist reconciliation report "

tests/test_request_handling.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,11 +1440,11 @@ def test_handle_reconciliation_persists_and_logs_only_redacted_failure_fields(
14401440
"log_runtime_event",
14411441
lambda _context, event, **fields: observed["events"].append((event, fields)),
14421442
)
1443-
monkeypatch.setattr(
1444-
strategy_module,
1445-
"persist_execution_report",
1446-
lambda report, **_kwargs: observed.setdefault("report", report),
1447-
)
1443+
def persist_report(report, **_kwargs):
1444+
observed["report"] = report
1445+
return "gs://private-reports/reconciliation.json"
1446+
1447+
monkeypatch.setattr(strategy_module, "persist_execution_report", persist_report)
14481448

14491449
with strategy_module.app.test_request_context("/reconcile", method="POST"):
14501450
body, status = strategy_module.handle_reconciliation()
@@ -1463,7 +1463,9 @@ def test_handle_reconciliation_persists_and_logs_only_redacted_failure_fields(
14631463
serialized = json.dumps(observed, sort_keys=True)
14641464
assert marker not in serialized
14651465
assert "demo-account" not in serialized
1466-
assert marker not in capsys.readouterr().out
1466+
output = capsys.readouterr().out
1467+
assert marker not in output
1468+
assert output == "execution_report gs://private-reports/reconciliation.json\n"
14671469

14681470

14691471
def test_handle_reconciliation_hides_disconnect_and_persistence_error_details(

0 commit comments

Comments
 (0)