Files
OmniRoute/tests/unit/perf-a-b-c-d.test.ts
Rouzbeh† c92bd40b88 perf(proxy): implement non-blocking async proxy log batching and performance optimizations (A, B, C, D) (#11182)
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!
2026-08-23 01:07:32 -03:00

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);
});