Skip to content

bug(process): tests that assert source TEXT instead of executing the path — three green-CI ejections in one train, third run running #2829

Closed

Description

@vybe

The shape

Across the 2026-09-15 merge train, 3 of 5 ejections were the same defect class, and every one had fully green CI: a test that proves the code was written rather than that it runs. This is the third consecutive train where this shape dominated the ejections, so it is one upstream habit, not a run of unrelated bugs.

Three spellings, all of which pass identically when the code above throws the result away:

  1. Source-text regex — readFileSync + toContain, inspect.getsource, a slice anchored on a comment string.
  2. A tautology — a bound check whose parameters make the two candidate bounds numerically equal.
  3. An unverified rationale — a claim about what CI would do, asserted in a docstring and a learnings.md entry, never negative-controlled.

The three from this train

#2811 — main.js's request/response interceptors, the storage listener, and handlePlatformUnauthorized are asserted by readFileSync + stripComments + toContain. vitest.config.js pins environment: 'node'; nothing mounts, no spec imports main.js, and no spec reads App.vue at all. Mutation, on the PR head, baseline 2937 green:

Mutation Result
restore authStore.logout(); router.push('/login') on the stale branch — literally the bug the PR reports 2937 passed, 0 red
invert the storage listener so a sibling login ends this tab's session 2937 passed, 0 red
delete the stale arm from the pure verdict function 2 red ✅

The pure-function half is genuinely tested. The wiring half — which is where all three acceptance criteria live — is not executed anywhere.

#2817 — test_portal_attempt_ceiling_still_covers_one_worst_attempt, a deliberate, well-named bound check, asserts svc.portal_attempt_ceiling_seconds(t) >= t + 10 + 300, which reduces to t+310 >= t+310. It cannot fail for any value of the bug, and the real defect (a 6610s wall-clock on a 3600s turn, invalidating the slot lease and the watchdog) sat behind it. The PR's own learnings.md entry in the same diff says "a bound-check test must be parameterised away from the coincidence."

#2805 — the PR body, a docstring, and a new learnings.md entry all assert that omitting a SQLite migration "turns that guard red forever." One negative control (remove the registration, run test_schema_parity) → 4 passed. The guard is structurally blind to that column, so a DROP TABLE + rename-swap of a live production table was running at boot on every SQLite install for a CI benefit that does not exist — and the false claim was about to land in a file /autoplan reads as fact.

Why it keeps landing

Every one of these passes review and CI by construction. The tests are present, well-named, numerous, and green; nothing in the pipeline distinguishes "asserts the behaviour" from "asserts the source". The reviewer sees coverage.

Note the near-miss in the same train: #2819 is 6/10 source-text substring matches and was kept — because its live consumer is GitHub Actions itself, and a real run on the PR proved the workflow registered. Same test shape, opposite verdict. The discriminator is not the assertion style, it's whether a live consumer executes the value.

Suggested direction

Make the question mechanical rather than a reviewer's instinct. Two greps settle nearly every case, and the second is the one that decides:

# a) are the assertions source-text?
grep -nE 'readFileSync|inspect\.getsource|indexOf\(|toContain\(' <test file>

# b) does the changed value have a live consumer? definition + test only IS the finding
grep -rn '<changed symbol>' src/

Concretely:

  1. Add the coverage question to /validate-pr and /review as an explicit, answered-first step — does any test execute the changed path, and what is the live consumer of every value this PR changes? It is already in /merge-train Phase 2 and is what caught all three.
  2. Prefer mutation as the evidence standard for a bug fix: revert the fix, show the new test goes red. fix(ci): guard workflow triggers that are inert on dev until they reach main (#2814) #2816 did this (three mutations, including a novel case) and was the strongest member of the train by a distance.
  3. Treat a frontend ref that is declared, bound to a child, and never assigned as conclusive on its own — grep -n '<theRef>' returning only the declaration and the binding is enough.
  4. Where a test's whole purpose is a bound, require it to be parameterised away from the coincidence — assert the relationship, not a literal, at a point where the two candidate bounds differ.

Cross-ref #2828 (the CI-gap sibling from the same run). Prior occurrences of this shape: the 2026-09-13 and 2026-09-14 trains (#2648 discarded a correct SQL count one layer up; #2645 assigned error_code only for 503 while the failure arrives as 429; #2619 declared canvasLimit, bound it, never assigned it).

Found by /merge-train, 2026-09-15.

🤖 Generated with Claude Code

Activity

  1. added
    priority-p1
    type-bug
    theme-reliability
    on Sep 15, 2026
  2. dolho commented on Sep 16, 2026

    @dolho
    Contributor

    /claim

  3. added
    status-in-progress
    on Sep 16, 2026
  4. github-actions commented on Sep 16, 2026

    @github-actions

    Claimed by @dolho. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/2829-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #2829
  5. added
    status-in-dev
    and removed
    status-in-progress
    on Sep 16, 2026
  6. removed
    status-in-dev
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p1theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions