canon: resolve work-record governance packets
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Python Tests / pytest (push) Successful in 21s

This commit is contained in:
codex 2026-08-22 22:35:37 +02:00
parent 3db3570b93
commit 8bda6e28b4
7 changed files with 255 additions and 11 deletions

View file

@ -35,9 +35,8 @@ ID_LIKE_RE = re.compile(r"^[A-Z][A-Z0-9]*(-[A-Z0-9]+)+-?[0-9]*$")
SKIP_DIRS = {".git", "node_modules", ".venv", "history", "agents_backup"}
TERMINAL = {"closed", "resolved", "done", "cancel", "finished", "archived"}
# task blocks are validated inline (state-hub owns their full parsing)
TASK_ID_RE = re.compile(r"^([A-Z]+-WP-[0-9]{4}-(LEGACY-)?T[0-9]{1,3}"
r"|ADHOC-[0-9]{4}-[0-9]{2}-[0-9]{2}-T[0-9]{2})$")
# task blocks are validated inline (state-hub owns their full parsing). The
# registry is the sole id-pattern authority, including grandfathered schemes.
TASK_STATUS = {"wait", "todo", "progress", "done", "cancel",
"in_progress", "blocked"} # aliases per migration window
@ -163,9 +162,13 @@ def main() -> int:
f"species are sidetracks (work-record-types_v0.1)")
continue
checked += 1
if fence == "task" or kind == "task":
if not TASK_ID_RE.match(rid):
errors.append(f"{rel}: task id '{rid}' malformed")
if fence == "task" and kind != "task":
errors.append(
f"{rel}: task fence id '{rid}' is registered as {kind}, "
"not task"
)
continue
if kind == "task":
st = block.get("status")
if st is not None and st not in TASK_STATUS:
errors.append(f"{rel}: {rid}: bad task status '{st}'")