Skip to content

feat: add AI workflow snapshot command#210

Merged
ProfRandom92 merged 1 commit into
mainfrom
feat/ai-workflow-snapshot
May 22, 2026
Merged

feat: add AI workflow snapshot command#210
ProfRandom92 merged 1 commit into
mainfrom
feat/ai-workflow-snapshot

Conversation

@ProfRandom92
Copy link
Copy Markdown
Owner

Adds a minimal deterministic AI workflow snapshot command.

Validation:

  • python -m compileall -q scripts/ai_workflow_snapshot.py
  • pytest tests/test_ai_workflow_snapshot.py -q

@ProfRandom92 ProfRandom92 merged commit 49de2ce into main May 22, 2026
7 checks passed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new script, scripts/ai_workflow_snapshot.py, along with comprehensive unit tests to generate deterministic local AI workflow evidence snapshots. The script integrates with existing artifact and safety gate utilities to produce a compact JSON payload. Feedback was provided to enhance the robustness of the snapshot construction by strictly validating the validation_evidence field, ensuring it is treated as a list or raising a RuntimeError for unexpected types, which aligns with the repository's standards for processing JSON-like structures.

Comment on lines +66 to +72
snapshot: dict[str, Any] = {
"agent_artifact_bundle": agent_artifact_bundle,
"ok": agent_artifact_bundle["ok"],
"result": agent_artifact_bundle["result"],
"safe_pr_gate": agent_artifact_bundle["safe_pr_gate"],
"validation_evidence": agent_artifact_bundle["validation_evidence"],
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To maintain strictness when processing JSON-like data structures, expected list fields should be treated as empty lists if missing or null, and a RuntimeError should be raised for other non-list types. This ensures robustness even if the underlying bundle structure changes, adhering to the repository's general rules for JSON processing.

Suggested change
snapshot: dict[str, Any] = {
"agent_artifact_bundle": agent_artifact_bundle,
"ok": agent_artifact_bundle["ok"],
"result": agent_artifact_bundle["result"],
"safe_pr_gate": agent_artifact_bundle["safe_pr_gate"],
"validation_evidence": agent_artifact_bundle["validation_evidence"],
}
validation_evidence = agent_artifact_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")
snapshot: dict[str, Any] = {
"agent_artifact_bundle": agent_artifact_bundle,
"ok": agent_artifact_bundle["ok"],
"result": agent_artifact_bundle["result"],
"safe_pr_gate": agent_artifact_bundle["safe_pr_gate"],
"validation_evidence": validation_evidence,
}
References
  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant