weiqingy commented on PR #989:
URL: https://github.com/apache/flink-agents/pull/989#issuecomment-5248678483

   @wenjin272 Thanks for review.
   
   You were right, and it wasn't hypothetical. I wrapped only 
`com.openai.errors.OpenAIException` around the SDK call in 
`OpenAICompletionsConnection`, and the whole existing suite still passed.
   
   Added `FakeOpenAIErrorEndpoint`, a small local HTTP server that returns a 
400 with an OpenAI error body, and one `testProviderErrorPropagatesUnwrapped` 
in each of the three connection test classes. Each asserts 
`BadRequestException` and the `code` from the payload. No new dependency, 
nothing under `src/main`. 72 tests to 75. That same wrapper now fails exactly 
those three tests and nothing else, Azure included.
   
   Two caveats:
   
   - Asserting `statusCode()` proves nothing on its own, since 
`BadRequestException` always returns 400. That line passes as soon as the type 
matches. The real check is the payload: change what the fake sends back and all 
three tests fail.
   - I only cover 400, not 4xx generally. A 429 or a 5xx gets retried, so it 
costs three requests instead of one. 400 keeps the test quick.
   
   The two `testRequestBuildingFailurePropagatesUnwrapped` tests stay. Wrapping 
only `buildRequest(...)` fails those two and not the new ones, so they catch 
different bugs.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to