Files
OmniRoute/tests/unit/autoCombo/suffixComposition-4517.test.ts
Tushar Agarwal 1089c24bc8 Remove/mimocode sunset provider (#10186)
* remove: drop sunset MiMoCode provider from model catalog

* remove: drop sunset MiMoCode provider from model catalog (shared.ts)

Remove unused imports, types, and comments from shared.ts.

* remove: MiMoCode provider (Xiaomi sunset) — executor, registry, no-auth config, icon, tests

* refactor(providers): finish MiMoCode removal — sweep remaining no-auth references

Drop the leftover mimocode entries from the no-auth provider controls, the
translate-path snapshot, the eslint suppressions, and the #3061 auth-loop
test. Re-point the fingerprint-pin (#6696) and proxy-noauth (#6272) tests at
opencode, which exercises the same fingerprint path, so the removal does not
break runtime behavior.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* docs(providers): reconcile provider/executor counts after MiMoCode sunset

The base's parallel doc-count sync (#10433) pinned 340 providers / 101
executors. With mimocode removed, live code has 339 providers and 100
executors; refresh the user-facing counts (package.json description,
llm.txt, README/AGENTS, i18n llm.txt, provider reference, diagrams) so the
check-docs-counts STRICT gate stays green.

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>

* test(providers): fix orphaned mimocode references after MiMoCode sunset

The sunset removed mimocode/mcode from the free-onboarding candidates and
from FINGERPRINT_PROVIDERS, but two tests still referenced them:

- free-provider-onboarding-setup: the mimocode->theoldllm substitution
  introduced duplicate 'opencode' rows (impossible given the request-set
  dedupe) and the wrong display name; align expectations with the actual
  {opencode, theoldllm} dedupe behavior and 'The Old LLM (Free)' name.
- combo-system-prompt-templates-5501: resolveTargetFingerprint tested with
  provider 'mcode', which is no longer a fingerprint provider; point it at
  the remaining fingerprint provider 'opencode'.

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Tushar49 <Tushar49@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: adevwithpurpose <adevwithpurpose@users.noreply.github.com>
Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
2026-08-18 10:49:24 -03:00

98 lines
4.3 KiB
TypeScript

/**
* Unit tests for the `auto/<category>:<tier>` suffix composition filter.
*
* See: `open-sse/services/autoCombo/suffixComposition.ts`
*
* Focus: the `:free` tier filter. Regression test for the bug where
* opencode (noAuth, free) and mimocode (noAuth, free) were NOT being
* included in the free pool because the legacy `freeProviders` list
* only contained paid-API-key providers with free tiers (kiro, qoder, ...).
*
* #4517.
*/
// NOTE: tests/unit/autoCombo/ is a vitest-only scope (the node:test runner in
// test:unit:ci does not walk this dir), so this suite uses the vitest API even
// though it asserts via node:assert. (#4753 originally landed it with node:test
// imports → vitest reported "No test suite found" and the test ran nowhere.)
import { describe, it, beforeAll, afterAll, beforeEach } from "vitest";
import assert from "node:assert/strict";
import {
buildAutoCandidateFilter,
parseAutoSuffix,
} from "../../../open-sse/services/autoCombo/suffixComposition";
describe("suffixComposition :free tier (#4517)", () => {
const ORIGINAL_ENV = { ...process.env };
beforeAll(() => {
// Snapshot env so we can restore it after each test.
});
beforeEach(() => {
// Reset env to a known state so OMNIROUTE_AUTO_FREE_FALLBACK_TO_FULL_POOL
// doesn't leak between cases.
process.env = { ...ORIGINAL_ENV };
});
afterAll(() => {
process.env = ORIGINAL_ENV;
});
it("parseAutoSuffix recognizes coding:free", () => {
assert.deepEqual(parseAutoSuffix("coding:free"), {
valid: true,
category: "coding",
tier: "free",
});
});
it("buildAutoCandidateFilter keeps noAuth free providers", () => {
// Regression: opencode was noAuth and free, but the
// pre-fix `freeProviders` list omitted it, so the filter rejected
// its candidates even though it IS free upstream.
const filter = buildAutoCandidateFilter("coding", "free");
assert.notEqual(filter, null);
assert.equal(filter!({ provider: "opencode", model: "big-pickle" }), true);
assert.equal(filter!({ provider: "opencode", model: "minimax-m3-free" }), true);
assert.equal(filter!({ provider: "duckduckgo-web", model: "gpt-4o-mini" }), true);
});
it("buildAutoCandidateFilter keeps legacy free providers", () => {
// Don't break the existing list — kiro, qoder, groq, etc. must still pass.
const filter = buildAutoCandidateFilter("coding", "free");
assert.equal(filter!({ provider: "kiro", model: "claude-sonnet-4-5" }), true);
assert.equal(filter!({ provider: "groq", model: "llama-3.3-70b" }), true);
assert.equal(filter!({ provider: "qoder", model: "qwen3-coder-plus" }), true);
});
it("buildAutoCandidateFilter rejects paid models under :free", () => {
// The bug: opencode-go/glm-5.1 was being picked because the filter
// fell back to the full pool when no free candidate was found.
// After the fix, glm-5.1 must be rejected by the :free filter.
const filter = buildAutoCandidateFilter("coding", "free");
assert.equal(filter!({ provider: "opencode-go", model: "glm-5.1" }), false);
assert.equal(filter!({ provider: "openai", model: "gpt-4o" }), false);
assert.equal(filter!({ provider: "anthropic", model: "claude-sonnet-4-6" }), false);
assert.equal(filter!({ provider: "deepseek", model: "deepseek-chat" }), false);
});
it("buildAutoCandidateFilter returns null for category-only (no tier)", () => {
// "coding" with no tier must NOT filter by tier — pass-through.
const filter = buildAutoCandidateFilter("coding", undefined);
assert.equal(filter, null);
});
it("buildAutoCandidateFilter keeps free candidates alongside capability checks", () => {
// The category and tier checks are AND-combined. For "coding:free" the
// category check is a pass-through (no vision/reasoning filter), so
// any free model should be kept.
const filter = buildAutoCandidateFilter("coding", "free");
assert.equal(filter!({ provider: "opencode", model: "minimax-m3-free" }), true);
// The "reasoning" category also pairs with ":free" and keeps free models.
const reasoningFilter = buildAutoCandidateFilter("reasoning", "free");
// big-pickle (model_capabilities: reasoning=1) should pass the reasoning check.
assert.equal(reasoningFilter!({ provider: "opencode", model: "big-pickle" }), true);
});
});