Skip to main content
BlueForge
Join waitlist
EngineeringNovember 10, 20266 min read

Required, Not Reported

Kristian Mandrup

Kristian Mandrup

Founder & CEO

The screen that did not add up

On a pull request against ages-of-dominion's main branch, the lint job the rule was written for had just passed - \u2713 success advisory CI / sim \u2014 lint (pull_request) - and beside it sat seven rows for jobs nobody would ever report: \u25cf pending required {CI / sim \u2014 lint (pull_request),ci/docs-only} marked required, not reported yet. The gate read pending on a build where everything that existed had succeeded.

Worse than the phantom rows was the demotion. Because the seven patterns matched nothing, every real job was classified advisory - and an advisory check cannot block a merge - so a skipped required check passed the gate. The branch rule was never broken. The local gate was simply not reading it the way Gitea reads it.

Required contexts are patterns

A branch protection's status_check_contexts entries are not context names. Gitea compiles each one with modules/glob.Compile - the no-separator form - and asks whether at least one reported status matches it; every pattern must match something for the pull request to be mergeable. The fleet's rules are brace alternations. ages-of-dominion's main names seven, each like {CI / sim \u2014 lint (pull_request),ci/docs-only}: satisfied by the sim job on a code pull request or by ci/docs-only on a docs-only one. One rule, two jobs - and a pattern that, compared as a string with either, matches nothing.

A dialect, not a glob

We did not call out to Gitea: fgit is a Node CLI and Gitea is a Go server. What we ported was modules/glob's compile step for the separator-free case - the only form MergeRequiredContextsCommitStatus ever uses - and the dialect turned out to be its own language, neither the shell's nor JavaScript's:

  • {a,b} is an alternation; a comma outside a brace group is literal.
  • + is a literal plus. Gitea does not do + repetition.
  • ? is exactly one character; * is any run of characters.
  • [abc] is a class and [!abc] its negation; a backslash escapes the next character.
  • Regex metacharacters - . ^ $ ( ) | - are all literal, and the whole pattern is anchored.

Patterns meet reported statuses in exactly one place in the port; there they resolve to the names of the required contexts, and the classifier goes back to matching names exactly, which is what it was written for. One failure rule matters more than the rest: a pattern Gitea cannot compile is not an error - Gitea logs it and drops it from the rule, so the pull request stays mergeable. The port returns null and refuses nothing. A gate that is stricter than the server in the wrong direction is not strict; it strands a PR the server would merge.

Pinned two ways

  1. Gitea's own fixtures. The cases from modules/glob/glob_test.go - separator cases dropped, because a separator changes the dialect (* stops there) and status contexts are compiled with none - are in the suite with Gitea's expectations verbatim. 50 rows. If the port's dialect ever drifts from the compiler it is a port of, the suite goes red.
  2. A differential that was run, not just written. Gitea's modules/glob was compiled into a standalone Go program and fed the same 50 rows. The Go compiler and the port agreed on every one.

Why the reference has to be a pin

Gitea's glob is a fork with a private dialect: no standard defines it, only that source at that ref does. So the fixtures are not "the glob fixtures" in the abstract - they are that version's expectations, and the harness that runs them compiles that version with a toolchain. Pin both, or the comparison quietly stops meaning anything: rebuild the harness from a moved reference and it will agree with whatever dialect it now compiles, which may be one production no longer runs. The pin is what turns a green differential into a claim with a subject - agrees with Gitea's modules/glob at this ref, as built by this toolchain - instead of a comforting measurement with nothing under it. When the reference should move, move the pin deliberately and re-run the 50: a red row then means the dialect changed, which is exactly the information a differential exists to deliver.

What changed in the wild

  • ages-of-dominion #539 (code): pending with seven phantoms becomes green, the seven pattern-matched jobs required.
  • ages-of-dominion #540 and #541 (docs-only): pending becomes green, ci/docs-only required on both.
  • Read afterwards: seven pattern-matched jobs required, four matching no pattern advisory, no phantom rows.
  • Plain-name rules (maintenance-os, accounting-os) and the [] rules (forge-control, blueforge): identical verdicts before and after.

68 new bridge tests and 5 new CLI tests carried the fix; it shipped the same day as fgit@0.46.0.

The repair that would have broken it

The fix deliberately touches no branch protection, because replacing the alternations with an empty list would be a regression: in Gitea, [] means every reported check must pass, so an advisory job's failure would start blocking. Two things follow that no port can paper over - a required context that is a pattern cannot be declared skipped-by-design by name (the skip declaration takes the reported context, not the pattern), and the rules are correct exactly as written. Only the reader was wrong.

Installed, not shipped

0.46.0 went to the registry the same day, and it reached this machine by hand. There is no fleet-wide installer: fgit is installed per machine, so every host still on an older build keeps misreading glob-rule repositories. A gate fix's reach is the install's reach.

The lesson

Our merge gate is a parser of somebody else's configuration, written in a different language, against a dialect owned by a project we do not control. The moment we saw it that way, the fix wrote itself: port the compile step and nothing else, pin the port to the reference's own fixtures, run the real implementation against it under a pinned toolchain, and never trust a comparison whose reference can drift. The branch rule was fine the whole time. Two readers disagreed about what it meant, and only one of them was checked against the original.

Stay in the Loop

Get early access to our products and be the first to know when we launch.

Join the Waiting List

Stay in the loop

Release notes and early access

One email when something ships: new platform features, new apps and launch invites. Join the waitlist to get early access to self-serve sign-up and promotion sites.

No spam. Unsubscribe with one click.