refactor: gadfly round 2 — both halves of an OpenAI-compat built-in register together
Same class of finding as round 1, one level in: I factored the DSN-scheme half of the kimi/qwen duplication into openaiCompatScheme and left the eager provider half copy-pasted, so a third built-in still had six lines to clone — including both credential rules, which is exactly the pair you do not want re-typed. registerOpenAICompatBuiltin now installs both halves from one call. The rules that matter hold by construction for every future caller: WithAPIKey passed unconditionally (an unset key must not fall through to OPENAI_API_KEY), and WithAPIKeyName naming that same variable in the 401 hint. Registering kimi and qwen is now one line each. Also fixed a cross-reference the ADR got wrong: Qwen's image-input caveat is README matrix footnote ⁴, not ³ — ³ is kimi's. I wrote "³, shared with kimi" in the ADR and then gave Qwen its own footnote in the README. The break-check harness needed fixing before any of this could be trusted: three of its mutations targeted lines this refactor moved, so they matched nothing, the code was never broken, and the suite reported "test still passed" — identical output to a test that genuinely misses the bug. Mutations are now verified to have landed (sha before/after) and the suite fails loudly if one doesn't. Two new cases cover the helper: dropping the unconditional WithAPIKey, and dropping the scheme-half registration. 8/8 apply and are caught. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
@@ -87,7 +87,7 @@ blocks there too), where every OpenAI-compat target would get them.
|
||||
- Chat, streaming, tools, structured output, reasoning effort, and cached-token
|
||||
accounting all ride the openai client and inherit its fixes.
|
||||
- Image *inputs* work at the client level, but only the `qwen-vl-*` /
|
||||
`qwen3-vl-*` models accept them (matrix footnote ³, shared with kimi).
|
||||
`qwen3-vl-*` models accept them (matrix footnote ⁴; ³ is kimi's).
|
||||
- Two model-side quirks are Alibaba's, not majordomo's, and are left to the
|
||||
caller rather than papered over: thinking is **on by default** on some models
|
||||
(e.g. `qwen3.7-plus`), and Qwen3 *open-source* models require streaming when
|
||||
|
||||
Reference in New Issue
Block a user