test(threading): positive control on the backfillPending absence probe - #1230
Open
lilyshen0722 wants to merge 1 commit into
Open
test(threading): positive control on the backfillPending absence probe#1230lilyshen0722 wants to merge 1 commit into
lilyshen0722 wants to merge 1 commit into
Conversation
@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>
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.
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 unguardedreadFileSync, 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 aboutbackfillPendingis informative.Negative control
Run in isolation with a verified backup and restored afterwards (this suite's file,
CONTROLLER_SRCrepointed atmodels/User.ts):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