test(internal): fix integer overflow in tests for 32-bit architectures#306
Open
mangomaker5 wants to merge 1 commit intoanthropics:mainfrom
Open
test(internal): fix integer overflow in tests for 32-bit architectures#306mangomaker5 wants to merge 1 commit intoanthropics:mainfrom
mangomaker5 wants to merge 1 commit intoanthropics:mainfrom
Conversation
Resolves anthropics#304 by replacing an oversized untyped integer test constant (237628372683) with a safe 32-bit compatible value (123456789) to prevent compilation panics on i386/ARM32 endpoints.
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.
Resolves #304
Description
This PR fixes a compilation issue where
anthropic-sdk-gotest suites fail to compile on 32-bit architectures (like Debiani386orarm32).The failure occurs because several parsing tests in the
internal/packages mock integer struct fields using an untyped constant of237628372683. In Go, theinttype is 32-bit on 32-bit platforms, and237628372683exceeds the maximum bounds of a 32-bit signed integer (2,147,483,647), causing the compiler to safely panic.This PR performs a simple substitution, changing the overloaded constant to
123456789across the test suites. This safely fits within 32 bits and perfectly preserves the structural serialization tests without needing to change standard struct types toint64.Testing Verification
The fix was validated by compiling targeting
386natively:$ env GOARCH=386 go vet ./internal/... $ env GOARCH=386 go build ./internal/... # Passed with 0 overflow warnings or errors