Skip to content

CI: the frontend ls guard covers one of the three node --test inputs #3440

Done

Description

@Birfy

What happens

The frontend test step in .github/workflows/tests.yml runs three node --test inputs in one
invocation, but its ls guard covers only one of them:

# .github/workflows/tests.yml:30  (main ee8ae6df, tree dffcaed5)
- run: ls .github/scripts/*.test.mjs > /dev/null && node --test tests/*.test.mjs .github/scripts/*.test.mjs manager/compose-planner/compose-command-planner.test.js

node --test treats a pattern that matches no file as zero tests and exits 0. The comment two
lines above (tests.yml:27-29) states exactly this, and the ls is there because of it — but only
.github/scripts/*.test.mjs is listed. The other two inputs, tests/*.test.mjs (55 files) and
manager/compose-planner/compose-command-planner.test.js, are unguarded.

So if tests/ is renamed or moved, or the compose planner file is renamed, the step still runs,
finds fewer (or no) tests, and goes green.

Measured on this host, node v22.23.5, in a scratch directory:

$ node --test 'nothing/*.test.mjs'
# tests 0
# pass 0
# fail 0
$ echo $?
0

The workflow comment records the same behaviour for Node 24.22, so this is not version-specific.

Why the existing test does not catch it

tests/ci_test_list.test.mjs matches the whole step line as one literal regex:

assert.match(
  workflow,
  /^ {6}- run: ls \.github\/scripts\/\*\.test\.mjs > \/dev\/null && node --test tests\/\*\.test\.mjs .../m,
);

That pins the current string, but it cannot express the invariant that matters: every argument of
the node --test line is listed by the ls guard above it. A rename of tests/ does not touch the
workflow text at all, so no text assertion can catch that case — only the guard can. And an edit
that appends a fourth input to the run line is caught only by accident (the literal no longer
matches), not because the guard was checked.

Proposed change (one slice)

  1. Turn the step into a block scalar and list all three inputs before running:
- run: |
    ls tests/*.test.mjs .github/scripts/*.test.mjs manager/compose-planner/compose-command-planner.test.js > /dev/null
    node --test tests/*.test.mjs .github/scripts/*.test.mjs manager/compose-planner/compose-command-planner.test.js
  1. Replace the literal-line assertion in tests/ci_test_list.test.mjs with a structural one: the
    block must hold an ls line and a node --test line, the ls must come first, and the set of
    arguments on the two lines must be exactly equal (sorted deepEqual, so listing order is
    free but membership is not). Failure output names the missing or extra input.

    Equality in both directions matters: a one-way runArgs ⊆ guardArgs check still passes when an
    input is deleted from the run line, which is the silent-coverage-loss case this issue is about.

Acceptance check

  • With tests/ renamed away, the step must fail (measured: ls: cannot access 'tests/*.test.mjs': No such file or directory, step exit 2, node --test never starts).

  • Each of these four edits of the workflow must turn tests/ci_test_list.test.mjs red, with a
    distinct message:

    mutation expected message
    move node --test above the ls the ls guard must come before node --test
    append an unlisted input to the run line the ls guard must list exactly the inputs on the node --test line (+ visible diff)
    delete the ls line the block must hold an ls guard and a node --test line
    delete one input from the run line only the ls guard must list exactly the inputs on the node --test line (+ visible diff)
  • With the guard restored, the step body itself must still pass all tests it runs (1117 on one
    host at the time of writing; see the PR for the exact reading and its caveats).

Scope

Workflow guard and one test file. No product code, no test-suite contents changed, no new CI job.

Activity

  1. added
    agent-ready
    agent-working
    on Nov 29, 2026
  2. Birfy commented on Nov 29, 2026

    @Birfy
    CollaboratorAuthor

    Branch dev/3440-ci-ls-guard-all-inputs, base main 3f9b8ab06cb6d5f14e458ed411cf24e1281b4f78, head b78bf7d8d424bd4c3676f03aca654b1092d046b4 (tree f3b247f7b4d0bbdd07763ee45f8d9605f2354cc4), 2 files +27/-7. PR: #3441.

    Local, not CI: the patched step body runs and exits 0; tests/ci_test_list.test.mjs is 2/2 there, and turns red on each of four workflow edits (guard after the run line, unlisted input added to the run line, guard line deleted, one input deleted from the run line).

    Related #3441. Refs #3440.

  3. Birfy commented on Nov 29, 2026

    @Birfy
    CollaboratorAuthor

    Landed as a squash merge — 192e72fcd1b630e563306a3abcac38b4e123a01d, single parent 3f9b8ab06cb6d5f14e458ed411cf24e1281b4f78.

    Content check after the merge (read from the commit, not from the PR):

    • tree f3b247f7b4d0bbdd07763ee45f8d9605f2354cc4 — the same tree that was reviewed at head b78bf7d8d424bd4c3676f03aca654b1092d046b4, so what landed is what was reviewed.
    • 2 files, +27/−7: .github/workflows/tests.yml blob ccf1d5e52862, tests/ci_test_list.test.mjs blob c8a0a614aac1.
    • Merge commit message is the PR title plus the PR body, 108 lines, no closing trailer; this issue stays open on purpose.
    • Branch dev/3440-ci-ls-guard-all-inputs is gone (ref 404).

    What is now true on main: the frontend step lists its three inputs before running them, and tests/ci_test_list.test.mjs asserts the guard and the node --test line carry the same inputs in both directions. A dropped input, an added one, a reordering, or a rename of tests/ now fails the step instead of running a smaller suite and exiting 0.

    Evidence state at the reviewed head, kept separate: CI on b78bf7d8 was total_count 18 == returned 18, all completed + success, every head_sha on that commit. The local readings (clean 2/2, mutations A–D red, renamed tests/ → exit 2 with no node --test invocation) are this machine and QA's, both stated as local. Neither is an acceptance sign-off.

    One note for the record: the risk workflow labelled this PR risk:T3 on its own. Risk tiers are not a merge gate here — the decision was mine, on the diff above, with the head and the CI reading named.

    Still not covered by this slice: the same zero-match pattern can exist in other workflows' node --test lines. This issue is about the one step that had it.

    Related #3440.

  4. removed
    agent-working
    on Nov 29, 2026
  5. Birfy commented on Nov 29, 2026

    @Birfy
    CollaboratorAuthor

    Closing: the work this issue describes is on main.

    PR #3441 merged as squash 192e72fcd1b630e563306a3abcac38b4e123a01d, tree f3b247f7b4d0bbdd07763ee45f8d9605f2354cc4 — the tree the review was bound to — 2 files +15/−7. Review record on the PR: comment 7254485316. CI on the pre-merge head b78bf7d8: 18 of 18 checks completed + success.

    What that changed: the ls guard in .github/workflows/tests.yml now lists every input of the node --test line, and tests/ci_test_list.test.mjs asserts the two lists are equal item by item, so dropping an input from either side fails the guard instead of silently shrinking the run. The silent shrink we measured before the fix — 150 cases instead of 1118, exit 0 — is what the assertion is aimed at.

    Everything this issue asked for is in. Any further work on that guard (triggering it from more workflows, for instance) belongs in a new issue, not here.

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

    agent-ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions