Skip to content

test: complete OpenAI provider error-normalization coverage - #43

Merged
akash4550 merged 1 commit into
mainfrom
feat/openai-provider-error-tests
Aug 11, 2026
Merged

test: complete OpenAI provider error-normalization coverage#43
akash4550 merged 1 commit into
mainfrom
feat/openai-provider-error-tests

Conversation

@akash4550

Copy link
Copy Markdown
Owner

Problem

The OpenAI provider test suite covered success, defaults, timeout, rate-limit (with retry telemetry), and unknown errors — but the two real-world failure branches were unpinned: connection failures (provider unreachable) and generic API errors (e.g. a 400 from the LLM API). These determine whether operations sees an honest 503 vs 502 and whether the provider's request id / error code surfaces in the AI observability stack.

Solution

Two new deterministic tests in openai.provider.test.ts (mocked SDK, no network):

  • APIConnectionError → 503 "AI provider is temporarily unavailable" with providerCode: 'connection_error'.
  • Generic APIError (400) → 502 "AI provider request failed" with the provider's requestID and code surfaced on the AIProviderError (so they flow into the failure structured log as providerRequestId and the error-code metric).

Validation results

  • API tests: 60 suites, 420 passed (418 pre-existing + 2 new)
  • Web tests: 29 files, 147 passed
  • npm run typecheck: clean
  • npm run build: clean
  • Diff: 1 file, 50 additions / 0 deletions; zero new dependencies; zero migrations; zero UI/deployment/CI changes; zero production code changed

Risk

LOW. Tests only — no production code touched.

Rollback

Revert the PR (delete the added tests). No production impact either way.

Production behavior

Not changed. Provider error handling is untouched. Only coverage was added.

The provider test suite covered success, defaults, timeout,
rate-limit (with retry telemetry), and unknown errors — but the two
real-world failure branches were unpinned:

- APIConnectionError -> 503 'AI provider is temporarily unavailable'
  with providerCode connection_error
- generic APIError (e.g. 400) -> 502 'AI provider request failed' with
  the provider's request id and code surfaced on the AIProviderError

No production code changed.
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for teamsynch-ai canceled.

Name Link
🔨 Latest commit cb51b4e
🔍 Latest deploy log https://app.netlify.com/projects/teamsynch-ai/deploys/6a7b028fc8efd90008256e79

@akash4550
akash4550 merged commit df0cbb9 into main Aug 11, 2026
12 checks passed
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.

1 participant