Landing policy: main's landed commits are never a PR's own

Merged
AF
5d ago
+98-7

A pull_request event's base SHA can predate a main that the PR branch later merged in. The landing policy then counted main's own landed merge commits as the PR's agent commits and refused them for the missing co-author trailer. #1098 hit this after merging current main: 9892b4c646 … agent commit missing alfonso-aft co-author trailer, where 9892b4c646 is main's merge of #1137.

  • Fix: check_event for pull_request also excludes commits reachable from the fetched origin/main. Those commits passed this policy when they landed, and a PR can't change origin/main. Without a fetched main, the stricter event base alone applies, as before.
  • Tests: PullRequestBaseBehindMergedMainTest builds exactly that case. Its main-merge test fails on the old code with the live refusal and passes with the fix, and a second test checks that a missing origin/main still refuses. The fixture runs git without the agent shell's commit hook, which otherwise adds the trailer to every fixture commit and made the first version of the test meaningless.

Verified: all 92 tests in test_merge_queue_workflow.py and test_pr_landing.py passed.


Summary by cubic

Fixes the landing policy so main's own landed commits are never counted as a PR's commits when reviewing pull_request events. The event's base SHA can predate a main the branch later merged in, which made the policy flag main's own merge commits for a missing co-author trailer and refuse the PR.

Bug Fixes

  • check_event for pull_request now excludes commits reachable from the fetched origin/main; without a fetched main, the stricter event base alone still applies.
  • New PullRequestBaseBehindMergedMainTest covers a PR whose base is behind a merged main and the missing-origin/main fallback.
  • The test fixture runs git without the agent shell's commit hook so fixture commits can control which carry the co-author trailer.
  • Adds a non-ranking search slice descriptor so CI covers the landing-policy script and its tests.