fix: refuse canonicals with invalid zstd chunks - #516
Merged
kstonekuan merged 1 commit intoSep 13, 2026
Merged
kstonekuan merged 1 commit into
kstonekuan merged 1 commit into
Conversation
kstonekuan
approved these changes
Sep 13, 2026
Contributor
There was a problem hiding this comment.
LGTM, merging.
One mutation I am merging past: widening the catch to except Exception passes all 7 tests. Path.open sits outside the try, so test_missing_canonical_remains_an_infrastructure_failure cannot constrain the catch width. Worth a cheap pin next time you are in the file.
#521 is assigned to you.
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.
Fixes #506.
A canonical with a corrupted zstd-compressed chunk currently escapes
verify_canonical_integrity()asZstdError, escapesApp.process(), and is eventually recorded as an infrastructure failure.I reproduced the failure first and confirmed the actual exception is:
MCAP does not wrap it.
This change handles that precise failure at the canonical integrity boundary and refuses the episode with:
The refusal uses the same framework-owned
integrity/canonicalpath introduced for CRC failures in #502.Behavior
After this change:
refusal_reasonis set tocanonical-decompression-failedintegrity/canonicalerror row is recordedThe implementation catches only
zstandard.ZstdError; there is no broad exception handling.Reproduction
The regression fixture starts from a valid canonical and changes only the first byte of the first compressed zstd frame:
The stored CRC, MCAP structure, indexes, footer, lengths, and compression metadata remain unchanged, so the failure reaches the actual zstd decompressor.
Tests
Added coverage for:
check_runs.errorfailure_kind='infrastructure'Mutation validation was also run by temporarily removing the new decompression branch; the new regression test failed with the original
ZstdError, then passed again after restoring the branch.Validation