Repository navigation
coverfloor: a coverage floor of what CI runs, reading mutate's lane marker - #131
Merged
Merged
Conversation
…arker spin-machine held its coverage to a floor with internal/coverfloor, which leaves functions marked mutate-lane out of the share because only a test needing root and KVM runs them. It copied mutate's laneMarker, which is internal here and could not be imported, so the two rules could drift (spin-stack/machine#496). coverfloor is that command beside mutate. It asks mutate.LaneFunctions, which reads each function's doc comment with heldByLane, so a marker naming no test, or a test that is not there, fails the floor as it fails mutate. It compares the exact share: go tool cover -func rounds, and read spin-machine's 79.96% as 80.0. go-tools' own task test is held to it, replacing the awk over -func's rounded total. Its output on spin-machine's coverage.out is byte for byte the copy's. Co-Authored-By: Claude Opus 5.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.
Why
Each spin-stack gate should have one definition, not copies that drift. spin-machine's
task testholds coverage to a floor withinternal/coverfloor, which leaves functions markedmutate-lane:out of the share. It copied mutate'slaneMarker, which is internal to go-tools and could not be imported (spin-stack/machine#496).What
cmd/coverfloor, beside mutate:coverfloor FLOOR coverage.out, run from the module root. Exit 0 at or above the floor, 1 below, 2 when it cannot tell. It compares the exact share, sincego tool cover -funcrounds (spin-machine's 79.96% read as 80.0 and passed a floor of 80).mutate.LaneFunctions(path)is the one place the lane rule is read for both tools. It goes throughheldByLane, so a marker that names no test, or a test that is not there, fails the floor as it fails mutate. The copy only looked for the string.task testuses it in place of the awk over-func's rounded total. The stale "today's 61.4%" comment now gives the measured 85.61%. The floor stays 60.coverfloor, its nav entry, a README row, and a pointer from mutate's lane row.Evidence
coverage.outat origin/main 77a36c8, the copy and this command print the same line byte for byte:coverage: 93.38% of what CI runs (floor 93%); 80.66% with the 1606 statements only a lane runs.task lintis clean andtask mutatereports 49 refused and 0 survived.task testprintscoverage: 85.61% of what CI runs (floor 60%); 84.67% with the 88 statements only a lane runs.Once this is released, spin-machine's Taskfile calls
coverfloorfrom the PATHgo tool tasksets up and deletes its copy. That needs no go.mod bump, because cmd/task puts the latest release's commands on PATH.🤖 Generated with Claude Code