Files
aios/tests/test_governed_writer_receipts_contract.py
T

39 lines
1.0 KiB
Python

"""Static contract checks for the durable root-only writer implementation."""
from pathlib import Path
SERVICE = (
Path(__file__).resolve().parents[1]
/ "active-runtime"
/ "app"
/ "aios_governed_local_writer_service.py"
)
POLICY = SERVICE.with_name("governed_local_writer.py")
def test_writer_has_durable_receipt_and_recovery_operations() -> None:
source = SERVICE.read_text(encoding="utf-8")
required = (
"request_id",
"idempotency_key",
"query_receipt",
"recover_request",
'"receipts"',
'"audit_sha256"',
"safe_to_retry",
)
for marker in required:
assert marker in source
def test_writer_keeps_protected_operations_out_of_append_policy() -> None:
source = POLICY.read_text(encoding="utf-8")
service = SERVICE.read_text(encoding="utf-8")
assert "_DENIED_PATH_SEGMENTS" in source
assert "force" in service
assert "history_rewrite" in service
assert "main" in source
assert "tag" in source
assert "baseline" in source