mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-26 17:12:27 +03:00
Validated on the combined batch board + this branch: perf-a-b-c-d + account-fallback-service 93/93, gates + typecheck clean. Owner approved the full bundle including item A (async proxy-log batching, 1s/100-item flush with an unref'd timer — reviewed the implementation: flush helper exists for shutdown wiring, buffered logs are the accepted tradeoff). B (lazy modals), C (O(1) alias maps), D (pre-compiled regex — this is also the entire content of #11187, being closed as subsumed) ride along. Conflict with the tip was only stale provider-count docs. Thank you @rqzbeh!
27 lines
975 B
TypeScript
27 lines
975 B
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import { logProxyEvent, flushProxyLogsSync } from "../../src/lib/proxyLogger.ts";
|
|
import { shouldStripCloudCodeThinking } from "../../open-sse/services/cloudCodeThinking.ts";
|
|
|
|
test("Part A: async proxy log batching queues entries without synchronous failure", () => {
|
|
const sampleLog = {
|
|
status: "success",
|
|
provider: "test-provider",
|
|
latencyMs: 15,
|
|
};
|
|
|
|
const logged = logProxyEvent(sampleLog);
|
|
assert.equal(logged.provider, "test-provider");
|
|
assert.equal(typeof logged.id, "string");
|
|
|
|
// Ensure flush completes without throwing
|
|
assert.doesNotThrow(() => {
|
|
flushProxyLogsSync();
|
|
});
|
|
});
|
|
|
|
test("Part D: pre-compiled regex in cloudCodeThinking model normalization", () => {
|
|
assert.equal(shouldStripCloudCodeThinking("antigravity", "antigravity/claude-3-7-sonnet"), true);
|
|
assert.equal(shouldStripCloudCodeThinking("antigravity", "models/gemini-2.5-pro"), false);
|
|
});
|