mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
perf(executors): lazy-load the executor registry — defer class imports + construction to first use (#11220) (#11421)
Validated in a combined 3-PR batch worktree off release/v3.8.51 tip (a sibling PR from the same author, #11495, was held out — a typecheck error in zai-web.ts only reproduced with this PR + #11495 boarded together, and cleared without #11495; isolated this PR alone confirmed clean on its own too, so the interaction belonged to #11495's side — see its comment). - Golden lock: executor-map-golden.test.ts — passes byte-identical (same keys, classes, provider identities, dispatch guards) - Focused tests part of batch's 94/94 node:test run - typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity — all OK - Full-repo lint: 228 pre-existing dashboard react-hooks/* findings, unrelated to this diff Thanks for the measured, careful methodology here — the golden-lock contract plus the isolated DATA_DIR benchmarking make this an easy PR to trust despite the wide surface (72 files).
This commit is contained in:
@@ -15,9 +15,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
const TEST_DATA_DIR = fs.mkdtempSync(
|
||||
path.join(os.tmpdir(), "omniroute-cmd-code-user-array-5166-")
|
||||
);
|
||||
const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-cmd-code-user-array-5166-"));
|
||||
process.env.DATA_DIR = TEST_DATA_DIR;
|
||||
|
||||
const { getExecutor } = await import("../../open-sse/executors/index.ts");
|
||||
@@ -58,7 +56,7 @@ function captureFetch(response: Response) {
|
||||
|
||||
test("#5166 user message with multi-part array content passes through as an OpenAI array", async () => {
|
||||
const calls = captureFetch(okResponse());
|
||||
await getExecutor("command-code").execute({
|
||||
(await getExecutor("command-code")).execute({
|
||||
model: "deepseek/deepseek-v4-pro",
|
||||
stream: false,
|
||||
credentials: { apiKey: "cc_test_key" },
|
||||
@@ -86,7 +84,7 @@ test("#5166 user message with multi-part array content passes through as an Open
|
||||
|
||||
test("#5166 user message with single text-part array passes through", async () => {
|
||||
const calls = captureFetch(okResponse());
|
||||
await getExecutor("command-code").execute({
|
||||
(await getExecutor("command-code")).execute({
|
||||
model: "deepseek/deepseek-v4-pro",
|
||||
stream: false,
|
||||
credentials: { apiKey: "cc_test_key" },
|
||||
@@ -102,7 +100,7 @@ test("#5166 user message with single text-part array passes through", async () =
|
||||
|
||||
test("#5166 user message with plain string content passes through unchanged", async () => {
|
||||
const calls = captureFetch(okResponse());
|
||||
await getExecutor("command-code").execute({
|
||||
(await getExecutor("command-code")).execute({
|
||||
model: "deepseek/deepseek-v4-pro",
|
||||
stream: false,
|
||||
credentials: { apiKey: "cc_test_key" },
|
||||
@@ -114,7 +112,7 @@ test("#5166 user message with plain string content passes through unchanged", as
|
||||
|
||||
test("#5166 user message with mixed parts (text + image_url) keeps all parts", async () => {
|
||||
const calls = captureFetch(okResponse());
|
||||
await getExecutor("command-code").execute({
|
||||
(await getExecutor("command-code")).execute({
|
||||
model: "deepseek/deepseek-v4-pro",
|
||||
stream: false,
|
||||
credentials: { apiKey: "cc_test_key" },
|
||||
@@ -135,4 +133,4 @@ test("#5166 user message with mixed parts (text + image_url) keeps all parts", a
|
||||
assert.equal(parts.length, 2, "text + image both preserved");
|
||||
assert.equal(parts[0].text, "Describe this:");
|
||||
assert.equal(parts[1].type, "image_url");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user