Report WP-0024 approvals by task
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a02669-87ee-7a31-b111-edc95a16e0fa
This commit is contained in:
codex 2026-08-22 14:57:52 +02:00
parent defb2a556d
commit d8c0cd38a7
5 changed files with 80 additions and 9 deletions

View file

@ -65,8 +65,17 @@ def load_contract(path: Path = DEFAULT_CONTRACT) -> dict[str, Any]:
raise ReviewError("unsupported owner-review interface/version")
owners = value.get("owners")
hashes = value.get("artifact_sha256")
if not isinstance(owners, dict) or not owners or not isinstance(hashes, dict):
raise ReviewError("review contract requires owners and artifact_sha256 maps")
task_owners = value.get("task_owners")
if (
not isinstance(owners, dict)
or not owners
or not isinstance(hashes, dict)
or not isinstance(task_owners, dict)
or not task_owners
):
raise ReviewError(
"review contract requires owners, task_owners and artifact_sha256 maps"
)
for owner, review in owners.items():
if not isinstance(owner, str) or not isinstance(review, dict):
raise ReviewError("invalid owner review entry")
@ -81,6 +90,16 @@ def load_contract(path: Path = DEFAULT_CONTRACT) -> dict[str, Any]:
raise ReviewError(f"{owner}: unknown or missing read-only check")
if not assertions or not all(isinstance(item, str) for item in assertions):
raise ReviewError(f"{owner}: assertions must be non-empty strings")
expected_tasks = sorted(
task for task, required in task_owners.items() if owner in required
)
if sorted(review.get("tasks") or []) != expected_tasks:
raise ReviewError(f"{owner}: tasks disagree with task_owners")
for task, required in task_owners.items():
if not isinstance(task, str) or not isinstance(required, list) or not required:
raise ReviewError("task_owners entries must be non-empty owner lists")
if len(set(required)) != len(required) or any(owner not in owners for owner in required):
raise ReviewError(f"{task}: task_owners contains unknown or duplicate owners")
return value
@ -421,6 +440,14 @@ def aggregate_status(
"created_at": latest.get("created_at") if latest else None,
"stale_receipt_count": stale[owner],
}
tasks = {
task: {
"required_owners": required,
"decisions": {owner: owners[owner]["decision"] for owner in required},
"all_approved": all(owners[owner]["decision"] == "approve" for owner in required),
}
for task, required in contract["task_owners"].items()
}
try:
artifact_current = all(
file_sha256(ROOT / path) == expected
@ -435,8 +462,9 @@ def aggregate_status(
"contract_digest": digest,
"contract_artifacts_current": artifact_current,
"owners": owners,
"tasks": tasks,
"all_approved": artifact_current
and all(item["decision"] == "approve" for item in owners.values()),
and all(item["all_approved"] for item in tasks.values()),
}