fix: widen the matrix-count guard past the shape it missed - #777
Merged
Conversation
#754 added test_only_the_matrix_doc_states_counts so a matrix count could not be written into prose where nothing checks it. Its pattern required a qualifying noun -- `\d+ distinct files` matched, a bare `\d+ files` did not -- so this line in .copilot/README.md, inside a file the test explicitly scans, passed: Copilot-host workflow skills (16 files). The number was right. That is the point: it is the same state the five wrong counts were in before #754 -- accurate, in prose, and unguarded while believed to be guarded. A guard trusted more than it deserves is worse than no guard, because it stops anyone looking. Both halves are fixed. The line is now structural, which is what #754 did everywhere else: the count belongs to cross-agent-delegation.md's Matrix section and nowhere else. And the pattern gains the bare nouns -- files, entries, skills, bridges, commands. Widening a pattern in a guard risks the opposite failure, so the noun set was checked against all four scanned documents before landing: it hits the one known line and nothing else. Three benign strings are pinned as cases so a later widening cannot quietly start matching ordinary prose, alongside the shape that was missed. Verified by mutation in both directions: narrowing the pattern back fails the planted-error test, and restoring the old wording in .copilot/README.md fails the scan that should have caught it the first time. Addresses #774
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.
Description
#754 added
test_only_the_matrix_doc_states_countsso a matrix count could not be written intoprose where nothing checks it. Its pattern required a qualifying noun —
\d+ distinct filesmatched, a bare
\d+ filesdid not — so this line in.copilot/README.md, inside a file the testexplicitly scans, passed:
The number was right. That is the point: it is the same state the five wrong counts were in before
#754 — accurate, in prose, and unguarded while believed to be guarded. A guard trusted more than
it deserves is worse than no guard, because it stops anyone looking.
Related Issue
Addresses #774
Type of Change
Changes Made
Both halves, as the issue set out.
action) pair" — which is what refactor: cross-agent matrix counts are duplicated in eight places and verified in none #754 did everywhere else. The count belongs to
cross-agent-delegation.md's Matrix section and nowhere else.files,entries,skills,bridges,commands.The risk in widening, and what was done about it
The issue warned that widening has an opposite failure mode: a pattern matching ordinary prose makes
the guard noise rather than signal. So the noun set was checked against all four scanned documents
before landing — it hits the one known line and nothing else.
Three benign strings are pinned as cases so a later widening cannot quietly start matching prose:
…alongside the shape that was missed:
Testing
doit checkandmkdocs build --strictpass; 56 matrix tests green.Verified by mutation in both directions:
cellsonlytest_the_count_checks_detect_a_planted_errorfails(16 files)in.copilot/README.mdtest_only_the_matrix_doc_states_counts[.copilot/README.md]failsThe second is the one that matters — it is the check that should have caught this the first time,
and now does.
Checklist
doit format)doit lint)doit type_check)doit test)update_changelog_on_bump)Additional Notes
This closes the review that produced #772, #773 and #774.
Worth recording that two of the three findings were defects in guards I had written earlier the same
day — this one, and the portability trap in #773's guard that passed locally and failed all six CI
jobs. The pattern is consistent: a guard is easy to write so that it passes, and the work is in
proving it fails for the right reason. Every guard added since is mutation-tested for exactly that.