Repository navigation
fix(providers): make upstream model sync opt-in and preserve manual overrides - #10603
diegosouzapw merged 4 commits into
Conversation
|
This is a nice, well-scoped feature — the default-off opt-in for upstream auto-fetch plus the same-id manual-override/reset flow is exactly the right design, and your own new tests (24) all pass for me locally. However the CI run shows the default flip breaks two pre-existing tests that assumed auto-fetch reached the network by default:
Could you add Also, the 11 new i18n keys ( Separately, I saw a 'Kimi Coding' model-list assertion fail in CI — that looks like it's from catalog data drift unrelated to your diff (the current release/v3.8.50 tip's test still expects the same fixture your CI run expected), so a rebase should clear it up; flagging just in case. |
…verrides (cherry picked from commit 0a84f54)
…sync i18n keys The upstream model auto-fetch opt-in default flip made 3 pre-existing tests short-circuit before reaching the paths they exercise, because their connection fixtures never set providerSpecificData.autoFetchModels: true: - tests/unit/provider-models-route-lan-guard.test.ts (cheaper-inference#6939 SSRF-guard tests) - tests/unit/openrouter-embeddings-catalog-6976.test.ts (live discovery merge/dedup) - tests/unit/provider-models-route.test.ts (Kimi Coding auth-header test — this was mislabeled as base/catalog drift during review, but is the same root cause: without autoFetchModels the mocked fetch is never reached and the route falls back to local catalog data instead) Also syncs the 11 new providers.autoFetchModels*/overridesUpstreamModel*/ resetToUpstreamDefaults* i18n keys from en.json/zh-CN.json to the remaining 40 locale files via a narrowly-scoped ad-hoc translation script (only these 11 keys — leaves each locale's pre-existing, unrelated missing-key backlog untouched). Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…el sync Rebase surfaced that the 'Kimi Coding' CI failure flagged as possible base drift during review was actually the same root cause as the lan-guard and openrouter-embeddings fixes: 29 pre-existing tests in tests/unit/provider-models-route.test.ts (of 59 total) short-circuit under the new autoFetchModels opt-in default because their connection fixtures never set providerSpecificData.autoFetchModels: true, so they never reach the live-fetch/validation paths they were written to exercise (fetch mocks never called, base-URL validation never reached, live models never merged). Adds providerSpecificData.autoFetchModels: true to each affected fixture. No production code or test assertions changed — same TEST-fixture-only pattern as the lan-guard and openrouter-embeddings fixes. All 59 tests in the file now pass (was 30/59). Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
a8fe545 to
07fdbee
Compare
fd76271
into
cheaper-inference:release/v3.8.50
…10749) * fix(ci): route the Gemini Web b64_json download error through sanitizeErrorMessage() open-sse/handlers/imageGeneration/providers/geminiWeb.ts embedded a raw err.message in the b64_json download-failure response, tripping check:error-helper (Hard Rule #12) on release/v3.8.50. Refs #9985. * fix(tests): drain test-drift base-reds left by #10603/#10537 and a stale qwen-web catalog id Several base-reds on release/v3.8.50 (#9985) share one root cause: a legitimate product change landed without updating the test asserting the old behavior. - tests/unit/glm-provider-model-import-route.test.ts (12 tests) and tests/unit/model-sync-route.test.ts (2 tests) predate #10603, which made upstream model sync opt-in (isAutoFetchModelsEnabled() now requires providerSpecificData.autoFetchModels === true) and made manual custom-model overrides survive a sync instead of being demoted. Updated both files to opt in / assert the new preserve-manual-overrides behavior, with a comment citing #10603. - tests/unit/antigravity-model-aliases.test.ts predates #10537, which retired the collapsed 'gemini-3.7-flash' alias (upstream 'gemini-3.7-flash-tiered') in favor of the three directly-callable tiered ids. Dropped the retired id from EXPECTED_FLASH_TIERS. - open-sse/config/freeModelCatalog.data.ts: the qwen-web free-catalog entry still listed the retired 'qwen3.8-max-preview' id instead of the current 'qwen3.8-max' (open-sse/config/providers/registry/qwen/web/index.ts and the executor's compat alias both confirm 'qwen3.8-max' is canonical). Real data drift, not test drift. - src/i18n/messages/zh-TW.json: providers.autoFetchModelsTooltip (added by #10603) used the mainland term 緩存 instead of the zh-TW glossary-canonical 快取, tripping the i18n-glossary-consistency-check base-red. - src/lib/oauth/providers/zed-hosted.ts: removed an unused default export (the named export already covers every consumer) — shaves one symbol off the check:dead-code ratchet (419 -> 418; baseline 415, 3 still outstanding). Refs #9985. --------- Co-authored-by: Markus Hartung <mail@hartmark.se>
…ive the test Vitest went red on 'synchronizes upstream models only when autoFetchModels is explicitly true' with new URL throwing inside a fetch dispatched from Timeout._onTimeout (useProviderModels.ts:69). It is intermittent: green in the two previous CI runs, green every time in isolation, red only under the ui suite's 20 parallel workers. The hook schedules its auto-sync in a setTimeout whose callback only checks the flag on entry — and that flag stays false while the component is mounted. Both tests asserted first and unmounted last, so under contention the timer escaped the test window, fired after afterEach had already run vi.unstubAllGlobals(), and reached the REAL fetch with a relative URL. Unmounting before the assertions closes the window: cleanup flips , the callback returns early, and the calls already recorded on fetchMock are still there to assert against. No assertion changed. Not a regression from this cycle — the file's last change is fd76271 (#10603). Fixed rather than tracked because an intermittent red in a blocking job is worse than a permanent one: it teaches people to re-run instead of to look. Refs #10692
…verrides (cheaper-inference#10603) * fix(providers): make upstream model sync opt-in and preserve manual overrides (cherry picked from commit 0a84f54) * test(providers): cover upstream model sync controls * fix(providers): fix pre-existing tests broken by opt-in model sync + sync i18n keys The upstream model auto-fetch opt-in default flip made 3 pre-existing tests short-circuit before reaching the paths they exercise, because their connection fixtures never set providerSpecificData.autoFetchModels: true: - tests/unit/provider-models-route-lan-guard.test.ts (cheaper-inference#6939 SSRF-guard tests) - tests/unit/openrouter-embeddings-catalog-6976.test.ts (live discovery merge/dedup) - tests/unit/provider-models-route.test.ts (Kimi Coding auth-header test — this was mislabeled as base/catalog drift during review, but is the same root cause: without autoFetchModels the mocked fetch is never reached and the route falls back to local catalog data instead) Also syncs the 11 new providers.autoFetchModels*/overridesUpstreamModel*/ resetToUpstreamDefaults* i18n keys from en.json/zh-CN.json to the remaining 40 locale files via a narrowly-scoped ad-hoc translation script (only these 11 keys — leaves each locale's pre-existing, unrelated missing-key backlog untouched). Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> * fix(providers): fix remaining pre-existing tests broken by opt-in model sync Rebase surfaced that the 'Kimi Coding' CI failure flagged as possible base drift during review was actually the same root cause as the lan-guard and openrouter-embeddings fixes: 29 pre-existing tests in tests/unit/provider-models-route.test.ts (of 59 total) short-circuit under the new autoFetchModels opt-in default because their connection fixtures never set providerSpecificData.autoFetchModels: true, so they never reach the live-fetch/validation paths they were written to exercise (fetch mocks never called, base-URL validation never reached, live models never merged). Adds providerSpecificData.autoFetchModels: true to each affected fixture. No production code or test assertions changed — same TEST-fixture-only pattern as the lan-guard and openrouter-embeddings fixes. All 59 tests in the file now pass (was 30/59). Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…nference#9985) (cheaper-inference#10749) * fix(ci): route the Gemini Web b64_json download error through sanitizeErrorMessage() open-sse/handlers/imageGeneration/providers/geminiWeb.ts embedded a raw err.message in the b64_json download-failure response, tripping check:error-helper (Hard Rule cheaper-inference#12) on release/v3.8.50. Refs cheaper-inference#9985. * fix(tests): drain test-drift base-reds left by cheaper-inference#10603/cheaper-inference#10537 and a stale qwen-web catalog id Several base-reds on release/v3.8.50 (cheaper-inference#9985) share one root cause: a legitimate product change landed without updating the test asserting the old behavior. - tests/unit/glm-provider-model-import-route.test.ts (12 tests) and tests/unit/model-sync-route.test.ts (2 tests) predate cheaper-inference#10603, which made upstream model sync opt-in (isAutoFetchModelsEnabled() now requires providerSpecificData.autoFetchModels === true) and made manual custom-model overrides survive a sync instead of being demoted. Updated both files to opt in / assert the new preserve-manual-overrides behavior, with a comment citing cheaper-inference#10603. - tests/unit/antigravity-model-aliases.test.ts predates cheaper-inference#10537, which retired the collapsed 'gemini-3.7-flash' alias (upstream 'gemini-3.7-flash-tiered') in favor of the three directly-callable tiered ids. Dropped the retired id from EXPECTED_FLASH_TIERS. - open-sse/config/freeModelCatalog.data.ts: the qwen-web free-catalog entry still listed the retired 'qwen3.8-max-preview' id instead of the current 'qwen3.8-max' (open-sse/config/providers/registry/qwen/web/index.ts and the executor's compat alias both confirm 'qwen3.8-max' is canonical). Real data drift, not test drift. - src/i18n/messages/zh-TW.json: providers.autoFetchModelsTooltip (added by cheaper-inference#10603) used the mainland term 緩存 instead of the zh-TW glossary-canonical 快取, tripping the i18n-glossary-consistency-check base-red. - src/lib/oauth/providers/zed-hosted.ts: removed an unused default export (the named export already covers every consumer) — shaves one symbol off the check:dead-code ratchet (419 -> 418; baseline 415, 3 still outstanding). Refs cheaper-inference#9985. --------- Co-authored-by: Markus Hartung <mail@hartmark.se>
…ive the test Vitest went red on 'synchronizes upstream models only when autoFetchModels is explicitly true' with new URL throwing inside a fetch dispatched from Timeout._onTimeout (useProviderModels.ts:69). It is intermittent: green in the two previous CI runs, green every time in isolation, red only under the ui suite's 20 parallel workers. The hook schedules its auto-sync in a setTimeout whose callback only checks the flag on entry — and that flag stays false while the component is mounted. Both tests asserted first and unmounted last, so under contention the timer escaped the test window, fired after afterEach had already run vi.unstubAllGlobals(), and reached the REAL fetch with a relative URL. Unmounting before the assertions closes the window: cleanup flips , the callback returns early, and the calls already recorded on fetchMock are still there to assert against. No assertion changed. Not a regression from this cycle — the file's last change is 51653a6 (cheaper-inference#10603). Fixed rather than tracked because an intermittent red in a blocking job is worse than a permanent one: it teaches people to re-run instead of to look. Refs cheaper-inference#10692
Summary
Related Issues
Validation
Choose the change type and focused loop from the
Contribution Golden Path. The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR (#8329):
node --import tsx/esm --test tests/unit/managed-model-import.test.ts— 9 passednode --import tsx/esm --test --test-name-pattern "keeps upstream discovery off until autoFetchModels is explicitly enabled" tests/unit/provider-models-route.test.ts— 1 passednpm run lint— the full command reports pre-existing unrelated lint errors in the current release base; the changed test files pass focused ESLint.Tests Added Or Updated
tests/unit/managed-model-import.test.tstests/unit/provider-models-route.test.tstests/unit/ui/use-provider-models-auto-fetch.test.tsxsrc/app/(dashboard)/dashboard/providers/[id]/__tests__/useModelImportHandlers.test.tsxsrc/app/(dashboard)/dashboard/providers/[id]/__tests__/providerModelsSectionVisibilityKey.test.tsxCoverage Notes
autoFetchModels === true.Reviewer Notes