Skip to content

ship-queue ready --fixes-base-red can't name a test case that contains a comma or >, so the fixer's train reads as red on main #4233

Closed as not planned

Description

@groomclub

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 &gt;. So nearly every nested Vitest test is stored with &gt; in its id.

Seen on gstack 1.98.0.0. The four files below are the same on main at e9de3a9.

What happens

  1. The flag value is split on every comma. crew/lib/ship-queue-train-cli.ts:186 runs fixes?.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 named totals > rounds 1,5 up to 2 becomes two entries: totals > rounds 1 and 5 up to 2.
  2. JUnit attribute values aren't decoded. parseTestRecord (crew/lib/ship-queue-train-gate.ts:149) reads classname and name with a regex and joins them with .. It never decodes XML entities. A testcase name="totals &gt; sums line items" is stored as cart.test.ts.totals &gt; sums line items. Any name holding <, >, &, " or ' is stored in its escaped form. JSON records aren't affected by this part.
  3. The comparison is an exact set. classifyPrefixes (line 114) returns red-on-main unless slot 1's fixes_base_red equals T0's red list exactly (sameSet, line 100). A split entry or an unescaped > never matches.
  4. The output hides the split. The READY line prints the list joined with ", " (crew/lib/ship-queue-train-ready.ts:300). The train's SLOT: line joins it with "," (crew/lib/ship-queue-train.ts:473). Both read back like the string that was typed, so a --dry-run looks 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 &gt; rounds 1,5 up to 2"><failure message="expected 1 to be 2"/></testcase>
<testcase classname="cart.test.ts" name="totals &gt; sums line items"><failure message="expected 3 to be 4"/></testcase>
<testcase classname="cart.test.ts" name="totals &gt; 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 &gt; rounds 1,5 up to 2,cart.test.ts.totals &gt; sums line items';
console.log('B typed with &gt; ->', JSON.stringify(cli(b)), '->', verdict(cli(b)));
console.log('C the stored list itself ->', verdict(rec.failed));

const one = ['cart.test.ts.totals &gt; 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 &gt; ->', verdict(cli('cart.test.ts.totals &gt; sums line items'), one));
console.log('display:', cli(a).join(', '));

Output on 1.98.0.0:

T0 red cases: ["cart.test.ts.totals &gt; rounds 1,5 up to 2","cart.test.ts.totals &gt; 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 &gt; -> ["cart.test.ts.totals &gt; rounds 1","5 up to 2","cart.test.ts.totals &gt; 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 &gt; -> 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

  1. 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.
  2. Decode XML entities in parseTestRecord. Decode &lt; &gt; &amp; &quot; &apos; and numeric references (&#NN;, &#xNN;) in classname and name before building the id. Records written by older versions still hold escaped ids, so sameSet could compare decoded forms on both sides.
  3. 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.
  4. Tests. Add case names with a comma, with > and with &, for both the CLI parse and parseTestRecord.

Workaround today

For a name with no comma, type it XML-escaped (&gt; 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

  1. capy-ai commented on Nov 10, 2026

    @capy-ai
    Contributor

    Thanks for the detailed report and the reproduction. gstack's own repo has moved off merge trains to direct merges, so --fixes-base-red on 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.

  2. added
    bug
    S3
    wontfix
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    S3bugwontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions