Skip to content

artifact: add agent artifact bundle example#204

Merged
ProfRandom92 merged 1 commit into
mainfrom
feat/agent-artifact-bundle-example
May 22, 2026
Merged

artifact: add agent artifact bundle example#204
ProfRandom92 merged 1 commit into
mainfrom
feat/agent-artifact-bundle-example

Conversation

@ProfRandom92
Copy link
Copy Markdown
Owner

Adds a deterministic committed example artifact for the agent artifact bundle.

Includes:

  • artifacts/agent_artifact_bundle_example.json
  • scripts/generate_agent_artifact_bundle_example.py
  • exact regeneration parity test in tests/test_agent_artifact_bundle.py

Scope

Artifact-backed reproducibility only. No timestamps, no random IDs, no network, no external APIs, and no unrelated artifact rewrites.

Validation

  • python -m compileall -q scripts/agent_artifact_bundle.py scripts/generate_agent_artifact_bundle_example.py
  • pytest tests/test_agent_artifact_bundle.py -q

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 deterministic agent artifact bundle example, including a new JSON artifact, a generation script, and comprehensive tests to verify schema stability and generator output. Feedback was provided to improve the robustness of JSON loading in the test suite by implementing error handling for missing files or malformed content and validating the resulting data structure.



def test_agent_artifact_bundle_example_has_stable_schema_and_content() -> None:
artifact = json.loads(ARTIFACT_PATH.read_text(encoding="utf-8"))
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

Adhere to the general rule for loading JSON files: handle FileNotFoundError and json.JSONDecodeError by raising a RuntimeError that includes the repo-relative path. Additionally, validate that the decoded payload is a dictionary before proceeding.

    try:
        artifact = json.loads(ARTIFACT_PATH.read_text(encoding="utf-8"))
    except (FileNotFoundError, json.JSONDecodeError) as exc:
        raise RuntimeError(f"Failed to load artifact from {ARTIFACT_PATH.as_posix()}: {exc}") from exc
    if not isinstance(artifact, dict):
        raise RuntimeError(f"Expected artifact in {ARTIFACT_PATH.as_posix()} to be a dictionary, got {type(artifact).__name__}")
References
  1. When loading JSON files, handle FileNotFoundError and JSONDecodeError by raising a RuntimeError that includes a repo-relative path. Additionally, validate that the decoded payload is of the expected type (e.g., a dictionary) before proceeding.

@ProfRandom92 ProfRandom92 merged commit 7e2cdbe into main May 22, 2026
7 checks passed
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