Files
dotfiles/scripts
GandClaude Opus 5 cee72319ac ci: narrow the no-test-files rule — its first live finding was a false positive (#26)
* ci: raise the bar from "the gate runs" to "the gate can go red"

The floor asks whether a gate RUNS. That question stopped discriminating once
22 of 25 repos passed it, and it was never the interesting one: a single day of
remediation turned up FIVE ways a gate can run, report success, and defend
nothing.

  result discarded  evig            continue-on-error on the unit-test job:
                                    7,769 tests ran every PR, answer thrown away
  never executed    sbb-lost-found  `next lint` hit an interactive wizard; the
                                    four services had no eslint config at all
  scope collapsed   sbb-lost-found  `eslint src/**/*.ts` through sh, where ** is
                                    just * — every index.ts went unlinted
  nothing to run    sbb-lost-found  `test: jest` in four packages, ZERO test
                                    files in the whole repo
  wrong rung        datacat         `test` is playwright: needs a browser and a
                                    server, so it is an upgrade, not the floor

Every one of them passes "does the repo have a `test` script?".

WHAT THIS COMMIT ENFORCES

The fourth shape was the one still un-automated. I flagged it when I fixed
sbb-lost-found by hand and said so rather than pretending otherwise; the
never-twice rule forbids a third manual pass, so it is a check now: a `test`
script with no test files on the branch is reported as test(no-test-files),
alongside the existing test(e2e-only).

It is deliberately hard to accuse someone falsely with it. The path pattern is
generous (__tests__, test/, tests/, spec/, e2e/, cypress/, *.test.*, *.spec.*,
*_test.*), and a truncated git tree is reported as UNKNOWN rather than zero —
because "I could not enumerate it" is not "there is nothing there", which is the
exact bug the previous commit removed from this script.

Calibrated against repos whose answer I already knew, in both directions:

  evig 582 · datacat 7 · threadkit 5 · sbb-lost-found 2 · design-tokens 2
  prime-tower 0

It finds no NEW violations today, because sbb-lost-found — the case it was built
from — is already fixed. That is the point: it is a ratchet against the shape
coming back, not a fresh accusation.

WHAT THIS COMMIT ASKS OF PEOPLE

Rung 4 in templates/ci/README.md: for each gate, you must be able to NAME the
change that makes it fail. If you cannot, it is decoration, and decoration is
worse than nothing because it produces a check mark.

The demonstration is mutation, not argument — break it on purpose, confirm red,
restore. The worked example is the tenant SSOT in sbb-lost-found, which decides
whose trademark renders: three invariants, three deliberate breaks, three reds.
"We have 45 tests" is not evidence; that is.

The same rule binds any rule you write: a check proven only on the case that
should fire says nothing about what it lets through. The discarded-gate check
was verified against evig's ci.yml (must fire), orangecat's cd.yml (must stay
silent — legitimate best-effort fallback), and the repaired evig file.

AND WHERE THE BAR GOES NEXT, ON EVIDENCE

Named explicitly rather than left as "be more careful". The floor has never
caught the failures that actually cost something here, all of which shipped past
a green suite: `json(user)` returning passwordHash and a PIN hash — twice, the
second time one nesting level deeper, which is why a grep cannot close it and an
exhaustive allow-list can; identity read from the request body instead of the
session, letting one member vote as another; a query missing its tenant filter,
correct at one org and wrong at two, in a production that had exactly one.

One shape: the gate asserts what the code DOES, never what it must NEVER do.
Rung 5 is gating the closed side.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* ci: narrow the no-test-files rule — its first live finding was a false positive

Shipped a rule saying "a test script with no test files can only ever fail", ran
it against the fleet, and it immediately accused ivy-portal. The accusation was
wrong.

ivy-portal's `test` is `node scripts/smoke.mjs`: a zero-dependency script that
spawns the real server, polls until it serves a 200, SIGKILLs it and exits with
the true code — its author even documented why a deferred timer would let the
process exit 0 and swallow the failure. It has no test FILES because it carries
its own assertions. My premise was true of `jest` pointed at nothing
(sbb-lost-found, four packages, zero files) and false here.

So the rule now fires only when a file-DISCOVERING runner has nothing to
discover — jest, vitest, mocha, ava, playwright, cypress, bun test,
node --test — and is renamed test(runner-no-files) to say what it actually
means. A bespoke script is not the defect shape.

Proven in both directions, including the case that forced the narrowing:

  jest + 0 files                      FIRES     sbb-lost-found's old shape
  vitest + 0 files                    FIRES
  node scripts/smoke.mjs + 0 files    silent    ivy-portal
  node --test + 5 files               silent    threadkit
  jest + 582 files                    silent    evig
  playwright + 7 files                silent    datacat
  npm run smoke + 0 files             silent
  node build/latest.mjs + 0 files     silent    'latest' must not read as --test

The README now carries the lesson rather than just the rule: a new rule's first
finding deserves MORE suspicion than its hundredth, because it is the one you
have no calibration for.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 15:53:12 +00:00
..