fix: prevent coverage data corruption from artifact name collisions - #1116
Merged
Merged
Conversation
The macos-latest (arm64) and macos-15-intel (x86_64) jobs both run Python
3.12 and both produced `.coverage.pypi.darwin.3.12`. With
`merge-multiple: true`, download-artifact extracts artifacts concurrently
into one directory, so two jobs writing the same path could tear the
SQLite data file ("database disk image is malformed") in the cover job, or
silently clobber one job's data.
Add `platform.machine()` to the coverage filenames so the architectures no
longer collide, and drop `merge-multiple` so each artifact lands in its own
`coverage-*` subdirectory; the cover session now combines those subdirs.
Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
henryiii
force-pushed
the
fix-coverage-artifact-collision
branch
from
June 17, 2026 03:02
b3ac394 to
d3fcd6f
Compare
henryiii
commented
Jun 17, 2026
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.
I hope this fixes the failure we've seen occasionally in CI after multiprocessing in the test suite.
🤖 AI text below 🤖
Problem
The
coverage(combine) job intermittently fails with:(e.g. this run).
Cause
macos-latest(arm64) andmacos-15-intel(x86_64) both run Python 3.12, and the coverage filename is built only fromsys.platform+ version — so both jobs produce.coverage.pypi.darwin.3.12. Thecoverjob then downloads artifacts withmerge-multiple: true, which extracts them concurrently into one directory. Two jobs writing the same path can tear the SQLite data file (→ "database disk image is malformed"), or one silently clobbers the other's coverage. The timing dependence is why it only fails occasionally; the parallel/xdist tests just made the corruption more visible, they aren't the trigger.Fix
platform.machine()to thetests/condacoverage filenames so arm64 and x86_64 no longer collide (also restores the mac coverage that was being silently dropped).merge-multiple: trueso each artifact lands in its owncoverage-*subdirectory; thecoversession now globs those subdirs and passes them tocoverage combine(with a["."]fallback for local runs).No change to the fast test setup — xdist, the
sysmoncore, andrun.patch=["subprocess"]are untouched. The 100%--fail-undergate is unchanged.Verified locally that
coverage combine <dir> <dir>reads data files inside per-artifact subdirs and combines cleanly.