Skip to content

testlist run exits 0 (green CI) on an empty list — every other zero-dispatch path exits 5 #458

Done

Description

@OkeyAmy

Problem

testsprite testlist run <list-id> exits 0 when the list holds zero test cases. With --wait it prints "Test-list run complete: 0/0 passed" and still exits 0. The response even says why (reason: "empty_list"), and the client treats it as success anyway.

Every other zero-dispatch path in the CLI is deliberately red:

  • test run --all when the resolved test set is empty (empty project, or a --filter that matched nothing): exit 5 — the refusal names the doctrine: "A CI gate that passes on zero tests is unsafe; pass --allow-empty to exit 0 intentionally."
  • test rerun --all: same --allow-empty gate.
  • testlist run --case <id> where none of the ids belong to the list: exit 4 (refused).

The documented CI recipe points people at a list exactly when they want a mixed FE/BE gate (DOCUMENTATION.md, "Full frontend coverage: use a test list"):

testsprite testlist run tl_xxxxxxxx --wait \
  --report junit --report-file testsprite-junit.xml

If that list is empty — cases removed, scope migrated, an upstream seed step failed — the gate goes green after running zero tests. That is the false-green the exit-code table warns about: "exit 5 … This is deliberate — a gate that greens on zero tests is worse than no gate."

Reproduction

Empty list (0 cases):

$ testsprite testlist run 984010c8-8d3a-4865-bdb8-fea141005e62 --output json
{"accepted":[],"conflicts":[],"deferred":[],"reason":"empty_list"}
$ echo $?
0

$ testsprite testlist run 984010c8-8d3a-4865-bdb8-fea141005e62 --wait --output json
Test-list run complete: 0/0 passed, 0 failed/blocked, 0 timed out
{"accepted":[],"conflicts":[],"deferred":[],"reason":"empty_list","summary":{"passed":0,"failed":0,"timedOut":0,"deferred":0,"conflicts":0,"total":0}}
$ echo $?
0

Contrast, same CLI, same account, same minute:

$ testsprite test run --all --project 1c57516c-b884-46a5-a957-8c35e9b96f60 --filter zzz-no-match-xyz
--filter: skipped 1 test whose name does not contain "zzz-no-match-xyz".
No tests found in project 1c57516c-… matching --filter "zzz-no-match-xyz" — nothing to run.
$ echo $?
5

$ testsprite testlist run 984010c8-… --case 00000000-0000-0000-0000-000000000000
Error: None of the requested case ids belong to this test list: 00000000-….
$ echo $?
4

Where it comes from

runTestlistRun keeps the zero-work path flowing into the report tail by design (src/commands/testlist.ts, around line 648):

An empty/no-match run (zero accepted, zero conflicts) is NOT short-circuited: it flows through the fan-out (a no-op) and the report tail so an explicitly-requested --report junit still emits an empty-suite report rather than nothing.

The wire type splits the two shapes — reason?: 'no_matching_cases' | 'empty_list' (src/lib/testlist.types.ts:77) — and testlist run has no --allow-empty flag.

Suggested fix

Mirror the batch doctrine:

  • When the server reports reason: 'empty_list' (the list itself has nothing), emit the CI artifacts the same way finishZeroDispatchBatch does (summary, annotations, JUnit), then exit 5 with a message pointing at the opt-in.
  • Add --allow-empty to testlist run for callers who deliberately gate on a list that is temporarily empty.
  • Stop the --wait path from ending on a cheerful "0/0 passed".

no_matching_cases can keep its current behavior or share the flag; the empty-list case is the one that can turn a CI job green with nothing executed.

Discord: okey_amy

Activity

  1. OkeyAmy commented on Oct 16, 2026

    @OkeyAmy
    ContributorAuthor

    /assign

  2. testsprite-hob commented on Oct 16, 2026

    @testsprite-hob

    Thanks for the interest, @OkeyAmy! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it accepted once it is). Feel free to check back, or ping us on Discord if it's been quiet.

  3. zeshi-du commented on Oct 20, 2026

    @zeshi-du
    Contributor

    Thanks @OkeyAmy, you're right that testlist run exits 0 on an empty list while the other zero-dispatch paths exit 5. That exit 0 is documented and existing tests rely on it, so changing it in a 0.x release would silently break CI scripts.

    In 1.0, an empty test list will exit 5, with --allow-empty for the current behaviour. The same release will make a partly refused --wait batch fail the gate, as discussed in #380.

    Tracked internally as DEV-2180. This stays open to track the change, but it isn't open for a community PR since it lands with the other 1.0 exit-code changes.

  4. zeshi-du commented on Nov 24, 2026

    @zeshi-du
    Contributor

    We're fixing this internally: an empty saved list will exit 5 on run --testlist, with --allow-empty for the cases where an empty run is expected. It will ship in an upcoming release, so I'm closing this issue. Thanks @OkeyAmy for the report.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions