What is broken
dispatch-gates.mjs's self-test carries this control (line numbers as of a23603ea9):
const changedCommandsRun = runCli(['--changed', '--commands']);
t(
'CONTROL: --changed --commands is legal and answers, so the moved usage line describes a real combination',
changedCommandsRun.status === 0 && (changedCommandsRun.stdout ?? '').length > 0,
);
--changed derives its change set from git. On a branch whose tip equals its merge base
with origin/main, that derivation refuses by design and exits 2:
dispatch-gates: this branch changes nothing against 'origin/main' (merge base …) — nothing to derive.
So status === 0 is false and the control fails — not because the combination is illegal,
which is what the case is about, but because this particular tree has no diff.
Measured
On a worktree cut from origin/main at a23603ea9 with zero edits:
✗ CONTROL: --changed --commands is legal and answers, so the moved usage line describes a real combination
✗ dispatch-gates self-test: 1 of 1353 case(s) failed.
The same tree, after one unrelated commit, runs 1363 cases pass with exit 0. Nothing but
the presence of a commit moved it.
Why it is worth fixing
CI never sees this: a PR branch always has a diff, so the case is green there. What it hits
is the first thing a developer does in a fresh worktree — run the gate to get a baseline
before editing. The self-test then reports a red that is about the worktree, and a reader
has no way to tell it from a real one. It cost one round of investigation on the card this
was found under before it was traced.
It is the same class as the .changeset/*.md population control (a self-test case whose
verdict is a property of the tree rather than of the tool), but a different trigger, and the
right shape is a judgment call rather than a mechanical edit — which is why it was recorded
here instead of being carried in that card's PR.
Shape of the fix (not a ruling)
The control wants to show that --changed combines with --commands. That claim can be
made without depending on the caller's tree: exit 2 with the "changes nothing" refusal
is itself proof the combination parsed and reached the derivation — an illegal combination
would be rejected by argv parsing, with a different code and message. Alternatively, report
NOT MEASURED when the branch has no diff, naming that as the reason.
Found while working #15255 (the .changeset/*.md population control), 2026-09-04.
Generated by Claude Code
What is broken
dispatch-gates.mjs's self-test carries this control (line numbers as ofa23603ea9):--changedderives its change set from git. On a branch whose tip equals its merge basewith
origin/main, that derivation refuses by design and exits 2:So
status === 0is false and the control fails — not because the combination is illegal,which is what the case is about, but because this particular tree has no diff.
Measured
On a worktree cut from
origin/mainata23603ea9with zero edits:The same tree, after one unrelated commit, runs
1363 cases passwith exit 0. Nothing butthe presence of a commit moved it.
Why it is worth fixing
CI never sees this: a PR branch always has a diff, so the case is green there. What it hits
is the first thing a developer does in a fresh worktree — run the gate to get a baseline
before editing. The self-test then reports a red that is about the worktree, and a reader
has no way to tell it from a real one. It cost one round of investigation on the card this
was found under before it was traced.
It is the same class as the
.changeset/*.mdpopulation control (a self-test case whoseverdict is a property of the tree rather than of the tool), but a different trigger, and the
right shape is a judgment call rather than a mechanical edit — which is why it was recorded
here instead of being carried in that card's PR.
Shape of the fix (not a ruling)
The control wants to show that
--changedcombines with--commands. That claim can bemade without depending on the caller's tree: exit 2 with the "changes nothing" refusal
is itself proof the combination parsed and reached the derivation — an illegal combination
would be rejected by argv parsing, with a different code and message. Alternatively, report
NOT MEASURED when the branch has no diff, naming that as the reason.
Found while working #15255 (the
.changeset/*.mdpopulation control), 2026-09-04.Generated by Claude Code