mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-15 19:32:20 +03:00
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host. Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean. Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
65 lines
3.2 KiB
TypeScript
65 lines
3.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import { APIKEY_PROVIDERS_INFERENCE } from "../../src/shared/constants/providers/apikey/inference-hosts.ts";
|
|
|
|
/**
|
|
* #8676 deprecated MonsterAPI after its domain stopped resolving, but wrote the flag
|
|
* as `isDeprecated` — a key no schema declares and no consumer reads. The catalog
|
|
* field the codebase actually consumes is `deprecated`:
|
|
*
|
|
* src/shared/validation/providerSchema.ts declares `deprecated`, not `isDeprecated`
|
|
* ProviderCard.tsx `provider.deprecated` (strikethrough + block icon)
|
|
* ProviderTestSlideOver.tsx `provider.deprecated` (warning)
|
|
* providerOnboardingCatalog.ts `Boolean(provider.deprecated)` + sorts last
|
|
* ProviderOnboardingWizard.tsx `option.deprecated` (badge)
|
|
* scripts/docs/gen-provider-reference.ts `p.deprecated` gates the DEPRECATED note
|
|
*
|
|
* Because Zod object schemas ignore undeclared keys, `isDeprecated` never failed
|
|
* validation — it was silently dropped, so the deprecation had no effect anywhere
|
|
* while this test stayed green.
|
|
*
|
|
* Upstream state re-probed 2026-08-13, with paired controls:
|
|
* GET https://api.monsterapi.ai/v1/chat/completions -> 000 (does not resolve)
|
|
* GET https://monsterapi.ai -> 000 (does not resolve)
|
|
* GET https://api.openai.com/v1/models -> 401 (control: reachable)
|
|
* GET https://<nonexistent-domain> -> 000 (control: unreachable)
|
|
*/
|
|
test("Monster API provider is marked as deprecated (fixes #8676)", () => {
|
|
const monsterEntry = APIKEY_PROVIDERS_INFERENCE.monsterapi as Record<string, unknown>;
|
|
assert.ok(monsterEntry, "monsterapi entry must exist in APIKEY_PROVIDERS_INFERENCE");
|
|
assert.equal(
|
|
monsterEntry.deprecated,
|
|
true,
|
|
"monsterapi must set `deprecated` — the field every consumer and the Zod schema read"
|
|
);
|
|
assert.ok(
|
|
typeof monsterEntry.deprecationReason === "string",
|
|
"monsterapi must specify deprecationReason"
|
|
);
|
|
});
|
|
|
|
test("Monster API deprecation uses no undeclared flag name (#8676)", () => {
|
|
const monsterEntry = APIKEY_PROVIDERS_INFERENCE.monsterapi as Record<string, unknown>;
|
|
assert.equal(
|
|
"isDeprecated" in monsterEntry,
|
|
false,
|
|
"`isDeprecated` is read by nothing and silently dropped by the provider schema — " +
|
|
"the consumed field is `deprecated`"
|
|
);
|
|
});
|
|
|
|
test("Monster API deprecation matches the flag shape of its sibling entries (#8676)", () => {
|
|
// predibase, in this same catalog, is the reference implementation: its `deprecated`
|
|
// flag is what makes the generated PROVIDER_REFERENCE.md render its DEPRECATED note.
|
|
const monsterEntry = APIKEY_PROVIDERS_INFERENCE.monsterapi as Record<string, unknown>;
|
|
const predibaseEntry = APIKEY_PROVIDERS_INFERENCE.predibase as Record<string, unknown>;
|
|
assert.equal(predibaseEntry.deprecated, true, "predibase is the in-file reference for the flag");
|
|
for (const field of ["deprecated", "deprecationReason"]) {
|
|
assert.equal(
|
|
typeof monsterEntry[field],
|
|
typeof predibaseEntry[field],
|
|
`monsterapi must declare ${field} the same way predibase does`
|
|
);
|
|
}
|
|
});
|