Repository navigation
test: FuzzMixedDTypes, the values of mixed-dtype operations - #50
Merged
Merged
Conversation
values.json checks every operation on operands of one dtype and FuzzOps builds only float64 arrays, so nothing checked the values of int8 + uint64, bool * float32, ... The new fuzzer drives Add, Sub, Mul, Maximum, Minimum and Equal over every dtype pair, broadcastable or not, with transposed views and edge values. Oracle: NumPy's promotion table (testdata/promotion.json) for the dtype, the broadcasting rule for the shape, and each element recomputed by casting both operands to the result dtype and using Go's arithmetic of that type; bool - bool must be refused, as NumPy refuses it. 35 million inputs, no failure. Turning true into 2 in the bool->int16 conversion failed it in under a second. SECURITY.md: the guarantee and an audit entry. Compiles for 386 and arm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
values.jsonchecks every operation on operands of one dtype, andFuzzOpsbuilds only float64 arrays. So the values of a mixed-dtype operation (int8 + uint64,bool * float32, …) were checked by nothing.FuzzMixedDTypes(dtype_fuzz_test.go) covers:The oracle is written in the test, independently of the library:
testdata/promotion.json(numpy 2.5.3);+is or,*is and, andbool - boolmust be refused, as NumPy refuses it.There must be no panic, an error exactly where the oracle refuses, and NumPy's dtype, shape and every element. Complex Maximum/Minimum are checked for dtype and shape only, because NumPy orders complex numbers lexicographically with its own NaN rules.
Measured:
trueinto 2. The fuzzer failed in under a second withAdd(bool [2], int16 []) at [1] = 2, oracle 1, so it can see what it guards against.SECURITY.md gains the guarantee and an audit entry. There are no library changes.
🤖 Generated with Claude Code