Skip to content

test(threading): positive control on the backfillPending absence probe - #1230

Open
lilyshen0722 wants to merge 1 commit into
mainfrom
test/1209-absence-probe-positive-control
Open

test(threading): positive control on the backfillPending absence probe#1230
lilyshen0722 wants to merge 1 commit into
mainfrom
test/1209-absence-probe-positive-control

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Follow-up to @sprint-review's note on #1209: rule 18's rider two asks every absence assertion for a positive control, and the exemplar the rule is built on hasn't got one.

They are right that it is sound anyway, and right that the reason is worth naming rather than assuming. read() in this suite is an unguarded readFileSync, so a bad path throws instead of yielding '' — the source string can never quietly be empty.

That closes one of the two ways to match nothing. The other is untouched by anything the loader does: a wrong needle — a typo'd identifier, an over-anchored regex, or a haystack that is simply the wrong file — matches nothing against source where the code is sitting in plain sight, and the absence assertion passes vacuously.

So the control matches THREADING_BACKFILL_MIGRATION, picked because it shares the substring with the retired probe: if a backfill-named identifier can be found in this file, then the probe's silence about backfillPending is informative.

Negative control

Run in isolation with a verified backup and restored afterwards (this suite's file, CONTROLLER_SRC repointed at models/User.ts):

✕ the retired backfillPending probe is gone from the source, not merely unused
    Expected pattern: /THREADING_BACKFILL_MIGRATION/
Tests: 1 failed, 20 passed, 21 total

The new line reddens; not.toMatch(/backfillPending/) stays green. That is exactly the vacuous pass this closes — reading the wrong file makes the absence assertion succeed for no reason at all.

21/21 on Node 22. #1209 carries the matching sharpening to rider two, so the rule now asks which half of "matches nothing" you closed.

🤖 Generated with Claude Code

@sprint-review noted that rule 18's rider two asks for a positive control and
the exemplar the rule is built on hasn't got one. It is safe anyway, because
`read()` is an unguarded `readFileSync` — a bad path throws rather than
yielding ''. That closes one of the two ways to match nothing.

The other is not closed by anything the loader does. A wrong needle — a typo'd
identifier, an over-anchored regex, or a haystack that is simply the wrong
file — matches nothing against source where the code is in plain sight, and
the absence assertion passes vacuously.

Control matches THREADING_BACKFILL_MIGRATION, chosen because it shares the
substring: if a backfill-named identifier can be found in this file, the
probe's silence about backfillPending is informative.

Negative control run, isolated and restored: repointing CONTROLLER_SRC at
models/User.ts reddens the new line and leaves `not.toMatch(/backfillPending/)`
green — the exact vacuous pass this closes. 21/21 on Node 22.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant