Skip to content

fix: fused pipeline falls back for partial-mixin codecs without sync partial methods - #4201

Merged
d-v-b merged 1 commit into
zarr-developers:mainfrom
d-v-b:fix/fused-sync-fallback-robustness
Jul 29, 2026
Merged

fix: fused pipeline falls back for partial-mixin codecs without sync partial methods#4201
d-v-b merged 1 commit into
zarr-developers:mainfrom
d-v-b:fix/fused-sync-fallback-robustness

Conversation

@d-v-b

@d-v-b d-v-b commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR avoids a crash mid-decode in the fused codec pipeline when a codec advertises public partial encode / decode mixin without supporting the sync methods. This PR ensures that we catch this case early and fall back to full chunk decoding / encoding explicitly.

Assisted-by: ClaudeCode:claude-fable-5

based on this PR: d-v-b#254

Summary

[Describe what this PR changes and why, in your own words.]

For reviewers

[What would you most value a second look at? What are you already confident in? For a refactor, say whether behavior is meant to be unchanged.]

Author attestation

  • I am a human, these are my changes, and I have reviewed and understood every change and can explain why each is correct.

TODO

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.md
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

# without `_decode_partial_sync` — such codecs take the full-chunk
# path below instead.
codec = self.array_bytes_codec
if self.supports_partial_decode and hasattr(codec, "_decode_partial_sync"):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a very cursed blend of two separate ways to advertise similar capabilities. this will need a deep rethink of our codec API to fix

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.90%. Comparing base (123268a) to head (ac4e863).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4201      +/-   ##
==========================================
- Coverage   93.90%   93.90%   -0.01%     
==========================================
  Files          91       91              
  Lines       12672    12670       -2     
==========================================
- Hits        11900    11898       -2     
  Misses        772      772              
Files with missing lines Coverage Δ
src/zarr/core/codec_pipeline.py 96.20% <100.00%> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…partial methods

The partial dispatch in FusedCodecPipeline.read_sync/write_sync asserted
the private _decode_partial_sync/_encode_partial_sync methods, which only
ShardingCodec implements. A codec advertising the public partial mixins
(ArrayBytesCodecPartialDecodeMixin/-EncodeMixin) with only the documented
async partial methods died with a bare AssertionError — or, under
python -O, an AttributeError mid-IO. The asserts are now capability
gates: codecs without the sync partial methods take the full-chunk sync
path instead.

The related crash for sharded arrays with async-only inner codecs is
fixed separately in zarr-developers#4179.

Assisted-by: ClaudeCode:claude-fable-5
@d-v-b
d-v-b force-pushed the fix/fused-sync-fallback-robustness branch from 0b0bb08 to ac4e863 Compare July 29, 2026 14:31
@d-v-b
d-v-b marked this pull request as ready for review July 29, 2026 14:37
@d-v-b

d-v-b commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

I'm self-merging this!

@d-v-b
d-v-b merged commit 80880a0 into zarr-developers:main Jul 29, 2026
30 checks passed
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