Skip to content

Read coverage counts as Int64, narrowing only at the vendored boundary - #79

Merged
davidanthoff merged 1 commit into
mainfrom
coverage-counts-int64
Aug 22, 2026
Merged

Read coverage counts as Int64, narrowing only at the vendored boundary#79
davidanthoff merged 1 commit into
mainfrom
coverage-counts-int64

Conversation

@davidanthoff

@davidanthoff davidanthoff commented Aug 21, 2026

Copy link
Copy Markdown
Member

Every x86 leg that runs with coverage errors on whatever test item happens to be running when the counters are collected — for example on CSTParser's ubuntu-latest, 1.12.7~x86 leg:

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 IntInt32 on 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, and scripts/update_vendored_packages.jl deliberately skips CoverageTools ("newer versions have a dependency on JuliaSyntax"), so there is no re-vendoring route either. Nothing under packages/ is touched now.

Instead the file is read here. shared/coverage_counts.jl parses the same SF:/DA: lines 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.

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 above typemax(Int32) and checks it survives where Int is 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~x86 reds on JuliaWorkspaces and LanguageServer too.

Found while auditing the stack for Julia 1.13 readiness.

🤖 Generated with Claude Code

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
davidanthoff force-pushed the coverage-counts-int64 branch from 21abf67 to 41abd8e Compare August 22, 2026 00:19
@davidanthoff davidanthoff changed the title Carry coverage counts as Int64, so 32 bit runs can read them back Read coverage counts as Int64, narrowing only at the vendored boundary Aug 22, 2026
@davidanthoff
davidanthoff merged commit a0193ec into main Aug 22, 2026
14 of 17 checks passed
@davidanthoff
davidanthoff deleted the coverage-counts-int64 branch August 22, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant