feat(graph): planner_critique_node wired + critique_verdict ledger event [W2.D.2]#45
Conversation
…t RED [W2.D.2] Failing tests per BUILD_PLAN W2.D.2.a: - test_schema_rejects_loopback_with_empty_failed_questions: route="planner" + failed_questions=[] must raise ValidationError (W2.D.2 invariant) - test_schema_accepts_loopback_with_non_empty_failed_questions: valid path - test_schema_accepts_advance_with_empty_failed_questions: comprehension_gate OK - test_schema_rejects_unknown_route: Literal enforcement - test_planner_critique_node_emits_critique_verdict_event_on_pass: ledger entry event_type="critique_verdict" after node runs on valid plan - test_planner_critique_node_emits_critique_verdict_event_on_fail: same for loopback case with failed_questions in payload - test_planner_critique_node_sets_case_id_in_ledger_entry - test_planner_critique_node_returns_plandner_critique_verdict Currently RED: verdict.graph.nodes + verdict.ledger.memory missing.
…ion_gate [W2.D.2] Adds: - verdict/schemas/ledger.py: LedgerEntry with EventType (13 types including "critique_verdict"), three-tier ID hierarchy, HMAC chain fields, NIST SP 800-86 exam-env metadata (W1.B.11 from branch) - verdict/ledger/memory.py: InMemoryLedger — real Ledger Protocol impl backed by a list; blake3 derive_key HMAC; full LedgerEntry construction (not a mock; §3.10 compliant) - verdict/ledger/Ledger Protocol (structural, runtime_checkable) - verdict/graph/nodes.py: planner_critique_node(plan, ledger) — runs critique_plan, writes critique_verdict LedgerEntry with route + all_questions + failed_questions + hint in payload Schema invariant (W2.D.2): PlannerCritiqueVerdict(route="planner", failed_questions=[]) raises ValidationError — loopback with no reason is an infinite loop. All 17 planning tests GREEN; ruff clean.
W2.D.2 — PlannerCritiqueVerdict schema + critique_verdict ledger eventCI gate: 17/17 GREEN (9 from W2.D.1 + 8 new). Ruff: clean. PASS — hard rules
ISSUE —
|
Summary
PlannerCritiqueVerdictschema invariant:route="planner"+failed_questions=[]raisesValidationError(loopback with no reason = infinite loop, W2.D.2 load-bearing).LedgerEntryschema (verdict/schemas/ledger.py) with all 13 event types including"critique_verdict", three-tier ID hierarchy, NIST SP 800-86 exam-env metadata.InMemoryLedger(verdict/ledger/memory.py) — real Ledger Protocol implementation (not a mock, §3.10 compliant) backed by a list with blake3 derive_key HMAC chain.planner_critique_node(plan, ledger)(verdict/graph/nodes.py) — writescritique_verdictLedgerEntry with route + all_questions + failed_questions + hint in payload.Test plan
pytest tests/planning/test_planner_critique_verdict.py— 8 tests GREENruff check verdict/ tests/planning/— clean