Connect lifecycle revisions to protected human review

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a10780-6d41-7952-9718-dfbc1f41236f
This commit is contained in:
tegwick 2026-10-04 20:33:24 +02:00
parent 0e79d69e27
commit f3b71b1521
16 changed files with 649 additions and 23 deletions

View file

@ -16,7 +16,7 @@ from .records import dumps
from .store import Conflict, EvidenceUnavailable
MAX_BODY = 256 * 1024
ROUTE = re.compile(r"/v1/decisions/([A-Za-z0-9._:-]{1,256})(?:/(events|comments|sources|evaluations|revisions|publications))?")
ROUTE = re.compile(r"/v1/decisions/([A-Za-z0-9._:-]{1,256})(?:/(events|comments|sources|evaluations|revisions|publications|review-requests|outcomes))?")
def _object(pairs):
@ -95,8 +95,12 @@ class LifecycleAPI:
raise ValueError()
return 200, {"events": self.service.events(caller, memo_id,
after=int(params.get("after", ["0"])[0]), limit=int(params.get("limit", ["100"])[0]))}
if method == "GET" and resource == "outcomes":
if set(params) != {"version"}:
raise ValueError()
return 200, self.service.outcomes(caller, memo_id, int(params["version"][0]))
kinds = {"comments": "comment", "sources": "source", "evaluations": "evaluation"}
if method != "POST" or resource not in {*kinds, "register", "revisions", "publications"}:
if method != "POST" or resource not in {*kinds, "register", "revisions", "publications", "review-requests"}:
raise LifecycleError(405, "method_not_allowed")
if params:
raise ValueError()
@ -115,6 +119,10 @@ class LifecycleAPI:
key = environ.get("HTTP_IDEMPOTENCY_KEY", "")
if not isinstance(key, str) or not key.strip() or len(key) > 256:
raise ValueError()
if resource == "review-requests":
if not isinstance(data, dict) or set(data) != {"version", "options"}:
raise ValueError()
return 200, self.service.request_review(caller, memo_id, data["version"], options=data["options"], key=key)
if resource == "publications":
if not isinstance(data, dict) or set(data) != {"version", "audience"}:
raise ValueError()