Skip to content

fold coverage gate passes a corpus entry that never folds, by construction #2225

Closed

Description

@lex00

Left open by #2189, which fixed the second known instance of this.

The problem

EXPECTED_FOLD (examples/fold-differential.test.ts:244-337) is the name-by-name
ratchet: every corpus entry known to fold today. The regression gate at :444-448
computes regressed = EXPECTED_FOLD.filter(name => byName.get(name)?.mode !== "fold")
and asserts it is empty. It only walks names already in the list, so an entry not
in EXPECTED_FOLD can never appear in regressed, whether it folds or not. A new
corpus entry that never folds passes this test by construction.
The published-coverage test at :461-470 (test.each([...FOLD_COVERAGE_DOCS]))
does react once: it renders the live fold/total count and asserts it equals what
is committed in the docs (.toBe(expected)), so a corpus that grows without its
fold count growing fails here. But the only fix its message names is npm run generate:fold-coverage, which writes down the live numbers, lower ratio included,
as the new baseline. Nothing distinguishes "the corpus grew and the addition
folds" from "the corpus grew and it does not"; both regenerate clean. Once
regenerated, the entry is still absent from EXPECTED_FOLD, so :444-448 never
mentions it again.

Two cases it swallowed

lexicons/forgejo/examples/ci-workflow joined the corpus in #1119 (issue #1072,
2026-07-27), after the fold-differential suite already existed (#1034, 2026-07-25).
It stayed run-fallback, one of seven "unrelated additions" the suite's own doc
comment at :113-115 says grew the corpus from 101 to 108 without moving the fold
count, until #1965 (issue #1174, 2026-08-26) gave it a blocker-clearing fix a
month later.
examples/fountain-steward joined in #2129 (2026-09-06). Its *.op.ts files all
default-exported their Op, the one export shape the fold path refuses, so all
four files fell back. The published count moved from 96 of 110 to 96 of 111,
denominator only. It sat that way until #2189 (issue #2171) widened Op discovery
and folded it, landing at 95 of 108.

Two options

(a) A new EXPECTED_RUN_FALLBACK list, one entry per corpus entry currently
classified run-fallback, each with a one-line reason, mirroring KNOWN_FAILURES
in scripts/check-lexicons.ts:63 ("a failure NOT listed here is a regression and
fails the gate"). The ratchet then covers the whole corpus: every entry must be
in EXPECTED_FOLD or EXPECTED_RUN_FALLBACK, and one in neither fails
immediately, by name, with a required reason attached at review time.

(b) Change :461-470 to refuse when the live fold count is lower than the
published one, rather than merely different. (b) alone would not have caught
either case above: neither dropped the numerator, they left it flat while the
denominator grew, so a "live fold count fell" check never trips. (a) catches
exactly this, the same way EXPECTED_FOLD's own doc comment already argues
name-by-name over a bare count ("a count alone can't tell 'A regressed, B
started folding' apart from 'nothing changed'").
Recommendation: (a). It is the repo's own precedent for named, reasoned, gated
lists, and the only option that catches a same-numerator, larger-denominator
addition.

Acceptance

  • EXPECTED_RUN_FALLBACK (or equivalent) lists every corpus entry currently
    classified run-fallback, each with a one-line reason.
  • A corpus entry in neither EXPECTED_FOLD nor EXPECTED_RUN_FALLBACK fails
    the gate, covered by a regression test that fails on main before the fix.
  • No existing EXPECTED_FOLD entry is removed or commented out.
  • just fold-differential and npx tsc --noEmit stay clean.

Activity

  1. added
    enhancement
    area:core
    on Sep 7, 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

    area:coreenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions