Fix ShardWriter round-trip test: missing assertions and degenerate bool data - #397
Merged
kralka merged 1 commit intoAug 20, 2026
Merged
Conversation
The test called np.array_equal without checking its return value, so decode mismatches were silently ignored. Replace with np.testing.assert_array_equal so failures raise. Also replace randint(0, 1) with an explicit array so the bool attribute round-trip is tested with both True and False values.
kralka
approved these changes
Aug 20, 2026
Collaborator
|
Nice finds, thank you! |
Coverage Report for CI Build 32335605095Warning No base build found for commit Coverage: 88.617%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
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.
Description
This test had two bugs that weakened its intended coverage:
np.array_equal(...)was called without checking its return value, so the read-back comparisons never actually asserted anything. The fix replaces this withnp.testing.assert_array_equal, which raises on mismatch.The bool attribute used
np.random.randint(0, 1, ...), which always returns 0 (its upper bound is exclusive), so only all-Falsedata was round-tripped. The fix replaces this with an explicit array containing bothTrueandFalse.Testing
python -m pytest tests/io/shard/test_shard_writer_flatbuffer.py tests/io/shard/test_shard_write_and_read.py- all 14 passed, with four existing unsigned-cast warnings.AI Disclosure
I didn't use AI to write any of this code, but I technically found these bugs during an AI-assisted static analysis project that I've been working on. The AI assisting me was OpenAI Codex gpt-5.6-sol (xhigh). Just stating that for transparency; maintainers, just yell if this disclosure is too pedantic.