Skip to content

feat: default the test share to a warning and ask to keep only tests the project's test rule justifies - #152

Merged
exKAZUu merged 8 commits into
mainfrom
feat/test-share-review-trigger
Nov 25, 2026
Merged

exKAZUu merged 8 commits into
mainfrom
feat/test-share-review-trigger

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Why

testNcssPercent (test NCSS as a percentage of production NCSS) defaulted to an error above 30, and when it was exceeded check told the agent to add no test code (--base) or to delete a given amount of test NCSS (whole project). That made the share a content-blind zero-sum cap: once a project sits at the limit, a test worth having can be added only by deleting another, whatever either is worth. Measured in NCSS on 62 checkouts of the organization's repositories on one developer's machine (production NCSS at least 1,000, second clones and forks among them; code-gauge 11.1.0), the share is 31.6% at the median, 60.8% at the 75th percentile, and 76.2% at the 90th; 52% are above 30%. So 30 sits just below the median, and an error there marks half of the checkouts as code to fix with no ratings behind it. Projects using this tool already have their own rule for when a test is worth having, so exceeding the share now triggers a review of the tests against that rule, at the warning level.

Requirements

  • required: code-gauge's test share must not be too strict
  • required: when the test share is exceeded, change the instruction from "do not add tests" to "keep only tests that satisfy the project's test rule"
  • required: default to a warning at 30, with the error level off by default
  • required: drop the deletion target from the whole-project text and state the excess as a fact
  • chosen: the --base text says "this change edits tests" and "keep a test it adds", not "this change adds test code", because the check fires when the change touches a test (adding, editing, or even shrinking one) and cannot tell an addition from an edit; no detection logic was added just for the wording
  • chosen: the whole-project text keeps the excess number in the line, since another tool reads the amount from it, and calls it "above the strictest limit" because it is measured against the strictest active limit, which can differ from the limit the line prints
  • chosen: no text promises that a share above the limit needs no further change, since a warning never fails the check and a configured error is a gate the project chose
  • chosen: testNcssPercent still cannot be allowed by a directive, since a directive attaches to a function or file and the share belongs to neither; "off" in rules remains the way to turn it off

Customer Summary

  • Default: testNcssPercent is now a warning above 30 and no error, so a project above 30% no longer fails check (exit 0) unless its config sets an error limit.
  • With --base: <dir>: test NCSS percent <v> (max 30), test NCSS <t> of production NCSS <p>; this change edits tests while test code exceeds 30% of production code: keep a test it adds only when the project's test rule justifies it, and delete or merge the others
  • Without --base: <dir>: test NCSS percent <v> (max 30), test NCSS <t> of production NCSS <p>, <n> above the strictest limit; review the tests against the project's test rule and delete or merge those it does not justify
  • How to fix: review the tests the violation names (with --base, those the change adds) against the project's test rule and delete or merge those it does not justify.
  • JSON fields, including excessTestNcss, are unchanged.

Technical Summary

  • src/thresholds.ts: the default limits and the hint of testNcssPercent.
  • src/checkCommand.ts: both remedy texts of a project violation.
  • README.md: the thresholds table, the default config, the default's basis, the remedies with and without --base, and excessTestNcss.
  • docs/threshold-calibration.md: the NCSS measurement behind the default and why it is a warning.
  • test/e2e/checkCli.test.ts: expectations follow the warning default; assertions that only pinned message text were removed.

Nothing in the code treated this metric as error-only: level selection, --base filtering, ordering, the JSON report, and the config schema are level-generic.

Testing

  • bun run verify: passed (code-gauge reports no violation in code this branch changed).
  • bun wb test test/e2e/checkCli.test.ts: 110 passed.
  • Ran the built CLI on scratch projects above the share, at the default warning and with configured error limits, with and without --base: the texts above, exit 0 at the default, exit 1 with a configured error.

Notes

…he test share is exceeded

With --base, a change that edits tests while the test share exceeds its
limit is now told to keep a test it adds only when the project's test
rule justifies it and to delete or merge the others, instead of being
told to add no test code. The limit, its level, and the whole-project
message are unchanged.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@exKAZUu exKAZUu self-assigned this Nov 25, 2026
@exKAZUu

exKAZUu commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

ReviewFixLoop run summary

Run 032ba12aeef6-2 ended completed at 3625e9886be3.

Run page: https://reviewfixloop.com/runs/032ba12aeef6-2

Fixed (6)

  • r1 major src/checkCommand.ts:698 --base remedy gives no done-state: after keeping justified tests the error and exit 1 persist, steering the reader back to deleting tests
    • Fix (c0fc304de63c): The --base remedy and shared hint changed the instruction from a cap to a review but kept the error status without saying when the review is done, so a reader rerunning the check saw an unresolved error. src/checkCommand.ts now appends 'once every test it adds is justified, the error needs no further change', README states the same and qualifies 'error limits mark code to fix' for this case, and the shared hint now reads 'review the tests against the project's test rule and delete or merge them as the violation says', which no longer competes with the no-base 'delete or merge <n> test NCSS'. …
  • r3 minor src/checkCommand.ts:698 The changed-test remedy calls a warning an error
    • Fix (d5d1614245f8): The r1 fix hardcoded 'the error' in the --base remedy although the test share can be reported at the warning level (--warn testNcssPercent=30 --error testNcssPercent=off). The remedy and README now say 'the violation needs no further change' / 'the violation stays reported', which is true at either level; the defect was local to that phrase. Re-ran the reviewer's check-warning.sh on the fix: head prints '... once every test it adds is justified, the violation needs no further change' on a warning line, 0 errors, exit 0; verify and the 27 e2e share tests pass.
  • r6 minor src/checkCommand.ts:699 Name the limit used for the whole-project NCSS excess
    • Fix (d9e0351fa974): excessTestNcss is measured against the strictest active limit (thresholdCheck allowedTestNcss) while the text prints the most severe exceeded limit, so 'N above the limit' read as the gap to the printed limit when warning and error differ. The text and README now say 'N above the strictest limit' / 'strictest active limit', keeping the value and JSON meaning; local to that phrase. Re-ran the reviewer's split-limits.sh: '80 (max 50), test NCSS 8 of production NCSS 10, 5 above the strictest limit; review ...'; verify and the 27 e2e share tests pass.
  • r7 minor src/thresholds.ts:141 Preserve the added-test scope in the shared remediation hint
    • Fix (f08d9d703685): The shared hint said 'review the tests' without scope while the --base violation scopes the review to the tests the change adds, so it could read as auditing every test. The hint now reads 'review the tests the violation names (with --base, those the change adds) against the project's test rule and delete or merge those it does not justify; a share still above the limit after that needs no further change', true for both modes; local to the hint. Re-ran the reviewer's hint-scope.sh: the --base warning is followed by the scoped hint; verify passes.
  • r8 major src/thresholds.ts:141 Remediation tells users to stop while an explicit test-share error still fails the check
    • Fix (3693e86c050d): The r1 fix added an unconditional completion promise ('the violation needs no further change' / 'a share still above the limit after that needs no further change') when the share defaulted to an error; after the requirement change the default is a warning, which never fails the check, and an error exists only when a project configures one to fail on it, so the promise was wrong for configured errors and unneeded for warnings. Removed the clause from the --base text, the hint, and README (and the matching exception to 'error limits mark code to fix'), removing the choice r1 and r8 alternate on…
  • r9 minor README.md:153 Describe the 30% cutoff using the measured checkout sample
    • Fix (3625e9886be3): README called 30 'the median' of 62 'repositories' while the measured median is 31.6% over 62 checkouts that include second clones and forks. README now says 'a warning just below the median test share in NCSS (31.6%) of 62 checkouts of the organization's repositories on one developer's machine', and docs/threshold-calibration.md says checkouts and 'just below the median'; local to the wording. Re-read both passages against the table (50th percentile 31.6, 32 of 62 above 30); verify passes.

Rejected (2)

  • r5 minor src/thresholds.ts:141 Keep whole-project remediation free of the added-test review requirement
    • Reason: The requester changed the requirements: the whole-project text (without --base) must now state the excess as a fact and ask to review the tests against the project's test rule and delete or merge those it does not justify, with no imperative deletion target; head 2e-commit prints '..., 4 above the limit; review the tests against the project's test rule and delete or merge those it does not justify', so a hint that names the test rule in both modes is what is required, not an extra prerequisite.
  • r10 minor src/thresholds.ts:141 The test-share hint refers to tests the violation never names
    • Reason: Fourth finding of this run on the wording of the same one-line testNcssPercent hint (r2, r5, r7) with no concrete harm to the purpose: the violation line directly above the hint names the checked directory (whose tests a whole-project check reviews) and, with --base, scopes the review to 'a test it adds', so a reader is not left without a scope; a --base edit that adds no test simply leaves nothing to delete, which the --base text already implies.

Unresolved (1)

  • r4 major src/checkCommand.ts:698 The changed instruction never reaches `bun wb verify`, which still prints the old zero-sum cap
    • Deferred: Confirmed: wb renders kind 'project' violations from check --json with its own literal ('if it adds test code, delete or merge tests so it adds none') in WillBooster/shared packages/wb/src/commands/codeGauge.ts describeViolation and its handling bullet, so bun run verify still prints the old cap. The text lives in another repository's package and needs its own release, so this PR cannot fix it; filed WillBooster/shared#1680 to make wb print the same remedy and bullet.

Where a human reviewer should look

  • The unresolved findings above: r4.

exKAZUu and others added 3 commits November 25, 2026 15:51
With --base, the test-share remedy now says that once every test the
change adds is justified, the error needs no further change, so a reader
rerunning the check is not steered back to deleting justified tests. The
shared hint asks to review the tests against the project's test rule and
act as the violation says, which reads true with and without --base.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
The test share can be reported at the warning level, where calling it an
error pointed the reader at an error the report does not contain.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…as a fact

The test share limit of 30 is the median test share in NCSS of 62 of the
organization's repositories, with no ratings behind it, so exceeding it
now asks for a review of the tests rather than marking code to fix: the
default becomes a warning at 30 with no error. The whole-project text
states how much test NCSS is above the limit and asks to review the tests
against the project's test rule and delete or merge those it does not
justify, and the hint reads true for both texts. The calibration notes
record the NCSS measurement behind the default.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu exKAZUu changed the title feat: ask to keep only tests the project's test rule justifies when the test share is exceeded feat: default the test share to a warning and ask to keep only tests the project's test rule justifies Nov 25, 2026
exKAZUu and others added 4 commits November 25, 2026 16:04
The excess is measured against the strictest active limit, while the line
prints the limit of the most severe level, so "above the limit" read as
the gap to the printed limit when the levels differ.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
With --base the violation asks to review the tests the change adds, so the
shared hint now says so instead of reading as a review of every test.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
With the share a warning by default, a residual warning already does not
fail the check, while a project that configures an error limit chose to
fail on it, so promising that a share above the limit needs no further
change was wrong for configured errors and unneeded for warnings.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…w its median

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu
exKAZUu merged commit b7e3b24 into main Nov 25, 2026
15 checks passed
@exKAZUu
exKAZUu deleted the feat/test-share-review-trigger branch November 25, 2026 07:25
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