Names informed-decision-sitting-requester (approval:create only, no approve/consume, no redirect). Eight binding intents are drafted and not posted; c01 stays undecided vs secrets-engine-requester. No secret, no live registration, no bind. Assistant: grok Assistant-Session: 01a09dc1-b21e-77e1-919e-fcad2f82b267
47 lines
2.4 KiB
Python
47 lines
2.4 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
from informed_decision.records import memo_from
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
REG = json.loads((ROOT / "docs" / "keycape-sitting-requester-registration.json").read_text())
|
|
INTENTS = json.loads((ROOT / "docs" / "batches" / "2026-09-14" / "approval-create-intents.json").read_text())
|
|
|
|
|
|
def test_sitting_requester_is_create_only_and_unapplied():
|
|
assert REG["clientId"] == "informed-decision-sitting-requester"
|
|
assert REG["audience"] == "approval-engine"
|
|
assert REG["allowedScopes"] == ["approval:create"]
|
|
assert REG["grantTypes"] == ["client_credentials"]
|
|
assert REG["clientType"] == "confidential"
|
|
assert REG["serviceSubject"] == "informed-decision"
|
|
assert REG["tenant"] == "tenant:platform"
|
|
assert REG["applied"] is False
|
|
assert "redirect" not in json.dumps(REG).lower()
|
|
forbidden = {"approval:approve", "approval:consume", "approval:read", "openid"}
|
|
assert forbidden.isdisjoint(REG["allowedScopes"])
|
|
assert not REG["secretRef"].startswith("s.") and ":" in REG["secretRef"]
|
|
|
|
|
|
def test_create_intents_cover_the_sitting_and_are_not_posted():
|
|
assert INTENTS["posted"] is False
|
|
assert INTENTS["human_control"] is True
|
|
assert INTENTS["pdp_path"] is False
|
|
ids = [row["memo_id"] for row in INTENTS["intents"]]
|
|
sitting_ids = []
|
|
batch_root = ROOT / "docs" / "batches" / "2026-09-14"
|
|
for name in ("credentials", "decisions"):
|
|
index = json.loads((batch_root / name / "index.json").read_text())
|
|
sitting_ids.extend(row["memo_id"] for row in index["ordinal"])
|
|
assert ids == sitting_ids
|
|
undecided = [row for row in INTENTS["intents"] if row["create_client"] == "undecided"]
|
|
assert [row["memo_id"] for row in undecided] == ["infd-20260914-c01"]
|
|
for row in INTENTS["intents"]:
|
|
binding = row["binding"]
|
|
assert set(binding) == {"action", "actor", "principal", "purpose", "target"}
|
|
assert binding["actor"] == "informed-decision"
|
|
assert "digest" not in binding
|
|
batch = "credentials" if "-c0" in row["memo_id"] else "decisions"
|
|
memo = memo_from(json.loads((batch_root / batch / f"{row['memo_id']}.memo.json").read_text()))
|
|
assert binding["target"]["id"] == memo.binding.target.id
|
|
assert memo.question.startswith(binding["purpose"][:20]) or binding["purpose"] in memo.question or memo.question.rstrip("?") in binding["purpose"]
|