Read coverage counts as Int64, narrowing only at the vendored boundary - #79
Merged
Conversation
davidanthoff
force-pushed
the
coverage-counts-int64
branch
from
August 21, 2026 18:56
dab5997 to
21abf67
Compare
Every `x86` leg that runs with coverage errors on whatever test item happens to
be running when the counters are collected:
OverflowError: overflow parsing "2345022144"
at readfile (packages/CoverageTools/src/lcov.jl:99)
`collect_coverage_data!` writes the runtime's counters with
`jl_write_coverage_data` and reads them straight back with
`CoverageTools.LCOV.readfile`. Julia's counters are 64 bit whatever the word
size, and a line in a hot loop passes `typemax(Int32)` easily, but the count was
parsed as `Int` — `Int32` on a 32 bit platform — so the value the runtime had
just written did not fit.
The fix cannot widen `CovCount`: `packages/` holds git subtrees that are never
edited by hand, and `scripts/update_vendored_packages.jl` deliberately skips
CoverageTools, so there is no re-vendoring route either. So the file is read
here instead. `shared/coverage_counts.jl` parses the same `SF:`/`DA:` lines that
`LCOV.readfile` does, accumulating in `Int64`, and narrows a count only where it
crosses into a vendored `FileCoverage` — where it saturates rather than throwing,
because knowing a line ran at least 2147483647 times beats losing the run over
the exact figure. The controller applies the same narrowing to counts arriving
over the wire, so a 64 bit test process reporting to a 32 bit controller cannot
throw an `InexactError` either.
The protocol's `FileCoverage` now carries `Int64`, so the JSON payload does not
depend on either side's word size. `TestrunResultFileCoverage` stays at `Int`:
what reaches it comes out of the vendored `merge_coverage_counts`, which produces
`Int` whatever we declare.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
davidanthoff
force-pushed
the
coverage-counts-int64
branch
from
August 22, 2026 00:19
21abf67 to
41abd8e
Compare
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.
Every
x86leg that runs with coverage errors on whatever test item happens to be running when the counters are collected — for example on CSTParser'subuntu-latest, 1.12.7~x86leg:collect_coverage_data!writes the runtime's counters withjl_write_coverage_dataand reads them straight back withCoverageTools.LCOV.readfile. Julia's counters are 64 bit whatever the word size, and a line in a hot loop passestypemax(Int32)easily, but the count was parsed asInt—Int32on a 32 bit platform — so the value the runtime had just written did not fit.This replaces the first version of this PR, which fixed it by editing
packages/CoverageTools. That was wrong:packages/holds git subtrees that are never edited by hand, andscripts/update_vendored_packages.jldeliberately skips CoverageTools ("newer versions have a dependency on JuliaSyntax"), so there is no re-vendoring route either. Nothing underpackages/is touched now.Instead the file is read here.
shared/coverage_counts.jlparses the sameSF:/DA:linesLCOV.readfiledoes, accumulating inInt64, and narrows a count only where it crosses into a vendoredFileCoverage— where it saturates rather than throwing, because knowing a line ran at least 2147483647 times beats losing the run over the exact figure. The controller applies the same narrowing to counts arriving over the wire, so a 64 bit test process reporting to a 32 bit controller cannot throw anInexactErroreither.The protocol's
FileCoveragenow carriesInt64, so the JSON payload does not depend on either side's word size.TestrunResultFileCoveragestays atInt: what reaches it comes out of the vendoredmerge_coverage_counts, which producesIntwhatever we declare.Verified locally on both word sizes — the coverage and LCOV test items, 14/14 under the default channel and 14/14 under
--juliaup-channel 1.12~x86. The new test item builds a synthetic LCOV file with a count abovetypemax(Int32)and checks it survives whereIntis 64 bit and saturates where it is not.This is not specific to Julia 1.13 — the same legs fail on 1.12. It was simply never visible until the rc legs started running at all, and the failure lands on an unrelated test item, which is why it read as a parser problem in CSTParser. It plausibly accounts for the
rc~x86reds on JuliaWorkspaces and LanguageServer too.Found while auditing the stack for Julia 1.13 readiness.
🤖 Generated with Claude Code