Repository navigation
test(fold): close the corpus, so an entry in neither list fails (#2225) - #2451
Merged
Merged
Conversation
…2280) Three source files carried literal NUL bytes inside template literals, used as separators in composite keys. The values were right and the code worked. What broke was every tool that reads the files as text: ripgrep classifies a file containing NUL as binary, so it answers "binary file matches" instead of the matching lines, and a repo-wide search omits the file entirely. The issue named one file. The gate added here found three: graph-ir.ts 3 NUL 911 lines audit/core.ts 2 NUL 449 lines graph-layout.ts 1 NUL 185 lines 1545 lines invisible to every grep-driven search of this repository for as long as the bytes were there. That is worse than a silent bug, because it is a silent bug in the tool you would reach for to find bugs: any audit, any "I searched the codebase", any refactor that greps for a symbol defined in one of those files quietly skipped it and reported success. NUL stays the separator — it is the right one, being the character that cannot occur in an identifier or an attribute name. It is now written as an escape: four ASCII characters in the file, the same single code unit at runtime, so the keys are byte-identical. The gate walks every shipped .ts for a NUL byte, since one file was never the interesting number and finding the other two by eye was luck.
`EXPECTED_FOLD` is a ratchet over names known to fold, and the gate only
walks names already in it:
const regressed = EXPECTED_FOLD.filter((n) => byName.get(n)?.mode !== "fold");
So an entry absent from the list could never appear in `regressed`, whether
it folded or not. A new corpus entry that never folds passed by
construction, and twice did: forgejo's ci-workflow joined in #1119 and sat
run-fallback for a month, and fountain-steward joined in #2129 with every
*.op.ts default-exporting its Op, moving the published count's denominator
only. Neither dropped the numerator, so neither tripped anything.
`EXPECTED_RUN_FALLBACK` names all thirteen entries that do not fold today,
each with the reason chant actually gives — read off the fold decisions
rather than guessed. Three gates close the corpus: an entry in neither list
fails by name, no entry is in both, and a listed fallback that starts
folding or leaves the corpus fails so the list can only shrink.
Option (a) from the issue. (b), refusing when the live count drops, would
have caught neither case above: both left the numerator flat while the
denominator grew.
Writing the gate first turned up the same hole in the other direction —
seven entries FOLD and were never ratcheted, so a regression in any of them
would have gone unnoticed:
argo-cd-gke, cc-gcp-canonical, cockroachdb-multi-region-gke,
fan-out-estate, github-pr-preview, testing-harness-aws,
k8s/operator-stack
All seven are added to EXPECTED_FOLD, taking it from 89 to 96, which is the
live fold count. None is removed.
Verified the gate fails as intended by dropping one entry from both lists
and watching it name that entry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2225. Option (a) from the issue, as recommended there.
The hole
EXPECTED_FOLDis a name-by-name ratchet, and the gate only walks names already in it:An entry absent from the list can never appear in
regressed, whether it folds or not. A new corpus entry that never folds passes by construction — and twice did.forgejo/ci-workflowjoined in #1119 and sat run-fallback for a month;fountain-stewardjoined in #2129 with every*.op.tsdefault-exporting its Op and all four files falling back, moving the published count from 96 of 110 to 96 of 111, denominator only. Neither dropped the numerator, so nothing tripped.That is also why option (b) — refusing when the live fold count falls — would not have caught either.
What this adds
EXPECTED_RUN_FALLBACKnames all thirteen entries that do not fold today, each with the reason chant actually gives. I instrumented the report to print the live fold-decision reasons rather than inferring them, so e.g.cpln/secret-accessis "an ambientprocessread, which wants a build-time parameter instead" and not a guess.Three gates close the corpus:
fold-adversarialcarries an explicit note that it is the one entry that should never move: it exists to exercise refusals.Writing the gate first found the same hole in the other direction
Seven entries fold and were never ratcheted, so a regression in any of them would have gone unnoticed:
All seven are added, taking
EXPECTED_FOLDfrom 89 to 96 — which is the live fold count, so the ratchet now covers every folding entry. None is removed. (fan-out-estatelanded today in #2420, and would have been the eighth instance of exactly the bug this issue is about.)Acceptance
EXPECTED_RUN_FALLBACKlists every entry currentlyrun-fallback, each with a one-line reasonEXPECTED_FOLDentry removed or commented outnpx tsc --noEmitclean (repo-wide: 31 known failures, no regressions); eslint clean