feat: add AI workflow evidence demo#212
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a script and tests for a deterministic local demo of the AI workflow evidence chain. The script processes artifact bundles and generates a PASS/FAIL summary. Review feedback focuses on adhering to repository standards for JSON processing, specifically requiring that missing or null list fields like status_short, changed_paths, and validation_evidence be treated as empty lists rather than raising errors immediately.
| status_short = safe_pr_gate.get("status_short") | ||
| changed_paths = safe_pr_gate.get("changed_paths") |
There was a problem hiding this comment.
In accordance with repository rules, treat null or missing values for expected list fields as empty lists, and raise a RuntimeError for other non-list types to maintain strictness.
status_short = safe_pr_gate.get("status_short")
if status_short is None:
status_short = []
if not isinstance(status_short, list):
raise RuntimeError("status_short must be a list")
changed_paths = safe_pr_gate.get("changed_paths")
if changed_paths is None:
changed_paths = []
if not isinstance(changed_paths, list):
raise RuntimeError("changed_paths must be a list")References
- When processing JSON data, treat null or missing values for expected list fields as empty lists, but raise a RuntimeError for other non-list types to maintain strictness.
| validation_evidence = bundle.get("validation_evidence") | ||
| if not isinstance(validation_evidence, list): | ||
| raise RuntimeError("demo bundle validation_evidence must be a list") |
There was a problem hiding this comment.
This field should default to an empty list if it is null or missing in the JSON payload, per the repository's general rules for JSON processing.
| validation_evidence = bundle.get("validation_evidence") | |
| if not isinstance(validation_evidence, list): | |
| raise RuntimeError("demo bundle validation_evidence must be a list") | |
| validation_evidence = bundle.get("validation_evidence") | |
| if validation_evidence is None: | |
| validation_evidence = [] | |
| if not isinstance(validation_evidence, list): | |
| raise RuntimeError("demo bundle validation_evidence must be a list") |
References
- When processing JSON data, treat null or missing values for expected list fields as empty lists, but raise a RuntimeError for other non-list types to maintain strictness.
| }, | ||
| "ok": ok, | ||
| "result": "PASS" if ok else "FAIL", | ||
| "validation_evidence": bundle["validation_evidence"], |
There was a problem hiding this comment.
Ensure that 'validation_evidence' is treated as an empty list if null or missing, and raise a RuntimeError for other non-list types to maintain strictness. This validation should be performed before dictionary construction.
validation_evidence = bundle.get("validation_evidence")
if validation_evidence is None:
validation_evidence = []
if not isinstance(validation_evidence, list):
raise RuntimeError("validation_evidence must be a list")References
- When processing JSON data, treat null or missing values for expected list fields as empty lists, but raise a RuntimeError for other non-list types to maintain strictness.
Adds a minimal deterministic local demo for the AI workflow evidence chain.
Validation: