triage remaining tracker fixes

This commit is contained in:
Advait Paliwal
2026-04-09 10:34:29 -07:00
parent 96234425ba
commit bfa538fa00
9 changed files with 157 additions and 1 deletions

View File

@@ -57,6 +57,16 @@ test("buildModelStatusSnapshotFromRecords flags an invalid current model and sug
assert.ok(snapshot.guidance.some((line) => line.includes("Configured default model is unavailable")));
});
test("chooseRecommendedModel prefers MiniMax M2.7 over highspeed when that is the authenticated provider", () => {
const authPath = createAuthPath({
minimax: { type: "api_key", key: "minimax-test-key" },
});
const recommendation = chooseRecommendedModel(authPath);
assert.equal(recommendation?.spec, "minimax/MiniMax-M2.7");
});
test("resolveInitialPrompt maps top-level research commands to Pi slash workflows", () => {
const workflows = new Set(["lit", "watch", "jobs", "deepresearch"]);
assert.equal(resolveInitialPrompt("lit", ["tool-using", "agents"], undefined, workflows), "/lit tool-using agents");
@@ -65,4 +75,3 @@ test("resolveInitialPrompt maps top-level research commands to Pi slash workflow
assert.equal(resolveInitialPrompt("chat", ["hello"], undefined, workflows), "hello");
assert.equal(resolveInitialPrompt("unknown", ["topic"], undefined, workflows), "unknown topic");
});

View File

@@ -0,0 +1,42 @@
import test from "node:test";
import assert from "node:assert/strict";
import { patchPiGoogleLegacySchemaSource } from "../scripts/lib/pi-google-legacy-schema-patch.mjs";
test("patchPiGoogleLegacySchemaSource rewrites legacy parameters conversion to normalize const", () => {
const input = [
"export function convertTools(tools, useParameters = false) {",
" if (tools.length === 0) return undefined;",
" return [",
" {",
" functionDeclarations: tools.map((tool) => ({",
" name: tool.name,",
" description: tool.description,",
' ...(useParameters ? { parameters: tool.parameters } : { parametersJsonSchema: tool.parameters }),',
" })),",
" },",
" ];",
"}",
"",
].join("\n");
const patched = patchPiGoogleLegacySchemaSource(input);
assert.match(patched, /function normalizeLegacyToolSchema\(schema\)/);
assert.match(patched, /normalized\.enum = \[value\]/);
assert.match(patched, /parameters: normalizeLegacyToolSchema\(tool\.parameters\)/);
});
test("patchPiGoogleLegacySchemaSource is idempotent", () => {
const input = [
"export function convertTools(tools, useParameters = false) {",
' ...(useParameters ? { parameters: tool.parameters } : { parametersJsonSchema: tool.parameters }),',
"}",
"",
].join("\n");
const once = patchPiGoogleLegacySchemaSource(input);
const twice = patchPiGoogleLegacySchemaSource(once);
assert.equal(twice, once);
});