Repository navigation
fix(ci): exclude check-test-masking.test.ts fixtures from self-referential tautology gate (#6634) #6884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix(ci): exclude check-test-masking.test.ts fixtures from self-referential tautology gate (#6634) #6884
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4b4173d
fix(ci): exclude check-test-masking.test.ts fixtures from self-refere…
diegosouzapw fe4baba
Merge branch 'release/v3.8.47' into fix/6634-testmasking-selfref
diegosouzapw 24e2a1a
fix(ci): extend test-masking self-fixture exclusion to sibling gate r…
diegosouzapw d791f82
Merge branch 'release/v3.8.47' into fix/6634-testmasking-selfref
diegosouzapw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - fix(ci): exclude check-test-masking.test.ts's own tautology fixtures from the diff-based test-masking gate and recognize `✗` in validate-release-green's failure-line detector (#6634) |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /** | ||
| * Regression test for issue #6634 ("release/v3.8.47 branch not green — nightly | ||
| * release-green found HARD failures"). The nightly's "Test-masking | ||
| * (weakened-assert guard)" HARD failure was a SELF-REFERENTIAL false positive: | ||
| * tests/unit/check-test-masking.test.ts legitimately embeds tautology-pattern | ||
| * string literals (e.g. `expect(true).toBe(true);`, `assert.equal(1, 1);`) as | ||
| * FIXTURES to exercise countBareTautologies()/scanBareTautologies() — the same | ||
| * literal text that the diff-based subcheck (evaluateMasking(), fed by | ||
| * countTautologies()/countExtendedTautologies()) treated as "new tautologies in | ||
| * the file itself" because those counters are dumb regex scans of raw source | ||
| * text, blind to "this is inside a fixture string, not real assertion code". | ||
| * | ||
| * scanBareTautologies() already special-cases this exact file | ||
| * (`if (file.endsWith("check-test-masking.test.ts")) continue;` in | ||
| * scripts/check/check-test-masking.mjs) for precisely this reason — this test | ||
| * asserts evaluateMasking() now applies the same exclusion for its diff-based | ||
| * tautology counters, using the real base(origin/main)/head(HEAD) diff of | ||
| * tests/unit/check-test-masking.test.ts. | ||
| */ | ||
| import test from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
| import { execFileSync } from "node:child_process"; | ||
|
|
||
| import { | ||
| countTautologies, | ||
| countExtendedTautologies, | ||
| evaluateMasking, | ||
| } from "../../scripts/check/check-test-masking.mjs"; | ||
|
|
||
| const FILE = "tests/unit/check-test-masking.test.ts"; | ||
|
|
||
| function git(args: string[]): string { | ||
| return execFileSync("git", args, { encoding: "utf8" }); | ||
| } | ||
|
|
||
| test("#6634: check-test-masking.test.ts's own tautology fixtures must not self-flag as weakening", () => { | ||
| // origin/main predates the #6404 fixtures (countBareTautologies/scanBareTautologies | ||
| // tests) that legitimately embed tautology-pattern literals as string fixtures. | ||
| const baseSrc = git(["show", "origin/main:" + FILE]); | ||
| const headSrc = git(["show", "HEAD:" + FILE]); | ||
|
|
||
| const perFile = [ | ||
| { | ||
| file: FILE, | ||
| baseAsserts: 0, // irrelevant to this assertion — only tautology counters matter | ||
| headAsserts: 0, | ||
| baseTaut: countTautologies(baseSrc), | ||
| headTaut: countTautologies(headSrc), | ||
| baseExtTaut: countExtendedTautologies(baseSrc), | ||
| headExtTaut: countExtendedTautologies(headSrc), | ||
| }, | ||
| ]; | ||
|
|
||
| const flags = evaluateMasking(perFile, new Set()); | ||
|
|
||
| assert.deepEqual( | ||
| flags, | ||
| [], | ||
| "check-test-masking.test.ts's own literal tautology fixtures (added for #6404) must be " + | ||
| "excluded from the diff-based weakening check the same way scanBareTautologies() already " + | ||
| "excludes this file from the absolute-floor scan — otherwise the gate's own regression " + | ||
| "test permanently self-flags as a HARD release-green failure whenever new fixtures are added." | ||
| ); | ||
| }); | ||
|
|
||
| test("#6634: unrelated files still get flagged for genuinely new tautologies (guard is file-scoped, not global)", () => { | ||
| const perFile = [ | ||
| { | ||
| file: "tests/unit/some-other-file.test.ts", | ||
| baseAsserts: 5, | ||
| headAsserts: 5, | ||
| baseTaut: 0, | ||
| headTaut: 1, | ||
| baseExtTaut: 0, | ||
| headExtTaut: 1, | ||
| }, | ||
| ]; | ||
|
|
||
| const flags = evaluateMasking(perFile, new Set()); | ||
|
|
||
| assert.equal(flags.length, 2, "a non-fixture file must still trip both tautology signals"); | ||
| assert.match(flags[0], /nova\(s\) 1 tautologia\(s\) assert\.ok\(true\)/); | ||
| assert.match(flags[1], /nova\(s\) 1 tautologia\(s\) estendida/); | ||
| }); | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The top-level comment block in this new test file contains literal tautology patterns (such as
expect(true).toBe(true);andassert.equal(1, 1);). BecausescanBareTautologiesis a simple regex scan over all tracked test files, it will match these patterns in the comment and cause the absolute floor scan to fail on this file. Please modify the comment to avoid using the exact executable-like syntax of these tautologies (e.g., describe them in plain English or break up the strings).