Repository navigation
The 100% gate rounds, and this module is over the line where that matters - #29
Merged
Merged
Conversation
…ters
`go tool cover -func` prints its total with one decimal, so it says "100.0%" for
anything from 99.95% upward. `%.1f` crosses that line at exactly 2000 statements:
1999 statements, 1 uncovered -> 99.949975% -> prints 99.9% -> refused
2000 statements, 1 uncovered -> 99.950000% -> prints 100.0% -> PASSED
This module instruments 2770, so it is over it. Demonstrated here rather than
argued: zeroing one block's counts in a real profile from this workflow's own
command leaves `go tool cover` saying 100.0% while the statement is plainly
uncovered.
go tool cover says: 100.0%
the gate says: uncovered (1 statements): parser.go:23.36,23.52
2769 of 2770 statements covered
# It is exact today, which is why now
Measured with this workflow's command, -race and the /ast exclusion included: 2770
of 2770. Nothing is hidden. Changing the instrument while the code is clean is
cheaper than discovering later that it was not.
# What the rounding hides is not a random statement
It hides the ones hardest to reach from a test, and that population is mostly
GUARDS. In go-crdt, where this was first found, the two statements the rounded gate
had been passing were both allocation bounds against hostile input -- one of them a
ceiling no test could reach from data at all.
# The gate
It counts statements in the profile, where the numbers are exact. Two details it
carries from having been got wrong before:
- A profile from `-coverpkg` with `./...` holds the same block once per test
binary, so the counts are summed PER BLOCK before anything is called uncovered.
Reading each line on its own reported thousands of covered statements as
uncovered.
- A pattern that matches nothing is a FAILURE rather than an empty pass, so a
rename cannot quietly empty the gate.
Verified: exit 1 on a profile with one block zeroed, exit 0 on the real one, and
the empty-match guard fires.
Not touched: paren_singleton_def_test.go is listed by gofmt here and not by CI,
which is a toolchain difference and none of this change's business.
Co-Authored-By: Claude Opus 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.
go tool cover -funcprints its total with one decimal, so it says100.0%foranything from 99.95% upward.
%.1fcrosses that line at exactly 2000 statements:This module instruments 2770, so it is over it. Demonstrated here rather than
argued — zeroing one block's counts in a real profile from this workflow's own command:
It is exact today, which is why now
Measured with this workflow's own command,
-raceand the/astexclusion included:2770 of 2770. Nothing is hidden. Changing the instrument while the code is clean is
cheaper than discovering later that it was not.
What the rounding hides is not a random statement
It hides the ones hardest to reach from a test, and that population is mostly guards.
In go-crdt, where this was first found, the two statements the rounded gate had been
passing were both allocation bounds against hostile input — one a ceiling no test
could reach from data at all.
For context on why this PR exists here and nowhere else: of 173 repositories in this
fleet carrying the rounded idiom, 201 of 253 workflow copies turn out to be floor
gates (immune — a 0.05% rounding is nothing against a floor), leaving 28 with a true
100% gate. Of those 28, this is the only one above 2000 statements. The largest of
the rest is 1596, where one uncovered statement prints as 99.9% and the gate refuses
correctly.
The gate
It counts statements in the profile, where the numbers are exact. Two details it carries
from having been got wrong before:
-coverpkgwith./...holds the same block once per test binary,so counts are summed per block before anything is called uncovered. Reading each
line on its own reported thousands of covered statements as uncovered.
quietly empty the gate.
Verified: exit 1 on a profile with one block zeroed, exit 0 on the real one, and the
empty-match guard fires.
Not touched:
paren_singleton_def_test.gois listed bygofmthere and not by CI, whichis a toolchain difference and none of this change's business.
🤖 Generated with Claude Code