Repository navigation
Description
Summary
gstack-ship-queue ready --fixes-base-red <cases> can't declare a failing case whose name contains a comma. It can declare a case whose name contains >, <, & or a quote only if you type the name XML-escaped. The train compares the declared list with T0's red cases as an exact set. So in both situations T0 reads as red on main (QUEUE_TRAIN_RED_ON_MAIN), and the fix-forward path that base-red trains exist for is closed.
The > case covers most Vitest suites. Vitest's JUnit reporter names a test inside a describe block suite > test and writes > as >. So nearly every nested Vitest test is stored with > in its id.
Seen on gstack 1.98.0.0. The four files below are the same on main at e9de3a9.
What happens
- The flag value is split on every comma.
crew/lib/ship-queue-train-cli.ts:186runsfixes?.split(',').map(s => s.trim()).filter(Boolean).flag()(line 74) returns only the first occurrence, so you can't repeat the flag. There is no file form and no escape. A case namedtotals > rounds 1,5 up to 2becomes two entries:totals > rounds 1and5 up to 2. - JUnit attribute values aren't decoded.
parseTestRecord(crew/lib/ship-queue-train-gate.ts:149) readsclassnameandnamewith a regex and joins them with.. It never decodes XML entities. A testcasename="totals > sums line items"is stored ascart.test.ts.totals > sums line items. Any name holding<,>,&,"or'is stored in its escaped form. JSON records aren't affected by this part. - The comparison is an exact set.
classifyPrefixes(line 114) returnsred-on-mainunless slot 1'sfixes_base_redequals T0's red list exactly (sameSet, line 100). A split entry or an unescaped>never matches. - The output hides the split. The READY line prints the list joined with
", "(crew/lib/ship-queue-train-ready.ts:300). The train'sSLOT:line joins it with","(crew/lib/ship-queue-train.ts:473). Both read back like the string that was typed, so a--dry-runlooks right even when the list is wrong.
Reproduction
This uses made-up test names and calls the two library functions the train uses. The CLI split is copied from ship-queue-train-cli.ts:186.
// repro.ts: bun run repro.ts
import { parseTestRecord, classifyPrefixes } from '<gstack checkout>/crew/lib/ship-queue-train-gate.ts';
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<testsuites><testsuite name="cart.test.ts" tests="3" failures="2">
<testcase classname="cart.test.ts" name="totals > rounds 1,5 up to 2"><failure message="expected 1 to be 2"/></testcase>
<testcase classname="cart.test.ts" name="totals > sums line items"><failure message="expected 3 to be 4"/></testcase>
<testcase classname="cart.test.ts" name="totals > empty cart is zero"/>
</testsuite></testsuites>`;
const rec = parseTestRecord([{ name: 'unit.xml', text: xml }])!;
console.log('T0 red cases:', JSON.stringify(rec.failed));
const cli = (v: string) => v.split(',').map(s => s.trim()).filter(Boolean); // ship-queue-train-cli.ts:186
const verdict = (fixes: string[], red = rec.failed) =>
classifyPrefixes([{ outcome: 'RED', red }, { outcome: 'GREEN', red: [] }], [{ pr: '12', fixes_base_red: fixes }]).kind;
const a = 'cart.test.ts.totals > rounds 1,5 up to 2,cart.test.ts.totals > sums line items';
console.log('A typed as the runner shows it ->', JSON.stringify(cli(a)), '->', verdict(cli(a)));
const b = 'cart.test.ts.totals > rounds 1,5 up to 2,cart.test.ts.totals > sums line items';
console.log('B typed with > ->', JSON.stringify(cli(b)), '->', verdict(cli(b)));
console.log('C the stored list itself ->', verdict(rec.failed));
const one = ['cart.test.ts.totals > sums line items'];
console.log('D one case, no comma, typed with > ->', verdict(cli('cart.test.ts.totals > sums line items'), one));
console.log('E one case, no comma, typed with > ->', verdict(cli('cart.test.ts.totals > sums line items'), one));
console.log('display:', cli(a).join(', '));Output on 1.98.0.0:
T0 red cases: ["cart.test.ts.totals > rounds 1,5 up to 2","cart.test.ts.totals > sums line items"]
A typed as the runner shows it -> ["cart.test.ts.totals > rounds 1","5 up to 2","cart.test.ts.totals > sums line items"] -> red-on-main
B typed with > -> ["cart.test.ts.totals > rounds 1","5 up to 2","cart.test.ts.totals > sums line items"] -> red-on-main
C the stored list itself -> green
D one case, no comma, typed with > -> red-on-main
E one case, no comma, typed with > -> green
display: cart.test.ts.totals > rounds 1, 5 up to 2, cart.test.ts.totals > sums line items
The CLI behaves the same way. gstack-ship-queue ready --pr <n> --no-screen --fixes-base-red '<case A>,<case B>' --dry-run exits 0 and prints a FIXES_BASE_RED: line that looks whole, and the train then reads T0 as red on main.
Expected
A fixer can declare exactly the cases T0 is red on, under the names the test runner prints, whatever characters they contain. If a declared case can't match, ready says so before the train runs.
Proposed fix
- Take the list without splitting on commas. Make
--fixes-base-red <case>repeatable and collect every occurrence. Add--fixes-base-red-file <path>with one case per line, or a JSON array. Keep the comma form for compatibility if needed, and document that it can't carry a comma. - Decode XML entities in
parseTestRecord. Decode< > & " 'and numeric references (&#NN;,&#xNN;) inclassnameandnamebefore building the id. Records written by older versions still hold escaped ids, sosameSetcould compare decoded forms on both sides. - Check the list at READY time. When the base's latest test record is readable, refuse a declared case that isn't in its red set, and name the closest stored ids. Print the cases one per line, quoted, with a count (
FIXES_BASE_RED: 2 cases), so a split shows up in the dry run. - Tests. Add case names with a comma, with
>and with&, for both the CLI parse andparseTestRecord.
Workaround today
For a name with no comma, type it XML-escaped (> for >), as in E above. A name that contains a comma has no workaround: in our case the fixer had to land outside the train.
Activity
capy-ai commentedon Nov 10, 2026
Thanks for the detailed report and the reproduction. gstack's own repo has moved off merge trains to direct merges, so
--fixes-base-redon a train is no longer on the path we maintain closely, and a base-red train with a comma or>in a case name is rare. I'm closing this as won't-fix for now. If it blocks you on a train you depend on, please reopen with the command and output and we'll reconsider.