Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions config/quality/eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -853,11 +853,6 @@
"count": 1
}
},
"src/app/api/usage/call-logs/route.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/app/api/usage/quota/route.ts": {
"no-restricted-imports": {
"count": 1
Expand Down Expand Up @@ -953,11 +948,6 @@
"count": 1
}
},
"src/app/api/v1/rerank/route.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/app/api/v1/vscode/[token]/models/route.ts": {
"no-restricted-syntax": {
"count": 1
Expand Down
16 changes: 11 additions & 5 deletions tests/unit/cli-combo-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ async function withComboEnv(fn: (dataDir: string) => Promise<void>) {
test("combo create inserts a new combo via db module", async () => {
await withComboEnv(async () => {
const { runComboCreateCommand } = await import("../../bin/cli/commands/combo.mjs");
const result = await runComboCreateCommand("my-combo", "priority", {});
// #11162: combo create refuses combos without any model — pass a model
// like the sibling tests updated in that commit.
const result = await runComboCreateCommand("my-combo", "priority", {
models: ["openai/gpt-4o-mini"],
});
assert.equal(result, 0);

// Verify via the same db module
Expand All @@ -53,10 +57,12 @@ test("combo create fails if combo already exists", async () => {
await withComboEnv(async () => {
const { runComboCreateCommand } = await import("../../bin/cli/commands/combo.mjs");

await runComboCreateCommand("dup-combo", "auto", {});
await runComboCreateCommand("dup-combo", "auto", { models: ["openai/gpt-4o-mini"] });
const originalError = console.error;
console.error = () => {};
const result = await runComboCreateCommand("dup-combo", "auto", {});
const result = await runComboCreateCommand("dup-combo", "auto", {
models: ["openai/gpt-4o-mini"],
});
console.error = originalError;

assert.equal(result, 1);
Expand All @@ -68,7 +74,7 @@ test("combo delete removes the combo", async () => {
const { runComboCreateCommand, runComboDeleteCommand } =
await import("../../bin/cli/commands/combo.mjs");

await runComboCreateCommand("to-delete", "weighted", {});
await runComboCreateCommand("to-delete", "weighted", { models: ["openai/gpt-4o-mini"] });
const result = await runComboDeleteCommand("to-delete", { yes: true });
assert.equal(result, 0);

Expand All @@ -91,7 +97,7 @@ test("combo switch updates active combo when server is offline", async () => {
const { runComboCreateCommand, runComboSwitchCommand } =
await import("../../bin/cli/commands/combo.mjs");

await runComboCreateCommand("my-switch", "round-robin", {});
await runComboCreateCommand("my-switch", "round-robin", { models: ["openai/gpt-4o-mini"] });
const result = await runComboSwitchCommand("my-switch", {});
assert.equal(result, 0);

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/clinepass-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test("ClinePass fallback is the official subscription-only catalog", () => {
test("Cline fallback owns recommended/free models and excludes the ClinePass namespace", () => {
const ids = providerRegistry.cline.models.map((model: { id: string }) => model.id);
assert.deepEqual(ids, [
"zai/glm-5.2",
"z-ai/glm-5.2",
"x-ai/grok-4.5",
"openai/gpt-5.6-sol",
"moonshotai/kimi-k3",
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/guide-settings-route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ test("guide-settings POST writes OpenCode config with current schema and multi-m
"cc/claude-sonnet-4-20250514",
"gg/gemini-2.5-pro",
]);
assert.equal(content.providers, undefined);
// The v2 provider schema is dual-written alongside the v1 block: the v2
// entry lives under `providers.omniroute` with `package`/`settings`.
assert.equal(content.providers.omniroute.package, "@opencode-ai/ai/providers/openai-compatible");
assert.equal(content.providers.omniroute.settings.baseURL, "http://my-omni/v1");
assert.ok(content.providers.omniroute.settings.apiKey.startsWith("sk-"));
});

test("guide-settings POST preserves existing OpenCode config fields while only updating provider.omniroute", async () => {
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/provider-alias-uniqueness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,18 @@ test("primary providers keep the short alias; web variants use their own id", ()
assert.equal(PROVIDER_ID_TO_ALIAS["qwen-web"], "qwen-web");
assert.equal(PROVIDER_ID_TO_ALIAS.kimi, "kimi");
assert.equal(PROVIDER_ID_TO_ALIAS["kimi-web"], "kimi-web");
assert.equal(PROVIDER_ID_TO_ALIAS.hackclub, "hc");
assert.equal(PROVIDER_ID_TO_ALIAS.huggingchat, "huggingchat");
});

test("src/shared providers map resolves the same aliases unambiguously", () => {
// alias → id
assert.equal(resolveProviderId("kimi"), "kimi");
assert.equal(resolveProviderId("hc"), "hackclub");
// id used as alias for the secondary variants
assert.equal(resolveProviderId("qwen-web"), "qwen-web");
assert.equal(resolveProviderId("kimi-web"), "kimi-web");
assert.equal(resolveProviderId("huggingchat"), "huggingchat");
// id → alias
assert.equal(getProviderAlias("kimi"), "kimi");
assert.equal(getProviderAlias("hackclub"), "hc");
});

// #6673: hailuo-web must not collide with the paid API-key minimax/minimax-cn
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/t40-opencode-cli-tools-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ test("T40: OpenCode config document uses current provider schema", () => {
configDocument.provider.omniroute.models["gg/gemini-2.5-pro"].name,
"Gemini 2.5 Pro"
);
assert.equal(configDocument.providers, undefined);
// v2 provider schema is dual-written alongside the v1 block.
assert.equal(
configDocument.providers.omniroute.package,
"@opencode-ai/ai/providers/openai-compatible"
);
});

test("T40: OpenCode explicit multi-model selection overrides fallback defaults", () => {
Expand Down
Loading