fix: verify G2 evidence after squash merge - #7
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the G2 evidence verification script so that, after a squash-merge to main, the GitHub Actions-side relationship gate can still identify the reviewed PR terminal commit and confirm the squash merge commit’s tree matches the reviewed PR tree. The PR also resets docs/G2-EVIDENCE.md back to the expected “candidate” placeholders so CI can re-attest from the exact source commit.
Changes:
- Refactors the GitHub compare-response checks into
validate_evidence_only_compare(compare, tested, terminal). - Adds push-to-
main(squash-merge) handling by resolving the associated merged PR and verifying squash-tree == PR terminal tree. - Resets
docs/G2-EVIDENCE.mdtocandidateplaceholders and adds a unit test covering the reviewed squash-merge push happy path.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/check-g2-evidence.py | Adds squash-merge push provenance + tree-equivalence validation and refactors compare validation. |
| scripts/check-g2-evidence-test.py | Adds helpers and a new unit test for the squash-merge push path. |
| docs/G2-EVIDENCE.md | Resets evidence fields/matrix to candidate placeholders pending fresh CI attestation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+837
to
+861
| def squash_merge_terminal(root: pathlib.Path, event: dict[str, object]) -> str: | ||
| before = event.get("before") | ||
| after = event.get("after") | ||
| commits = event.get("commits") | ||
| head_commit = event.get("head_commit") | ||
| if ( | ||
| event.get("ref") != "refs/heads/main" | ||
| or event.get("created") is not False | ||
| or event.get("deleted") is not False | ||
| or event.get("forced") is not False | ||
| or event.get("size") != 1 | ||
| or event.get("distinct_size") != 1 | ||
| or not isinstance(before, str) | ||
| or not re.fullmatch(r"[0-9a-f]{40}", before) | ||
| or not isinstance(after, str) | ||
| or not re.fullmatch(r"[0-9a-f]{40}", after) | ||
| or not isinstance(commits, list) | ||
| or len(commits) != 1 | ||
| or not isinstance(commits[0], dict) | ||
| or commits[0].get("id") != after | ||
| or not isinstance(head_commit, dict) | ||
| or head_commit.get("id") != after | ||
| ): | ||
| fail("GitHub Actions main push provenance is invalid") | ||
|
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Repairs the post-merge G2 evidence relationship gate exposed by the approved PR #6 squash merge.
mainThe evidence-only passed rebind will follow after this source commit completes CI.