Repository navigation
fix: preserve optional vision through provider wrappers - #1798
Conversation
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
|
@zack-dev-cm is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
The previous test mocked the Anthropic SDK, KV, search and the compress pipeline across 526 lines to check a 27 line change. Test the two wrappers directly: ResilientProvider forwards describeImage and counts its failures in the shared breaker, FallbackChainProvider skips text-only providers and falls through in order, and both leave describeImage absent when nothing supports it. Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
| describe("provider wrappers keep image description", () => { | ||
| it("ResilientProvider forwards describeImage with its arguments", async () => { | ||
| const describe = vi.fn(async () => "a red dot"); | ||
| const provider = new ResilientProvider(withVision("vision", describe)); | ||
|
|
||
| await expect(provider.describeImage?.("data", "image/png", "prompt")).resolves.toBe( | ||
| "a red dot", | ||
| ); | ||
| expect(describe).toHaveBeenCalledWith("data", "image/png", "prompt"); |
There was a problem hiding this comment.
🔍 Factory-to-caption coverage gap
The ResilientProvider tests construct wrappers directly; no test exercises factory-created vision providers through compression. Existing multimodal tests inject mocks directly. The PR description claims factory-to-persistence coverage that these tests do not provide.
Was this helpful? React with 👍 or 👎 to provide feedback.
Factory-created vision providers lose
describeImagein the resilience and fallback wrappers. Image observations then complete text-only compression without a caption, even when the underlying Anthropic provider supports vision.Preserve the optional image delegate through both wrappers. Image calls share the existing circuit breaker and content-filter handling. Fallbacks try capable providers in configured order, preserve the receiver and arguments, and propagate the last capable error. Text-only providers and empty chains keep the capability absent.
The regression tests drive the real factories, Anthropic provider and registered compression function with SDK, fetch, dispatch and in-memory KV doubles. They check returned and persisted captions, caption sanitization, fallback behavior and the shared breaker policy. The tests exercise control flow rather than a live model or engine.
Validation: 18 new tests and 43 adjacent tests pass. The full suite passes 4,949 tests with seven skipped, using a child-only DNS fixture for eight example peer names. Build, skills generation/check, docs sync/check and eval type check pass. Both changed wrapper modules pass a dedicated strict TypeScript check. The test root retains three existing transitive diagnostics, with no new diagnostics.
Summary by CodeRabbit