Skip to content

Test OpenAI embed 400/422 fail-loud mapping#222

Merged
chris-colinsky merged 1 commit into
mainfrom
chore/openai-embed-error-test
Jul 19, 2026
Merged

Test OpenAI embed 400/422 fail-loud mapping#222
chris-colinsky merged 1 commit into
mainfrom
chore/openai-embed-error-test

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

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_request rather 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.

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.
Copilot AI review requested due to automatic review settings July 19, 2026 01:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chris-colinsky
chris-colinsky merged commit 522cfb2 into main Jul 19, 2026
6 checks passed
@chris-colinsky
chris-colinsky deleted the chore/openai-embed-error-test branch July 19, 2026 02:00
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.

2 participants