Add focused PNG round-trip SDK tests#10
Merged
Merged
Conversation
Confirms PNG bytes survive translation through the proxy intact for every supported entry point: - genai inlineData with image/png becomes a data:image/png;base64,... image_url part upstream - genai fileData with a data: URI is preserved verbatim - genai fileData with an https URL passes through unmodified (no re-encoding) - openai-go chat completions with an image content part flows through the raw passthrough byte-for-byte A shared assertUpstreamHasImageURL helper walks the structured upstream body for the three genai cases; the OpenAI passthrough test uses strings.Contains since the proxy never decodes the body on that route. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
PNG image support was already in the proxy, but only covered transitively by
TestSDKGenAIGenerateContentwhere a PNG part is one item among many. This PR adds four dedicated tests that prove PNG bytes survive every supported entry point intact.TestSDKGenAIPNGInlineDatainlineDatawithimage/pngdata:image/png;base64,<base64>image_url partTestSDKGenAIPNGFileDataDataURIfileDatawithdata:URITestSDKGenAIPNGFileDataHTTPURLfileDatawithhttps://URLTestSDKOpenAIPNGImagePassthroughA shared
assertUpstreamHasImageURLhelper walks the structured upstream body for the three genai cases. The OpenAI passthrough test usesstrings.Containssince the proxy never decodes the body on that route.Test plan
make lintcleanmake test-unitgreengo test ./integrationgreen: all four new tests passt.Parallel()to match the existing convention insdk_test.go)PR B (Tesseract-backed OCR for PNG) coming next.
🤖 Generated with Claude Code