Explainer

88.69% Coverage Is a Number, Not a Claim

A green build and 88.69% total coverage met an 80% floor while three file-level readings ranged from 72.12% to 88.03%; here is what the aggregate did—and did not—show.

On this page

Deck: A coverage report from a small Swift media-library project I maintain showed CI green and 88.69% total coverage against an 80% floor. In the same report, file-level coverage ranged from 72.12% to 88.03%. The floor passed. The interesting question was what that total left out.

The report looked clean

One snapshot of a small Swift media-library project I have been maintaining said everything a dashboard is supposed to say: the build succeeded, CI was green, and total coverage was 88.69% against a floor of 80%.

Against the floor, that is a pass with 8.69 percentage points of headroom. If coverage is the number your review process looks at, nothing in that report asks for attention. Which is exactly why I want to write about it: the aggregate is where the useful information went to hide.

One arithmetic caveat belongs here, before the file rows. Averaging the three per-file values in the table below gives about 79.1%, not 88.69%. That is not a discrepancy in the report — it is a reminder that the total is not the mean of a handful of files. A project total is normally aggregated over every file and every counted line, so a few prominent rows cannot be averaged back into it. I am treating the total and the rows as two different views of the same report, not as a sum I can reconstruct from three numbers.

The same report lists per-file coverage. Three rows I remember clearly; the middle one I identify by what it holds rather than by a path I am confident of quoting correctly:

FileCoverage
Scanner.swift72.12%
Media model77.14%
Playlist.swift88.03%

Two of those three numbers sit below 80%, and the lowest is nearly eight points under it — 72.12, against a project total that clears the same line by 8.69. That is not a contradiction: a total can clear a floor while individual files sit under it, and I will show the arithmetic below. What it does mean is that the check the project runs — total against 80% — can pass while a file sits nearly eight points under the same number. It also raises a question the last section takes up: is an 80% floor a meaningful thing to compare a single file against at all? I am not claiming the report itself judged each file against 80%; the table carries percentages, not verdicts.

The aggregate hid which files were below the floor

The overall percentage and the file-level readings answer different questions. The total tells you about the project’s trend; the rows tell you where to look next. The report I am describing gives both, and the dashboard made only the first one prominent. One caution before I go further: the report’s column headings were unclear — I return to that below — so I treat the file-level values as coverage percentages that differ in magnitude, not as verdicts from a threshold the project checks file by file.

The file-level variation is worth examining because files do different jobs and have different failure surfaces: a scanner is the kind of file that handles input it does not control, a model type the kind that mostly stores values. The percentages do not tell me which module is riskiest — they cannot measure risk — but they do show where a follow-up review could begin.

The report also does not tell me which behaviors are missing from the scanner tests. A percentage can point to a place worth reviewing; it cannot name the absent scenarios. An aggregate-only check can let those file-level gaps go unremarked, because the number that reaches the reviewer has already averaged them away.

I would not abolish the aggregate. A single number is useful for a trend: is coverage drifting up or down over time? I would pair it with a file-level view and a review rule that surfaces sub-floor files. That turns “88.69% overall” into a more actionable question: which files are below the threshold, and what behavior should their tests cover?

How a total clears a floor while rows sit under it is worth making concrete with a made-up example — not this project’s numbers, just the arithmetic that makes the pattern possible. Suppose a 4,000-line module at 95% coverage shares a project with a 300-line module at 72%. If the total is the usual size-weighted average — covered lines over total lines — then (4,000 × 0.95 + 300 × 0.72) ÷ 4,300 ≈ 93.4%. An unweighted mean of the two file percentages would be 83.5%, so the pattern depends on the weighting convention as well as on the per-file numbers; I am assuming the common line-weighted convention here, because the report’s unclear column headings did not let me confirm it for this project. Under the weighted total the floor passes; the small module is still at 72%. Nothing is hiding illegally — the total is computed correctly. It is just weighted by size, and the file a reviewer should open is the one the weighting drowned out.

Two things I deliberately did not read into it

This is the part I want to be careful about, because coverage reports invite over-reading.

I am calling these file coverage percentages, not branch coverage. The report’s table headers were not clear enough for me to say whether a percentage counts lines, statements, or branches. Those are different measurements with different blind spots: line coverage can be satisfied by running one line that contains two conditions, while branch coverage asks whether both sides of each condition were taken. Relabeling one as the other would be inventing precision. So throughout this article they are file coverage percentages, full stop.

I am not quoting a test count. The source around this snapshot describes the test suite as both “12 test cases” and “12 test groups.” Those are not the same claim — a group can hold several cases — and I could not reconcile them from what I had. Rather than pick one and repeat it, I left the number out. If I cannot say how many tests exist, I am not going to imply anything from a count.

Both omissions point at the same habit: a report snapshot is evidence for exactly the fields you can name unambiguously, and everything else is inference you are making on someone else’s labels.

CI green is not the same claim as correct, and neither is coverage

There is a chain of claims people slide along without stopping at the joints: the build succeeded, so CI is green; coverage is above the floor, so the code is well tested; therefore the behavior is right.

Each arrow fails in a different way. “CI is green” is thinner than it sounds: it reports that the project compiled and the checks it declares ran and exited zero. It says nothing about whether those checks assert the behavior users depend on — a test with its assertions deleted still exits zero. Coverage says which code was executed by tests. Executed code is not verified code: a test can run a function, ignore its return value, and still paint the line green. And correctness — the actual claim, the one the library’s users care about — requires assertions about intended behavior, including the cases nobody thought to write.

The floor itself sits lower in the chain than people assume. “80%” is a number the project chose, not a measurement of anything, and choosing it is a policy decision that usually predates the code it now judges.

The same caution applies to portability. It would be easy to describe this project as “cross-platform proven” because it builds on more than one platform and CI is green. I am not going to write that. The snapshot I am describing carries no platform matrix, no per-platform test results, nothing that would support a portability claim. Building somewhere is not the same as being validated there, and I do not have the data to say which platforms were validated.

What I would change in the next review

Two small changes would help. First, review coverage at file level where a gap could be costly instead of relying only on the project total — not to turn each file into a pass/fail gate, but so the low rows are visible to a human who can decide which one matters. Second, when a report’s labels are ambiguous, drop the ambiguous claim rather than smoothing it over. Both make the report say less, which is the point: I would rather read a number I can trust than one that supports a conclusion I cannot defend.

An 88.69% project with a 72.12% scanner is not a contradiction and not a scandal. It is an ordinary state that the aggregate made invisible, and the only cost was that nobody had to notice.