Skip to content

fix: verify G2 evidence after squash merge - #7

Merged
BunsDev merged 2 commits into
mainfrom
fix/g2-post-merge-evidence
Aug 12, 2026
Merged

fix: verify G2 evidence after squash merge#7
BunsDev merged 2 commits into
mainfrom
fix/g2-post-merge-evidence

Conversation

@BunsDev

@BunsDev BunsDev commented Aug 12, 2026

Copy link
Copy Markdown
Member

Repairs the post-merge G2 evidence relationship gate exposed by the approved PR #6 squash merge.

  • accepts only a one-commit, non-force push to main
  • resolves exactly one associated merged same-repository pull request
  • requires the squash commit tree to equal the reviewed PR terminal tree
  • retains the tested-source-to-terminal evidence-only comparison
  • resets evidence to candidate for a fresh exact-source CI attestation

The evidence-only passed rebind will follow after this source commit completes CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 12, 2026 03:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.md to candidate placeholders 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>
@BunsDev
BunsDev merged commit 1c20ccc into main Aug 12, 2026
13 of 14 checks passed
@BunsDev
BunsDev deleted the fix/g2-post-merge-evidence branch August 12, 2026 04:45
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.

2 participants