Test OpenAI embed 400/422 fail-loud mapping#222
Merged
Conversation
Spec's v0.16.0 review flagged that the OpenAI embed error path (400/422 to provider_invalid_request) was untested, unlike the parametrized Cohere and TEI equivalents. This is the fail-loud behavior the count-based batch chunking relies on -- an over-token chunk aborts the whole call rather than returning a partial. Add the missing parametrized test so the tag-gating behavior is test-protected, not inspection-only.
There was a problem hiding this comment.
Pull request overview
This PR adds a focused unit test to protect the OpenAI embeddings error-mapping contract used by the retrieval/embedding layer, ensuring HTTP 400/422 failures surface as ProviderInvalidRequest (fail-loud) rather than silently degrading behavior.
Changes:
- Added a parametrized unit test verifying OpenAI embed requests returning HTTP 400 or 422 map to
ProviderInvalidRequest. - Documents (in-test) why this mapping is relied on by count-based batch chunking behavior.
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.
Closes a test-coverage gap spec flagged in its v0.16.0 review: the OpenAI embed error path (400/422 to
provider_invalid_request) was verified only by inspection, while the sibling Cohere and TEI mappings have a parametrized test for the equivalent path.This is the fail-loud behavior the count-based §8 batch chunking relies on: a chunk within the 2048-input count cap but over OpenAI's summed-token ceiling aborts the whole call as
provider_invalid_requestrather than returning a partial or truncated result (the interpretation spec confirmed for the v0.16.0 tag). The new parametrized test makes that tag-gating behavior test-protected.Full suite 1690 passed.