Binding a merge to a gate receipt
For a team whose agents open pull requests: at the end no change merges without a passing gate run for its exact commit.
- Topics
- Skill areas
- Based on
- Updated
- ·
Before you start
-
A local gate that runs the checks for a change and exits with an error when one fails.
-
A merge that only one script may perform: branch protection requires a status that only that script posts.
Steps
Record what the run tested
Write the receipt when the run ends: the commit, its tree, the base it was tested on, the tier, and every step with its exit code and time. Name the file after the commit.
Mark a moving tree as dirty
If the commit or the working tree changed while the gate ran, mark the receipt dirty. A dirty receipt authorises nothing.
Recompute the verdict, never trust it
When you read a receipt, count it as passed only if it says so, lists its steps and no step failed. A receipt with no steps is not a pass.
Classify the change by the main branch’s rules
Decide which tier the change needed with the rules on the main branch, not the copy in the pull request. A change cannot lower its own bar by editing the rules.
Refuse a merge without a matching receipt
Before merging, compare the receipt with the pull request: same head commit, clean tree, right tier, and the same file list in git and on the hosting service. Then post the required status on that commit and merge pinned to it.
Rerun only what the main branch’s new commits touch
When the main branch moves, keep the receipt if the new commits touch none of the change’s files. If they overlap, rebase and rerun the tier for the overlap. Anything you cannot prove gets a full rerun.
When not to use this
-
A team that merges by hand after reading every diff: the receipt adds little to a person’s review.
-
A gate whose result depends on the network or the time of day: fix the flaky steps first, or the receipt records noise.
Where it comes from
Hintapiste.fi merges every pull request this way. The gate runs on a separate gate machine that has no right to merge, and a dropped connection never counts as a pass.