Skip to content

test(internal): fix integer overflow in tests for 32-bit architectures#306

Open
mangomaker5 wants to merge 1 commit intoanthropics:mainfrom
mangomaker5:fix-i386-test-overflow
Open

test(internal): fix integer overflow in tests for 32-bit architectures#306
mangomaker5 wants to merge 1 commit intoanthropics:mainfrom
mangomaker5:fix-i386-test-overflow

Conversation

@mangomaker5
Copy link
Copy Markdown

Resolves #304

Description

This PR fixes a compilation issue where anthropic-sdk-go test suites fail to compile on 32-bit architectures (like Debian i386 or arm32).

The failure occurs because several parsing tests in the internal/ packages mock integer struct fields using an untyped constant of 237628372683. In Go, the int type is 32-bit on 32-bit platforms, and 237628372683 exceeds 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 123456789 across the test suites. This safely fits within 32 bits and perfectly preserves the structural serialization tests without needing to change standard struct types to int64.

Testing Verification

The fix was validated by compiling targeting 386 natively:

$ env GOARCH=386 go vet ./internal/...
$ env GOARCH=386 go build ./internal/...
# Passed with 0 overflow warnings or errors

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.
@mangomaker5 mangomaker5 requested a review from a team as a code owner March 28, 2026 05:55
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.

Tests fail on i386 (32 bit)

1 participant