test(mp2): lock the layout-span guard against regressions - #342
Open
Mark2Mac wants to merge 1 commit into
Open
Conversation
`_is_layout_only_span()` is what keeps MP2 from reporting alignment as context
stuffing, and it has no test. The only layout case covered today is `"=" * 80`,
which never reaches the helper — the older single-character guard skips it first.
Measured on a corpus of 4406 files from 65 skill/plugin units, comparing the
analyzer before the helper landed with `main` today:
MP2 findings 279 -> 4
The four survivors come from MP2's prose patterns ("exceed context window"), not
from the repetition pattern. So the helper is carrying 275 of 279 findings, with
nothing pinning its behaviour.
The three cases added here are each reported when the helper is stubbed out, which
is what makes them regressions rather than restatements of the guard above them:
a dash rule, a run of padded columns, and a box edge with padding. The fourth test
locks the other side, `_MAX_LAYOUT_ONLY_SPAN`: past that width layout stops being a
plausible explanation and the run is reported again.
No source change.
Signed-off-by: Mark2Mac <Mark2Mac@users.noreply.github.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.
Why
_is_layout_only_span()is the guard that keeps MP2 from reporting alignment — table rules, padded columns, box edges — as context window stuffing. It has no test.The only layout case in the suite today is:
That one never reaches the helper: a run of a single character with no whitespace is skipped by the older guard just above it. Stub
_is_layout_only_spantoreturn Falseand the whole suite still passes.How much it is carrying
Measured on 4406 files from 65 real skill/plugin units, comparing the analyzer before the helper landed with
maintoday:The four survivors are from MP2's prose patterns (
"exceed context window"and friends), not from(.{2,20}?)\1{20,}. So the helper accounts for 275 of 279 findings and nothing pins its behaviour.What this adds
Three cases that are each reported when the helper is stubbed out, which is what makes them regressions rather than restatements of the guard above them:
"- " * 40— dash rule"| " * 40— padded columns"│ " * 30— box edge + paddingAnd one for the other side, so the exemption cannot quietly widen:
"- " * 200exceeds_MAX_LAYOUT_ONLY_SPANand is still reported.No source change.
255 passedin the touched file,ruff checkandruff format --checkclean at 0.15.19.Context
This replaces #322, which I closed. That PR proposed its own layout guard, and the measurement above is what retired it: on today's
mainit removes zero findings, because_is_layout_only_spanalready covers the same ground. The tests are the part that turned out to be worth keeping.