Some checks failed
check agents / check (push) Failing after 14s
- Report (cp1-assessment-report-agent 0.2.0, step s7): a model writes the Assessment report from facts worked out in code (register, gaps, scorecard, rule traces, checks, and what each application is from the Discovery package); code sets the verdict and renders the pages. The disposition_signoff review point moves from the critic to the report. - Package (cp1-assessment-package-agent 0.1.1, step s8): after sign-off, every step's output in one package, with a register, a gaps register, the sign-off record, lineage and a sha256 per part, in code. Page step s9. - scripts/kab_register_agents.py: registers deployed agents in KAB's agent catalog (an in-place workflow update doesn't). - Runs exec_1b1257380df7 (014) and exec_374d5d577077 (015) completed on crucible-kab-dev: critic pass, report figures all in its facts, package complete with every digest recomputing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.8 KiB
Python
39 lines
1.8 KiB
Python
"""The model writes the Assessment report; code supplies its facts and renders its pages (F02 ADR 0015).
|
|
|
|
`pre_process` replaces the step outputs with the facts worked out in code (`app/facts.py`), so the model writes from
|
|
the same register, gaps and scorecard the package holds. `post_process` sets the verdict and ids from those facts,
|
|
never from the model, and renders the HTML in code: `report_html` (marked as a draft, shown at the
|
|
`disposition_signoff` review point) and `final_html` (for the page step after approval).
|
|
|
|
The two hooks run in the same request, so the facts pass between them in a ContextVar.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import contextvars
|
|
from typing import Any, Optional
|
|
|
|
from app import facts, markdown
|
|
|
|
DRAFT = "Draft for sign-off. Not for release until the Engagement Lead continues the run at disposition_signoff."
|
|
_facts: contextvars.ContextVar[Optional[dict]] = contextvars.ContextVar("report_facts", default=None)
|
|
|
|
|
|
def pre_process(payload: dict) -> Optional[Any]:
|
|
found = facts.build(payload)
|
|
_facts.set(found)
|
|
return {"engagement_id": payload.get("engagement_id"), "run_id": payload.get("run_id"),
|
|
"discovery_execution_id": payload.get("discovery_execution_id"), "facts": found}
|
|
|
|
|
|
def post_process(result: dict) -> Optional[dict]:
|
|
found = _facts.get()
|
|
_facts.set(None)
|
|
if found is None:
|
|
return None
|
|
text = result.get("report_markdown") or ""
|
|
title = f"Assessment report: {found.get('engagement_id') or ''} {found.get('run_id') or ''}".strip()
|
|
return {**result, "engagement_id": found.get("engagement_id"), "run_id": found.get("run_id"),
|
|
"verdict": found.get("verdict") or "not supplied",
|
|
"signoff_queue": found["critic"]["signoff_queue"],
|
|
"report_html": markdown.page(text, title, DRAFT), "final_html": markdown.page(text, title)}
|