Fire the ref-update work when a merge moves a branch !139

merged merged by cmc on 2026-08-31 20:58 UTC · krz/gitbay:merge-fires-ref-events into main

Discussion

cmc

A merge updates the target ref with UpdateRefCAS, which never reaches post-receive, so nothing hanging off a ref update ran for it. Pushing a commit to a branch ran the whole CI config; merging the identical commit ran nothing.

Two things were missing, and both now happen in the merge path:

  • the push event postReceive records, which is what webhooks subscribe to — a subscriber watching push never heard that main moved
  • the branch's CI jobs

Mirrors were already marked dirty on merge; the issue description said otherwise and is corrected in a comment.

Shape

queueBuilds moves out of hookd into control.QueueBranchBuilds, so the two paths that move a branch share one implementation rather than diverging. hookd's method becomes a three-line call. The merge path records the push event with the same payload shape post-receive uses.

Taking now as a parameter keeps the scheduling behaviour identical without control reaching for the clock on its own.

Testing

e2e/ci_merge_test.go pushes a repo with a CI config, opens an MR from a feature branch, merges with --strategy merge, and asserts a build and a pending ci/unit status exist at the merge commit. The merge-commit strategy matters: that sha was never pushed, so the build can only come from the merge path.

Confirmed the test fails without the fix and passes with it. Full suite green, including the 474s e2e run.

No Parity row changes — this alters when an event fires, not which surfaces can do what.

Closes #65