fix(catalog-update): capture attestation evidence (--format json) - #25
Merged
Conversation
gh attestation verify suppresses its human-readable summary when stdout is not a TTY (headless CI), so the PR body's raw-evidence block came out empty. Verify with --format json and distil predicate/signer/issuer via _summarize_verify; fall back to stderr on failure. +2 unit tests (21->23).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes empty “raw evidence” blocks in catalog update PR bodies by switching gh attestation verify to emit JSON in CI (non-TTY) and summarizing that JSON into a compact predicate/signer/issuer evidence snippet.
Changes:
- Add
_summarize_verify()to distillgh attestation verify --format jsonoutput into a readable evidence block. - Update
verify_subject()to callgh attestation verify ... --format jsonand use summarized output on success (stderr fallback on failure). - Add unit tests for
_summarize_verify()(21 → 23 tests).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/actions/plugin-catalog-update/catalog_update.py |
Switch verification to --format json, add summarization helper, and adjust evidence capture behavior in CI. |
.github/actions/plugin-catalog-update/test_catalog_update.py |
Add tests validating summarization output and non-JSON fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…t json in re-verify cmds - _summarize_verify falls back to raw output on a non-list / unexpected shape and on an empty result (never a blank evidence block); skips non-dict records. - render_pr_body's re-verify commands include --format json so they produce evidence in non-TTY contexts too (Copilot review). +3 tests.
…rify
A truthy non-dict nested value (e.g. verificationResult: "x") slipped past the
`or {}` guard and crashed on .get(). Guard every nested access with isinstance
via _d(); malformed records are skipped and fall back to raw. +1 regression test.
…failing test) A dict verificationResult with junk nested values produced a useless '?'-only block instead of falling back. Skip a record unless a predicate/signer/issuer is actually extracted; then both non-dict and junk-dict shapes fall back to raw. Fixes the regression test that failed in the prior commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The re-pin PR body's
<details>raw-evidence block came out empty on the live run (PR #6). Root cause:gh attestation verifysuppresses its human-readable summary when stdout is not a TTY (headless CI), sostdout+stderrwere both empty even on success.Fix: verify with
--format json(which does write to stdout) and distil it via_summarize_verifyinto predicate / signer / issuer; fall back to stderr on failure (which carries the error). Verified locally againstattested-delivery-0.1.1.tar.gz— the block now shows the signerattest-release.yml@refs/tags/v0.1.1. The next real re-pin PR will carry populated evidence. +2 unit tests (21→23).