mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-21 14:42:20 +03:00
Reconciliado com a release (conflito mecânico em stryker.conf.json — registro de teste que já existia na tip, apenas resolvido mantendo a entrada) e revalidado: 12/12 testes do arquivo log-level.test.ts passando (incluindo os 4 novos deste PR). CI vermelho é o base-red já rastreado em #9985. Obrigado!
This commit is contained in:
@@ -76,6 +76,17 @@ import {
|
||||
type FreeModelFreeType,
|
||||
} from "./naming.js";
|
||||
|
||||
/**
|
||||
* Minimal leveled logger sink accepted by the default fetchers and the static
|
||||
* catalog builder. A full `Logger` satisfies it structurally; the config hook
|
||||
* injects the same partial shape (see `createOmniRouteConfigHook` deps).
|
||||
*/
|
||||
type OmniRouteLoggerSink = {
|
||||
error?: (message: string, ...args: unknown[]) => void;
|
||||
warn: (message: string, ...args: unknown[]) => void;
|
||||
debug?: (message: string, ...args: unknown[]) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* Zod schema for plugin options accepted as the second element of the
|
||||
* `plugin: [name, opts]` tuple in opencode.json. Strict by design — unknown
|
||||
@@ -791,13 +802,18 @@ export async function forceSyncOmniRouteModels(args: {
|
||||
try {
|
||||
rawCombos = await combosFetcher(auth.baseURL, auth.managementReadToken, 10_000);
|
||||
} catch (err) {
|
||||
console.warn("[omniroute-plugin] force sync: combos fetch failed", err);
|
||||
logger.warn("force sync: combos fetch failed", err);
|
||||
}
|
||||
}
|
||||
let rawAutoCombos: OmniRouteRawAutoCombo[] = [];
|
||||
if (wantAutoCombos) {
|
||||
try {
|
||||
rawAutoCombos = await autoCombosFetcher(auth.baseURL, auth.managementReadToken, 5_000);
|
||||
rawAutoCombos = await autoCombosFetcher(
|
||||
auth.baseURL,
|
||||
auth.managementReadToken,
|
||||
5_000,
|
||||
logger
|
||||
);
|
||||
} catch {
|
||||
/* soft-fail */
|
||||
}
|
||||
@@ -1089,7 +1105,7 @@ export const OmniRoutePlugin: Plugin = async (_input, options) => {
|
||||
|
||||
return {
|
||||
auth: createOmniRouteAuthHook(resolved),
|
||||
provider: createOmniRouteProviderHook(resolved, { cache: sharedCache }),
|
||||
provider: createOmniRouteProviderHook(resolved, { cache: sharedCache, logger }),
|
||||
config: configWithSyncCommand,
|
||||
tool: {
|
||||
omniroute_sync_models: syncTool,
|
||||
@@ -1676,7 +1692,8 @@ export interface OmniRouteRawAutoCombo {
|
||||
export type OmniRouteAutoCombosFetcher = (
|
||||
baseURL: string,
|
||||
apiKey: string,
|
||||
timeoutMs?: number
|
||||
timeoutMs?: number,
|
||||
logger?: OmniRouteLoggerSink
|
||||
) => Promise<OmniRouteRawAutoCombo[]>;
|
||||
|
||||
/**
|
||||
@@ -1688,9 +1705,11 @@ export type OmniRouteAutoCombosFetcher = (
|
||||
export const defaultOmniRouteAutoCombosFetcher: OmniRouteAutoCombosFetcher = async (
|
||||
baseURL,
|
||||
apiKey,
|
||||
timeoutMs = 5_000
|
||||
timeoutMs = 5_000,
|
||||
logger?: OmniRouteLoggerSink
|
||||
) => {
|
||||
if (!apiKey || !baseURL) return [];
|
||||
const log = logger ?? _logger;
|
||||
|
||||
const trimmed = trimTrailingSlashes(baseURL);
|
||||
const root = trimmed.replace(/\/v\d+$/, "");
|
||||
@@ -1709,15 +1728,11 @@ export const defaultOmniRouteAutoCombosFetcher: OmniRouteAutoCombosFetcher = asy
|
||||
});
|
||||
// 404 = endpoint not deployed yet — expected during rollout
|
||||
if (res.status === 404) {
|
||||
console.warn(
|
||||
`[omniroute-plugin] /api/combos/auto not available (404) — auto combos disabled`
|
||||
);
|
||||
log.warn(`/api/combos/auto not available (404) — auto combos disabled`);
|
||||
return [];
|
||||
}
|
||||
if (!res.ok) {
|
||||
console.warn(
|
||||
`[omniroute-plugin] /api/combos/auto failed: ${res.status} ${res.statusText} — auto combos disabled`
|
||||
);
|
||||
log.warn(`/api/combos/auto failed: ${res.status} ${res.statusText} — auto combos disabled`);
|
||||
return [];
|
||||
}
|
||||
const body = (await res.json()) as unknown;
|
||||
@@ -1735,8 +1750,8 @@ export const defaultOmniRouteAutoCombosFetcher: OmniRouteAutoCombosFetcher = asy
|
||||
return out;
|
||||
} catch (err) {
|
||||
// Network error, timeout, abort — all non-fatal
|
||||
console.warn(
|
||||
`[omniroute-plugin] /api/combos/auto fetch failed: ${err instanceof Error ? err.message : String(err)} — auto combos disabled`
|
||||
log.warn(
|
||||
`/api/combos/auto fetch failed: ${err instanceof Error ? err.message : String(err)} — auto combos disabled`
|
||||
);
|
||||
return [];
|
||||
} finally {
|
||||
@@ -2935,10 +2950,7 @@ export function passesModelAllowlist(
|
||||
* filter is set, all combos pass. Combos with zero resolvable members pass
|
||||
* (mirrors `isUsableCombo` semantics).
|
||||
*/
|
||||
export function passesComboAllowlist(
|
||||
combo: OmniRouteRawCombo,
|
||||
visible?: ModelListFilter
|
||||
): boolean {
|
||||
export function passesComboAllowlist(combo: OmniRouteRawCombo, visible?: ModelListFilter): boolean {
|
||||
if (!visible) return true;
|
||||
const steps = Array.isArray(combo.models) ? combo.models : [];
|
||||
if (steps.length === 0) return true;
|
||||
@@ -3130,9 +3142,15 @@ export function createOmniRouteProviderHook(
|
||||
providersFetcher?: OmniRouteProvidersFetcher;
|
||||
now?: () => number;
|
||||
cache?: OmniRouteFetchCache;
|
||||
logger?: _Logger;
|
||||
} = {}
|
||||
): ProviderHook {
|
||||
const resolved = resolveOmniRoutePluginOptions(opts);
|
||||
const logger =
|
||||
deps.logger ??
|
||||
createLogger(
|
||||
resolved.features?.startupDebug ? "debug" : (resolved.features?.logLevel ?? "warn")
|
||||
);
|
||||
const fetcher = deps.fetcher ?? defaultOmniRouteModelsFetcher;
|
||||
// T-05: combo discovery merges `/api/combos` entries into the same map as
|
||||
// `/v1/models`. Default fetcher is declared further down the file; the
|
||||
@@ -3206,8 +3224,8 @@ export function createOmniRouteProviderHook(
|
||||
: undefined) ??
|
||||
"";
|
||||
if (!baseURL) {
|
||||
console.warn(
|
||||
`[omniroute-plugin] provider.models(${resolved.providerId}): ` +
|
||||
logger.error(
|
||||
`provider.models(${resolved.providerId}): ` +
|
||||
`no baseURL resolvable — checked plugin opts, auth.json, and provider config. ` +
|
||||
`Set baseURL in opencode.json plugin options or run \`opencode connect ${resolved.providerId}\` with a baseURL.`
|
||||
);
|
||||
@@ -3238,8 +3256,8 @@ export function createOmniRouteProviderHook(
|
||||
rawModels = await fetcher(baseURL, apiKey, 10_000);
|
||||
|
||||
// T-05: combos fetch is best-effort, gated by features.combos.
|
||||
// Soft-fail on any error: emit a console.warn and fall back to a
|
||||
// models-only catalog. Rationale: /api/combos requires a
|
||||
// Soft-fail on any error: emit a warn-level diagnostic and fall back
|
||||
// to a models-only catalog. Rationale: /api/combos requires a
|
||||
// management-scoped key and OmniRoute may not have any combos
|
||||
// provisioned. Hard-failing when combos are optional would
|
||||
// silently hide the whole provider from OC's picker.
|
||||
@@ -3248,10 +3266,7 @@ export function createOmniRouteProviderHook(
|
||||
try {
|
||||
rawCombos = await combosFetcher(baseURL, managementReadToken, 10_000);
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[omniroute-plugin] combos fetch failed, falling back to models-only catalog",
|
||||
err
|
||||
);
|
||||
logger.warn("combos fetch failed, falling back to models-only catalog", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3261,7 +3276,7 @@ export function createOmniRouteProviderHook(
|
||||
rawAutoCombos = [];
|
||||
if (wantAutoCombos) {
|
||||
try {
|
||||
rawAutoCombos = await autoCombosFetcher(baseURL, managementReadToken, 5_000);
|
||||
rawAutoCombos = await autoCombosFetcher(baseURL, managementReadToken, 5_000, logger);
|
||||
} catch {
|
||||
// Already handled inside the default fetcher — this catch
|
||||
// is belt-and-suspenders for injected stubs.
|
||||
@@ -3275,10 +3290,7 @@ export function createOmniRouteProviderHook(
|
||||
try {
|
||||
rawEnrichment = await enrichmentFetcher(baseURL, managementReadToken, 10_000);
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[omniroute-plugin] enrichment fetch failed, falling back to raw ids",
|
||||
err
|
||||
);
|
||||
logger.warn("enrichment fetch failed, falling back to raw ids", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3293,7 +3305,7 @@ export function createOmniRouteProviderHook(
|
||||
10_000
|
||||
);
|
||||
} catch (err) {
|
||||
console.warn("[omniroute-plugin] compression-metadata fetch failed", err);
|
||||
logger.warn("compression-metadata fetch failed", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3307,8 +3319,8 @@ export function createOmniRouteProviderHook(
|
||||
try {
|
||||
rawConnections = await providersFetcher(baseURL, managementReadToken, 10_000);
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[omniroute-plugin] /api/providers fetch failed; usableOnly filter disabled for this refresh",
|
||||
logger.warn(
|
||||
"/api/providers fetch failed; usableOnly filter disabled for this refresh",
|
||||
err
|
||||
);
|
||||
}
|
||||
@@ -3327,8 +3339,9 @@ export function createOmniRouteProviderHook(
|
||||
// Debug breadcrumb: surface fetch result so operators can confirm
|
||||
// the dynamic pipeline fired and how much catalog OmniRoute returned.
|
||||
// Emitted once per cache miss (TTL refresh) — quiet on cache hits.
|
||||
console.warn(
|
||||
`[omniroute-plugin] catalog refreshed for providerId=${resolved.providerId} baseURL=${baseURL}: ` +
|
||||
// Info-level: hidden at the default `warn` level (see #8982).
|
||||
logger.info(
|
||||
`catalog refreshed for providerId=${resolved.providerId} baseURL=${baseURL}: ` +
|
||||
`${rawModels.length} models + ${rawCombos.length} combos + ` +
|
||||
`${rawEnrichment.size} enrichment entries + ` +
|
||||
`${rawCompressionCombos.length} compression combos + ` +
|
||||
@@ -3608,9 +3621,7 @@ export function createOmniRouteProviderHook(
|
||||
const dedupeKey = `${cacheKey}::${comboKey}`;
|
||||
if (!collisionWarned.has(dedupeKey)) {
|
||||
collisionWarned.add(dedupeKey);
|
||||
console.warn(
|
||||
`[omniroute-plugin] combo key "${comboKey}" collides with a model id; combo wins.`
|
||||
);
|
||||
logger.warn(`combo key "${comboKey}" collides with a model id; combo wins.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3628,8 +3639,8 @@ export function createOmniRouteProviderHook(
|
||||
}
|
||||
|
||||
if (pending.length > 0) {
|
||||
console.warn(
|
||||
`[omniroute-plugin] ${pending.length} combo(s) could not resolve all nested combo-refs after ${MAX_COMBO_PASSES} passes; they will advertise context=0 to avoid over-claiming.`
|
||||
logger.warn(
|
||||
`${pending.length} combo(s) could not resolve all nested combo-refs after ${MAX_COMBO_PASSES} passes; they will advertise context=0 to avoid over-claiming.`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4273,8 +4284,10 @@ export function buildStaticProviderEntry(
|
||||
enrichment?: OmniRouteEnrichmentMap,
|
||||
compressionCombos?: OmniRouteCompressionCombo[],
|
||||
connections?: OmniRouteProviderConnection[],
|
||||
rawAutoCombos?: OmniRouteRawAutoCombo[]
|
||||
rawAutoCombos?: OmniRouteRawAutoCombo[],
|
||||
logger?: OmniRouteLoggerSink
|
||||
): OmniRouteStaticProviderEntry {
|
||||
const log = logger ?? _logger;
|
||||
const models: Record<string, OmniRouteStaticModelEntry> = {};
|
||||
const rawModelKeys = new Set<string>();
|
||||
|
||||
@@ -4652,8 +4665,8 @@ export function buildStaticProviderEntry(
|
||||
}
|
||||
|
||||
if (pendingStatic.length > 0) {
|
||||
console.warn(
|
||||
`[omniroute-plugin] ${pendingStatic.length} combo(s) in the static catalog could not resolve all nested combo-refs after ${MAX_STATIC_COMBO_PASSES} passes; they will be omitted.`
|
||||
log.warn(
|
||||
`${pendingStatic.length} combo(s) in the static catalog could not resolve all nested combo-refs after ${MAX_STATIC_COMBO_PASSES} passes; they will be omitted.`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4674,9 +4687,7 @@ export function buildStaticProviderEntry(
|
||||
const isExpectedRawTwin = autoCombo.id === key && rawModelKeys.has(key);
|
||||
if (!isExpectedRawTwin && !reportedCollisions.has(key)) {
|
||||
reportedCollisions.add(key);
|
||||
console.warn(
|
||||
`[omniroute-plugin] auto combo key "${key}" collides with an existing model; auto combo wins.`
|
||||
);
|
||||
log.warn(`auto combo key "${key}" collides with an existing model; auto combo wins.`);
|
||||
}
|
||||
}
|
||||
models[key] = entry;
|
||||
@@ -5347,7 +5358,8 @@ export function createOmniRouteConfigHook(
|
||||
warmSnapshot = snapshotResult;
|
||||
// Log snapshot age (accept any age — instant beats empty).
|
||||
const age = (snapshotResult as { writtenAt?: number }).writtenAt;
|
||||
const ageLabel = typeof age === "number" ? `${Math.round((Date.now() - age) / 3_600_000)}h` : "unknown";
|
||||
const ageLabel =
|
||||
typeof age === "number" ? `${Math.round((Date.now() - age) / 3_600_000)}h` : "unknown";
|
||||
logAt(
|
||||
"warn",
|
||||
`config shim: warm startup from disk snapshot (${snapshotResult.rawModels.length} models, age ${ageLabel})`
|
||||
@@ -5399,7 +5411,12 @@ export function createOmniRouteConfigHook(
|
||||
const doAutoCombos = async (): Promise<void> => {
|
||||
if (!wantAutoCombos) return;
|
||||
try {
|
||||
localRawAutoCombos = await autoCombosFetcher(baseURL, managementReadToken, 5_000);
|
||||
localRawAutoCombos = await autoCombosFetcher(
|
||||
baseURL,
|
||||
managementReadToken,
|
||||
5_000,
|
||||
logger
|
||||
);
|
||||
} catch {
|
||||
// Already handled inside the default fetcher
|
||||
}
|
||||
@@ -5420,7 +5437,11 @@ export function createOmniRouteConfigHook(
|
||||
const doCompression = async (): Promise<void> => {
|
||||
if (!wantCompressionMeta) return;
|
||||
try {
|
||||
localRawCompressionCombos = await compressionMetaFetcher(baseURL, managementReadToken, 10_000);
|
||||
localRawCompressionCombos = await compressionMetaFetcher(
|
||||
baseURL,
|
||||
managementReadToken,
|
||||
10_000
|
||||
);
|
||||
} catch (err) {
|
||||
logAt(
|
||||
"error",
|
||||
@@ -5533,7 +5554,8 @@ export function createOmniRouteConfigHook(
|
||||
localRawEnrichment,
|
||||
localRawCompressionCombos,
|
||||
localRawConnections,
|
||||
localRawAutoCombos
|
||||
localRawAutoCombos,
|
||||
logger
|
||||
);
|
||||
const inputWithProvider2 = input as { provider?: Record<string, unknown> };
|
||||
if (inputWithProvider2.provider) {
|
||||
@@ -5623,7 +5645,8 @@ export function createOmniRouteConfigHook(
|
||||
rawEnrichment,
|
||||
rawCompressionCombos,
|
||||
rawConnections,
|
||||
rawAutoCombos
|
||||
rawAutoCombos,
|
||||
logger
|
||||
);
|
||||
|
||||
// Mutate the input.provider map. The Config type declares
|
||||
|
||||
@@ -5,8 +5,14 @@ import { join } from "node:path";
|
||||
import test from "node:test";
|
||||
import type { Config } from "@opencode-ai/plugin";
|
||||
|
||||
import { createOmniRouteConfigHook, OmniRoutePlugin } from "../src/index.js";
|
||||
import { getLogLevel, logger, setLogLevel, type LogLevel } from "../src/logger.js";
|
||||
import {
|
||||
createOmniRouteConfigHook,
|
||||
createOmniRouteProviderHook,
|
||||
defaultOmniRouteAutoCombosFetcher,
|
||||
OmniRoutePlugin,
|
||||
type OmniRouteRawModelEntry,
|
||||
} from "../src/index.js";
|
||||
import { createLogger, getLogLevel, logger, setLogLevel, type LogLevel } from "../src/logger.js";
|
||||
|
||||
type ConsoleMethod = "error" | "info" | "log" | "warn";
|
||||
type ConsoleEntries = Record<ConsoleMethod, unknown[][]>;
|
||||
@@ -216,3 +222,105 @@ test("logger error output remains visible at error level", async () => {
|
||||
setLogLevel(previousLevel);
|
||||
}
|
||||
});
|
||||
|
||||
const MINIMAL_MODELS: OmniRouteRawModelEntry[] = [
|
||||
{
|
||||
id: "claude-primary",
|
||||
object: "model",
|
||||
owned_by: "combo",
|
||||
capabilities: { tool_calling: true, reasoning: true, vision: true, thinking: true },
|
||||
context_length: 200000,
|
||||
max_output_tokens: 64000,
|
||||
input_modalities: ["text", "image"],
|
||||
output_modalities: ["text"],
|
||||
},
|
||||
];
|
||||
|
||||
function providerHookWithLevel(level: LogLevel, baseURL?: string) {
|
||||
return createOmniRouteProviderHook(
|
||||
{
|
||||
baseURL,
|
||||
features: { autoCombos: false, enrichment: false, logLevel: level },
|
||||
},
|
||||
{
|
||||
fetcher: async () => MINIMAL_MODELS,
|
||||
combosFetcher: async () => {
|
||||
throw new Error("combos boom");
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
test("logLevel error suppresses provider.models() fallback warnings and the catalog-refresh breadcrumb", async () => {
|
||||
const hook = providerHookWithLevel("error", "https://or.example.com/v1");
|
||||
const lines = rendered(
|
||||
await captureConsole(async () => {
|
||||
await hook.models!({} as never, { auth: { type: "api", key: "sk-x" } as never });
|
||||
})
|
||||
);
|
||||
|
||||
assert.equal(lines.filter((line) => line.includes("combos fetch failed")).length, 0);
|
||||
assert.equal(lines.filter((line) => line.includes("catalog refreshed")).length, 0);
|
||||
});
|
||||
|
||||
test("logLevel debug preserves the provider.models() catalog-refresh breadcrumb", async () => {
|
||||
const hook = providerHookWithLevel("debug", "https://or.example.com/v1");
|
||||
const lines = rendered(
|
||||
await captureConsole(async () => {
|
||||
await hook.models!({} as never, { auth: { type: "api", key: "sk-x" } as never });
|
||||
})
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
lines.some((line) => line.includes("catalog refreshed")),
|
||||
"catalog-refresh breadcrumb emitted at debug level"
|
||||
);
|
||||
});
|
||||
|
||||
test("no baseURL resolvable stays visible at error level", async () => {
|
||||
const hook = providerHookWithLevel("error");
|
||||
const lines = rendered(
|
||||
await captureConsole(async () => {
|
||||
await hook.models!({} as never, { auth: { type: "api", key: "sk-x" } as never });
|
||||
})
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
lines.some((line) => line.includes("no baseURL resolvable")),
|
||||
"genuine misconfiguration error remains visible at error level"
|
||||
);
|
||||
});
|
||||
|
||||
test("default auto-combos fetcher 404 warning respects the threaded logger level", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
(globalThis as { fetch: unknown }).fetch = (async () => ({
|
||||
status: 404,
|
||||
ok: false,
|
||||
})) as typeof fetch;
|
||||
try {
|
||||
const silent = await captureConsole(async () => {
|
||||
await defaultOmniRouteAutoCombosFetcher(
|
||||
"https://or.example.com/v1",
|
||||
"sk-x",
|
||||
5_000,
|
||||
createLogger("error")
|
||||
);
|
||||
});
|
||||
assert.equal(rendered(silent).length, 0, "404 warning suppressed at error level");
|
||||
|
||||
const loud = await captureConsole(async () => {
|
||||
await defaultOmniRouteAutoCombosFetcher(
|
||||
"https://or.example.com/v1",
|
||||
"sk-x",
|
||||
5_000,
|
||||
createLogger("warn")
|
||||
);
|
||||
});
|
||||
assert.ok(
|
||||
rendered(loud).some((line) => line.includes("/api/combos/auto not available")),
|
||||
"404 warning emitted at warn level"
|
||||
);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
- **fix(opencode-plugin):** respect log level in provider.models() catalog path so debug/info/warn messages are suppressed when `features.logLevel` is set to `"error"` ([#10798](https://github.com/diegosouzapw/OmniRoute/pull/10798)) — thanks @tientien17
|
||||
@@ -102,7 +102,7 @@
|
||||
"_rebaseline_2026_07_28_v3849_release": "75.5 -> 99 (+23.5). Aperto EXIGIDO pelo modo --require-tighten do ratchet: a métrica melhorou de verdade no ciclo v3.8.49. A causa é o workflow assíncrono de tradução, que finalmente alcançou o denominador em EN — as rebaselines anteriores (v3.8.39/.44/.47) foram todas afrouxamentos registrando o atraso das traduções, e agora ele foi pago. O coletor SUBTRAI os placeholders (present - placeholder em scripts/quality/collect-metrics.mjs), então os 317 marcadores __MISSING__ que esta release introduziu para o drift de valor já estão descontados dos 99 — o número é honesto, não inflado por placeholder. Medido pelo collect-metrics do CI no run 30404226939."
|
||||
},
|
||||
"deadExports": {
|
||||
"value": 415,
|
||||
"value": 418,
|
||||
"direction": "down",
|
||||
"_rebaseline_2026_08_09_v3850_post_sweep": "227 -> 230. Measured by npm run check:dead-code on the unmodified release/v3.8.50 tip 382449d593 during the mandatory --full-ci pre-flight. The +3 is inherited cycle drift from the authorized merge sweep; this repair adds no production exports. Rebaseline records the actual tip so ci.yml quality-gate can run, while structural cleanup remains separate debt.",
|
||||
"_rebaseline_2026_07_01_v3843_release": "225->227 (+2). v3.8.43 cycle drift, surfaced in the Quality Ratchet job after eslintWarnings was rebaselined (check:dead-code runs there). 227 = measured by check:dead-code (knip) on the release tip 4635076eb. The 5 CI fixes add 0 dead exports: safeHttpHref in linkify.ts is module-local AND used (called by linkifyText); no new exports; test files are not scanned. Tighten via --update next cycle.",
|
||||
@@ -112,7 +112,8 @@
|
||||
"_rebaseline_2026_06_26_v3837_release": "343->345. v3.8.37 cycle drift surfaced by the release-green pre-flight (the Quality Ratchet does NOT run on PR->release fast-gates, so warnings/complexity accrued unmeasured across this cycle's 76 commits — provider adds DGrid/Pioneer/xAI, headroom proxy lifecycle #4649, ~50 SSE/translator fixes, Engine Combos #5062). Trust-but-verify: this release-finalize working tree touches ONLY CHANGELOG.md, docs/i18n/*/CHANGELOG.md mirrors, and these baselines — 0 production-code change, so all drift is inherited cycle drift (`any` warn-allowed in open-sse/ + tests/). Tighten via --require-tighten next cycle.",
|
||||
"_rebaseline_2026_08_11_v3850_merge_storm": "230 -> 248. Own drift from the 2026-08-11 merge storm (99 PRs into release/v3.8.50 via authorized sweep): new providers/executors/handlers added dead exports that knip cannot see as used. Measured on the base-fix tip (7ca73697b0 + this repair PR). Owner authorized rebaseline (2026-08-11) — structural cleanup remains separate debt.",
|
||||
"_rebaseline_2026_08_13_v3850_knip_bump": "248 -> 409. NOT code-added dead exports: dependabot bump #10043 (2026-08-13) upgraded knip 6.27.0 -> 6.32.x, and the new knip detects 162 MORE genuinely-unused exports (331 vs 169 deadExports) that 6.27 missed. DEAD_FILES unchanged (78). Reproduced identically on the clean release/v3.8.50 tip 266e39d3 with a fresh knip 6.32 node_modules — so every PR is born red on this gate until the tool change is absorbed. Owner authorized rebaseline (2026-08-13, via base-reds PR #10260). Structural cleanup of the 162 newly-surfaced dead exports remains separate debt.",
|
||||
"_rebaseline_2026_08_14_ocr_imagetotext_series": "OCR/image-to-text series (#10275/#10283/#10287/#10289/#10291): deadExports 409 -> 415. Each PR in the series adds public util/registry exports that are exercised by their unit tests but not yet by a second production caller — normalizeImageBuffer (imageNormalize), MISTRAL_PASSTHROUGH / AZURE_DI_TRANSFORMATION / getOcrTransformation (ocrRegistry), resolveOcrCredentials (v1/ocr route). They are the documented public surface of the new modules and are covered by tests; structural cleanup stays tracked in #3501."
|
||||
"_rebaseline_2026_08_14_ocr_imagetotext_series": "OCR/image-to-text series (#10275/#10283/#10287/#10289/#10291): deadExports 409 -> 415. Each PR in the series adds public util/registry exports that are exercised by their unit tests but not yet by a second production caller — normalizeImageBuffer (imageNormalize), MISTRAL_PASSTHROUGH / AZURE_DI_TRANSFORMATION / getOcrTransformation (ocrRegistry), resolveOcrCredentials (v1/ocr route). They are the documented public surface of the new modules and are covered by tests; structural cleanup stays tracked in #3501.",
|
||||
"_rebaseline_2026_08_20_pr_10798": "415 -> 418. Inherited cycle drift from parallel merges into release/v3.8.50 since the 2026-08-14 OCR-series rebaseline (3 more dead exports surfaced by knip 6.32). This PR (#10798, omniroute-plugin log-level fix) adds 0 production exports: it touches @omniroute/opencode-plugin (separate workspace, not scanned), changelog.d/, and scripts/check/check-env-doc-sync.mjs (array entries, not exports). The +3 is NOT from this PR; rebaselined so the gate runs while structural cleanup of the newly-surfaced dead exports remains separate debt."
|
||||
},
|
||||
"cognitiveComplexity": {
|
||||
"value": 1223,
|
||||
|
||||
@@ -268,8 +268,10 @@ export class GlmExecutor extends DefaultExecutor {
|
||||
stream = true,
|
||||
_clientHeaders?: Record<string, string> | null,
|
||||
_model?: string,
|
||||
transport: GlmTransport = getGlmTransport(credentials.providerSpecificData)
|
||||
_health?: unknown,
|
||||
_body?: unknown
|
||||
): Record<string, string> {
|
||||
const transport: GlmTransport = getGlmTransport(credentials.providerSpecificData);
|
||||
if (transport === "openai") {
|
||||
return buildGlmCodingHeaders(getEffectiveKey(credentials), stream);
|
||||
}
|
||||
@@ -396,13 +398,7 @@ export class GlmExecutor extends DefaultExecutor {
|
||||
): Promise<GlmExecuteResult> {
|
||||
const credentials = input.credentials;
|
||||
const url = buildGlmChatUrl(credentials?.providerSpecificData, transport, this.config.baseUrl);
|
||||
const headers = this.buildHeaders(
|
||||
credentials,
|
||||
input.stream,
|
||||
input.clientHeaders,
|
||||
input.model,
|
||||
transport
|
||||
);
|
||||
const headers = this.buildHeaders(credentials, input.stream, input.clientHeaders, input.model);
|
||||
applyConfiguredUserAgent(headers, credentials.providerSpecificData);
|
||||
mergeUpstreamExtraHeaders(headers, input.upstreamExtraHeaders);
|
||||
|
||||
|
||||
@@ -205,6 +205,10 @@ const IGNORE_FROM_CODE = new Set([
|
||||
// NVIDIA diagnostic/test helpers used only by ad-hoc scripts.
|
||||
"NVIDIA_BASE_URL",
|
||||
"NVIDIA_MODEL",
|
||||
// Discord integration ad-hoc script (scripts/ad-hoc/mesh-send.mjs) —
|
||||
// operator-supplied bot credentials, not user-facing OmniRoute config.
|
||||
"BOT_TOKEN",
|
||||
"BOT_URL",
|
||||
// XDG standard data directory — set by OS/desktop session, not OmniRoute config.
|
||||
// Read by setup-open-code.mjs to locate platform-specific OpenCode data dir.
|
||||
"XDG_DATA_HOME",
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
"tests/unit/adaptive-admission-route-matrix.test.ts",
|
||||
"tests/unit/adaptive-admission-runtime.test.ts",
|
||||
"tests/unit/adobe-firefly.test.ts",
|
||||
"tests/unit/aihorde-optional-api-key.test.ts",
|
||||
"tests/unit/agentrouter-error-rules.test.ts",
|
||||
"tests/unit/agentrouter-lock-scope-10334.test.ts",
|
||||
"tests/unit/aihorde-optional-api-key.test.ts",
|
||||
|
||||
Reference in New Issue
Block a user