Repository navigation
Commit f078bd3
fix(sharding): reject a stored shard too short to hold its index on every path (#4475)
* refactor(sharding): test shard readers and byte slices with `is None`, not truthiness
`_ShardReader` defines `__len__`, so `shard_reader or create_empty(...)`
replaced a loaded zero-chunk shard with an empty reader; the outcome was
equivalent but the test meant "was a shard loaded". Likewise
`get_chunk_slice` returns `tuple[int, int] | None`, and
`_load_full_shard_maybe` relied on `Buffer.__len__` to treat a missing
and a zero-length value alike; that conflation is now spelled out.
No behaviour changes.
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(sharding): reject a stored shard too short to hold its index on every path
A zero-length shard was read as missing by the async full-shard read and
partial write, and failed the index checksum on every other path. The
index decoder now checks the index length first, so every read and
partial-write path, under either pipeline, raises the same ValueError.
zarrs and tensorstore also reject such a shard:
https://github.com/zarrs/zarrs/blob/b8ad3ab45082b7d55ac0dd653594953a9d9e6e7d/zarrs/src/array/codec/array_to_bytes/sharding/sharding_codec.rs#L1273
https://github.com/google/tensorstore/blob/f47412a006d7b3da888f3dbb7fc001d1ac6553e1/tensorstore/kvstore/zarr3_sharding_indexed/shard_format.cc#L113
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changes): name the fragment after PR 388
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changes): name the fragment after upstream PR 4475
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 24ea324 commit f078bd3
3 files changed
Lines changed: 66 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| |||
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
| 670 | + | |
670 | 671 | | |
671 | 672 | | |
672 | 673 | | |
| |||
1403 | 1404 | | |
1404 | 1405 | | |
1405 | 1406 | | |
1406 | | - | |
| 1407 | + | |
| 1408 | + | |
1407 | 1409 | | |
1408 | 1410 | | |
1409 | 1411 | | |
| |||
1547 | 1549 | | |
1548 | 1550 | | |
1549 | 1551 | | |
| 1552 | + | |
1550 | 1553 | | |
1551 | 1554 | | |
1552 | 1555 | | |
| |||
1581 | 1584 | | |
1582 | 1585 | | |
1583 | 1586 | | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
1584 | 1604 | | |
1585 | 1605 | | |
1586 | 1606 | | |
| |||
1669 | 1689 | | |
1670 | 1690 | | |
1671 | 1691 | | |
1672 | | - | |
| 1692 | + | |
1673 | 1693 | | |
1674 | 1694 | | |
1675 | 1695 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
1395 | 1398 | | |
1396 | 1399 | | |
1397 | 1400 | | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
0 commit comments