Expand description
Queue-as-bot v0 (DECISIONS.md D21, queue stage): speculative merge trains, checked either by the host forge’s CI or by our own (D18).
v0 is verdict-only: it builds a train commit (base tip + each open PR merged in submission order, conflicts excluded), gets a verdict on it, then reports a per-PR verdict as a commit status. It never moves the protected branch on its own — landing the train is a separate, explicitly requested step.
The check signal has two shapes. The forge one publishes the train
as the choir/train branch and polls the forge’s check API, which
means the speculative merge of every open PR is pushed to a public
remote and tested by someone else’s runners. run_train_ci is the
other: it hands the train to a choir_queue::executor::CiExecutor,
so the same train is checked here, on a provider we chose, and
nothing speculative leaves the machine.
Everything in this module is local git; the forge API glue lives in
crate::github so the train mechanics stay testable offline.
Structs§
- Differential
Outcome - Structured advisory result returned by the separately built D23 runner.
- Differential
Session - Three revision worktrees whose lifetime is a whole calibration run rather than a single observation.
- Queued
Round - Result of one queued round.
- Train
- Result of building one speculative train.
- Train
Entry - One PR’s fate in a train build.
- Train
Report - What one train verdict means for the PRs riding it.
Enums§
- Differential
Verdict - Closed set of D23 classifications accepted from the runner.
- PrOutcome
- One pull request’s fate in a queued round.
Constants§
- SPECIMEN_
REPRODUCTION_ RUNS - Reproduction runs a harvest adds after a first
interaction_failureverdict, so a specimen records six runs in total — the bar specimen #1 (rust-lang/log11eda98d, reproduced 6/6) set for calling a flag a semantic conflict rather than a flake.
Functions§
- already_
in - Whether every commit of
headis already contained inupstreamby patch identity.git cherrymarks a commit-when an equivalent change (samegit patch-id --stable) is upstream,+when it is not; no+lines — including the empty output of a plain ancestor — means there is nothing left to merge. - build_
train - Builds a speculative train in
repo(a non-bare clone whose worktree this function owns): detaches atbase, then merges each(id, head)in order with--no-ff. A conflicting PR is excluded (merge aborted) and the train continues without it. - harvestable_
merges - Two-parent merge commits along
repo’s first-parent history, newest first: the populationchoir-bridge harvestreplays (D27). - land
- Lands a green train: pushes
tiptobranchon the remote aturlWITHOUT force, so git’s fast-forward rule is the race guard — if the branch moved since the train was built, the push is rejected and the caller should rebuild on the next round. - merge_
changes_ only_ inert_ paths - Whether every file this merge changed, against either parent, is
inert by
path_is_inert. - observed_
merges - Merge commits already recorded in
state_dir’s observation ledger, keyed by the ledger row’srevisions.mergedoid. - parse_
merge_ list - Parses
git log --format="%H %P"output into the ids of commits with exactly two parents, preserving order. - parse_
observed_ merges - Parses observation-ledger lines into the set of merged-revision oids.
- path_
is_ inert - Whether a path cannot change what a build-and-test command observes.
- pr_
report - Reads one change’s outcome as the status its pull request gets.
- record_
population_ restrictions - Records, beside the ledger, every way a harvest narrowed the population it walked: the merges excluded as inert, and the consecutive-inconclusive run that stopped the walk early.
- revert_
train - Reverts a landed train (D23 auto-revert arm): reverts each of the
train’s merge commits (
base..tip, first-parent, newest first) on top oftip, then pushes the result tobranchWITHOUT force — if the branch moved pasttipsince landing, the push is rejected and a human decides. Returns the new branch tip. The reverted tree is byte-identical tobase’s tree; history keeps the full record. - run_
differential - Builds isolated worktrees for a speculative merge’s two parents and the
merge itself, then invokes the explicit
choir-differentialrunner. - run_
differential_ in - Runs one observation in an already-open session’s three worktrees.
- run_
queue - Runs one speculative round through the D5 merge queue.
- run_
train_ ci - Checks one train commit with a
CiExecutorinstead of asking the host forge (D18). - run_
train_ differentials - Runs the advisory detector for every merge commit in a train, preserving train order and returning operational errors per entry instead of turning them into a landing decision.
- train_
report - Reads a train’s verdict as the report its PRs get (D18, D49).
- train_
unavailable - The report for a train we could not get a verdict on at all.
- write_
specimen - Packages a flagged merge and its reproduction runs as a corpus
specimen under
state_dir/specimens/<merge>.json(D27).