Guide

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.

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

  1. 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.

    Check: Every receipt has one commit and can be found by that commit.

  2. 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.

    Check: Editing a file mid-run gives a receipt the merge refuses.

  3. 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.

    Check: A hand-edited receipt that says passed but lists a failed step is refused.

  4. 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.

    Check: A pull request that edits the tier rules is still judged by the old ones.

  5. 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.

    Check: A new push after the run is refused until the gate runs again.

  6. 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.

    Check: Every reused receipt can be traced to the rule that allowed it.

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.