test(commands): stub plugin metadata snapshot in onboard-inference test (#122901)

The configured-model case lacked a current plugin metadata snapshot, so model normalization cold-discovered every bundled manifest; the prepared empty snapshot keeps the test on its intended boundary and reduced Vitest file wall time from 26.72s to 2.57s (the shell measurements were 194.45s and 56.21s including unrelated lock queues).
This commit is contained in:
Peter Steinberger
2026-08-12 18:39:08 -07:00
committed by GitHub
parent 93cf912695
commit 9489cd1f96
+50 -1
View File
@@ -1,5 +1,5 @@
// Inference backend detection tests cover the documented ladder and login-awareness.
import { describe, expect, it } from "vitest";
import { afterAll, describe, expect, it, vi } from "vitest";
import type { LocalCommandProbe } from "../system-agent/probes.js";
import {
ANTHROPIC_API_DEFAULT_MODEL_REF,
@@ -7,6 +7,55 @@ import {
detectInferenceBackends,
} from "./onboard-inference.js";
const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
policyHash: "onboard-inference-test-empty-plugin-policy",
configFingerprint: "onboard-inference-test-empty-plugin-metadata",
index: {
version: 1,
hostContractVersion: "test",
compatRegistryVersion: "test",
migrationVersion: 1,
policyHash: "onboard-inference-test-empty-plugin-policy",
generatedAtMs: 0,
installRecords: {},
plugins: [],
diagnostics: [],
},
registryDiagnostics: [],
manifestRegistry: { plugins: [], diagnostics: [] },
plugins: [],
diagnostics: [],
byPluginId: new Map(),
normalizePluginId: (pluginId: string) => pluginId,
owners: {
channels: new Map(),
channelConfigs: new Map(),
providers: new Map(),
modelCatalogProviders: new Map(),
cliBackends: new Map(),
setupProviders: new Map(),
commandAliases: new Map(),
contracts: new Map(),
},
metrics: {
registrySnapshotMs: 0,
manifestRegistryMs: 0,
ownerMapsMs: 0,
totalMs: 0,
indexPluginCount: 0,
manifestPluginCount: 0,
},
}));
vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({
getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot,
}));
afterAll(() => {
vi.doUnmock("../plugins/current-plugin-metadata-snapshot.js");
vi.resetModules();
});
function probeDeps(found: Record<string, boolean>) {
return async (command: string): Promise<LocalCommandProbe> => ({
command,