ALZ-F01 Discovery: package step, value scorecard, application grouping, cases
- New cp1-discovery-package-agent (ADR 0020): one package per reviewed run, every part hashed (sha256 over canonical JSON), with a manifest and a value scorecard. - Applications grouped CMDB -> tag -> resource group with a judged model fallback (ADR 0021): CMDB 0.7.0 carries ownership, dependency mapping 0.6.0 groups, report 0.9.0 shows them. - Critic 0.6.1 accepts the producers' enums; build_workflow.py refuses a consumer enum narrower than its producer's. - Code hooks, sub-agents and tests for the inventory, CMDB, dependency, planner and critic agents; the report and Well-Architected review agents; ADRs 0012-0021. - Workflow cases with value bars and run limits; run evaluation and usage collection scripts; the run context template and the field-by-field review for ADR 0016. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Write the Discovery report for a finished run, without running the report step.
|
||||
|
||||
Usage: render_discovery_report.py <steps.json> <report.md> [run id] [notice]
|
||||
|
||||
Also writes <report>.html beside it. Refuses to overwrite a report.
|
||||
"""
|
||||
import importlib.util
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "scripts"))
|
||||
from evaluate_workflow_run import outputs_by_step # noqa: E402
|
||||
|
||||
spec = importlib.util.spec_from_file_location("report", ROOT / "cp1-discovery-report-agent/app/report.py")
|
||||
report = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(report)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
source, target = Path(sys.argv[1]), Path(sys.argv[2])
|
||||
page = target.with_suffix(".html")
|
||||
if target.exists() or page.exists():
|
||||
raise SystemExit(f"{target} or {page} exists; reports are never overwritten")
|
||||
notice = sys.argv[4] if len(sys.argv) > 4 else None
|
||||
s = outputs_by_step(json.loads(source.read_text()))
|
||||
# The same fields as the report step's from_steps in build_workflow.py.
|
||||
data = {"engagement_id": s["s1"].get("engagement_id"), "run_id": sys.argv[3] if len(sys.argv) > 3 else None,
|
||||
"plan_summary": s["s1"].get("summary"), "coverage_gaps": s["s1"].get("coverage_gaps"), "source_gaps": s["s1"].get("source_gaps"),
|
||||
"scan_findings": s["s2"].get("findings"), "records": s["s3"].get("records"),
|
||||
"sme_review_queue": s["s3"].get("sme_review_queue"), "drift_items": s["s4"].get("drift_items"),
|
||||
"itsm_signals": s["s4"].get("itsm_signals"), "stores": s["s5"].get("stores"),
|
||||
"network_findings": s["s6"].get("findings"), "ranges": s["s6"].get("ranges"), "edges": s["s7"].get("edges"),
|
||||
"nodes": s["s7"].get("nodes"), "orphans": s["s7"].get("orphans"), "validation_queue": s["s7"].get("validation_queue"),
|
||||
"verdict": s["s8"].get("verdict"), "critic_note": s["s8"].get("note"), "obeyed_injection": s["s8"].get("obeyed_injection"),
|
||||
"unsupported_claims": s["s8"].get("unsupported_claims"), "consistency_issues": s["s8"].get("consistency_issues"),
|
||||
"parse_failures": s["s8"].get("parse_failures"), "tool_call_issues": s["s8"].get("tool_call_issues")}
|
||||
target.write_text(report.render(data, notice))
|
||||
page.write_text(report.render_html(data, notice))
|
||||
print(f"wrote {target} and {page}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user