Repository navigation
feat: default the test share to a warning and ask to keep only tests the project's test rule justifies - #152
Merged
Merged
Conversation
…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>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Member
Author
ReviewFixLoop run summaryRun Run page: https://reviewfixloop.com/runs/032ba12aeef6-2 Fixed (6)
Rejected (2)
Unresolved (1)
Where a human reviewer should look
|
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>
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>
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
testNcssPercent(test NCSS as a percentage of production NCSS) defaulted to an error above 30, and when it was exceededchecktold 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
--basetext 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 wordingtestNcssPercentstill cannot be allowed by a directive, since a directive attaches to a function or file and the share belongs to neither;"off"inrulesremains the way to turn it offCustomer Summary
testNcssPercentis now a warning above 30 and no error, so a project above 30% no longer failscheck(exit 0) unless its config sets an error limit.--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--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 justifyreview 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.excessTestNcss, are unchanged.Technical Summary
src/thresholds.ts: the default limits and the hint oftestNcssPercent.src/checkCommand.ts: both remedy texts of aprojectviolation.README.md: the thresholds table, the default config, the default's basis, the remedies with and without--base, andexcessTestNcss.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,
--basefiltering, 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.--base: the texts above, exit 0 at the default, exit 1 with a configured error.Notes
checksets"testNcssPercent": { "error": 30 }.wb code-gaugeandwb verifyrender this violation with their own text, which still states the old policy for both modes; feat: wb: render the code-gauge test share as a review of tests, not a cap shared#1680 tracks updating them.