Repository navigation
fix: tolerate a torn .meta cache in SourceFileMutationData.load() - #630
Merged
Merged
Conversation
load() only caught FileNotFoundError, so a mutants/*.meta file left empty or truncated when a run was killed mid-write crashed run/results/export-cicd-stats/browse with json.decoder.JSONDecodeError. Treat an unparseable cache file like a missing one and start from empty state, matching MutantLineSpans.load() in the same module. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This was referenced Nov 7, 2026
Owner
|
Thanks! |
Contributor
Author
|
Thanks for the repo! |
This was referenced Nov 7, 2026
RonaldHensbergen
added a commit
to RonaldHensbergen/composable-data-stack
that referenced
this pull request
Nov 7, 2026
…he-sanitizer fix(ci): drop kill-matrix meta-cache sanitizer, pin mutmut to the boxed/mutmut#630 commit (#1193)
This was referenced Nov 9, 2026
Merged
RonaldHensbergen
added a commit
to RonaldHensbergen/composable-data-stack
that referenced
this pull request
Nov 9, 2026
…acks the #630 fix The two ExportStepFunctionalTest torn-cache tests crashed with json.JSONDecodeError on a dev machine with a PyPI mutmut (3.8.1) installed, because the torn-mutants/*.meta tolerance (boxed/mutmut#630) exists only in the git commit pinned by make test-mutation and the mutation workflow. Probe the installed mutmut once (export-cicd-stats against an empty mutants/foo.py.meta) and skip those tests with a clear message when the fix is absent; the no-mutmut stub path (CI) and the pinned-commit path are unchanged. Verified in all three modes: no mutmut -> 10 passed; PyPI 3.8.1 -> 8 passed, 2 skipped; pinned commit -> 10 passed. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
4 tasks done
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.
Problem
SourceFileMutationData.load()(src/mutmut/mutation/data.py) only catchesFileNotFoundError. Amutants/*.metacache file that is empty or truncated because the run was killed mid-write (CI runner shutdown,timeout, Ctrl-C during save) therefore crashes every later command that loads the cache —mutmut run,mutmut results,mutmut export-cicd-stats,mutmut badge,mutmut browse— with:Observed in the wild in composable-data-stack's kill-matrix workflow (RonaldHensbergen/composable-data-stack#1175), where a time-capped PR run was killed mid-write and the export step went red on the torn cache.
Fix
Catch
json.JSONDecodeErroralongsideFileNotFoundErrorinload(): an unparseable cache is treated like a missing one, so the run starts from empty state and the nextsave()overwrites the torn file. This mirrorsMutantLineSpans.load()in the same module, which already catches(FileNotFoundError, json.JSONDecodeError).Tests
New
TestSourceFileMutationDataLoadintests/mutation/test_mutation.py:JSONDecodeError— these 3 fail on the unpatched code with exactly the reported error.uv run pytest tests/ --ignore=tests/e2e: 468 passed, 3 skipped.ruff checkandruff format --checkclean on the changed files.