mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 20:32:20 +03:00
* feat(dashboard): 9router-parity Routing Strategy card + provider/combo sticky override (#6678) Add a Routing Strategy settings card (Settings -> Routing) surfacing account round-robin/sticky-limit knobs plus a new combo-level sticky round-robin (comboStickyRoundRobinLimit), and a per-provider account-routing override (providerStrategies) wired into getProviderCredentials() ahead of the global fallback strategy. Rebased onto release/v3.8.47 (credit-preserving reconstruction: unrelated package.json/electron/proxyDispatcher drift from the PR's stale base was dropped, only the author's own 12 files were re-applied). Split ProviderAccountRoutingCard/RoutingStrategyCard into smaller hook+subcomponent pieces to stay under the frozen complexity/file-size gates; rebaselined ProviderDetailPageClient.tsx/auth.ts's frozen file-size caps for the small additive growth. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> * chore(quality): register combo-rr-sticky-9router.test.ts in stryker tap.testFiles (#6678) CI's Fast Quality Gates -> check:mutation-test-coverage --strict flagged the new test as missing from stryker.conf.json's tap.testFiles (it covers the mutated module open-sse/services/combo/rrState.ts). Adds the single entry, alphabetized next to the existing combo-rr-fallback-advance-948.test.ts. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> * fix(changelog): restore CHANGELOG bullets eaten by release sync Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> * fix(changelog): re-restore CHANGELOG bullet after further release sync Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> * fix(changelog): re-restore CHANGELOG bullet after further release sync Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com> Co-authored-by: SeaXen <SeaXen@users.noreply.github.com>
121 lines
4.3 KiB
TypeScript
121 lines
4.3 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
|
|
function readSrc(path: string): string {
|
|
return readFileSync(join(ROOT, path), "utf8");
|
|
}
|
|
|
|
function assertInOrder(source: string, labels: string[]) {
|
|
let lastIndex = -1;
|
|
for (const label of labels) {
|
|
const index = source.indexOf(label);
|
|
assert.notEqual(index, -1, `Expected to find ${label}`);
|
|
assert.ok(index > lastIndex, `Expected ${label} to appear after previous marker`);
|
|
lastIndex = index;
|
|
}
|
|
}
|
|
|
|
test("Appearance page keeps theme color above branding and removes sidebar item controls", () => {
|
|
const source = readSrc("src/app/(dashboard)/dashboard/settings/components/AppearanceTab.tsx");
|
|
|
|
assert.doesNotMatch(source, /SidebarVisibilitySetting/);
|
|
assertInOrder(source, ['t("themeAccent")', 't("whitelabeling")']);
|
|
});
|
|
|
|
test("Usage Token Buffer lives in AI settings instead of General storage", () => {
|
|
const aiPage = readSrc("src/app/(dashboard)/dashboard/settings/ai/page.tsx");
|
|
const generalStorage = readSrc(
|
|
"src/app/(dashboard)/dashboard/settings/components/SystemStorageTab.tsx"
|
|
);
|
|
|
|
assert.match(aiPage, /UsageTokenBufferTab/);
|
|
assert.doesNotMatch(generalStorage, /storageUsageTokenBuffer/);
|
|
});
|
|
|
|
test("Storage settings page uses the requested section order", () => {
|
|
const source = readSrc("src/app/(dashboard)/dashboard/settings/components/SystemStorageTab.tsx");
|
|
|
|
assertInOrder(source, [
|
|
't("databasePath")',
|
|
"{renderDatabaseStatistics()}",
|
|
't("export")',
|
|
't("maintenance")',
|
|
't("lastBackup")',
|
|
"{renderRetentionSettings()}",
|
|
"{renderOptimizationSettings()}",
|
|
"{renderCompressionAggregationSettings()}",
|
|
]);
|
|
assert.doesNotMatch(source, /debugToggle/);
|
|
});
|
|
|
|
test("Debug mode moved to the top of Advanced settings", () => {
|
|
const advancedPage = readSrc("src/app/(dashboard)/dashboard/settings/advanced/page.tsx");
|
|
|
|
assertInOrder(advancedPage, ["<DebugModeCard", "<PayloadRulesTab"]);
|
|
});
|
|
|
|
test("Log Tool Sources toggle is mounted in Advanced settings next to Debug mode", () => {
|
|
const advancedPage = readSrc("src/app/(dashboard)/dashboard/settings/advanced/page.tsx");
|
|
|
|
assertInOrder(advancedPage, ["<DebugModeCard", "<LogToolSourcesCard", "<PayloadRulesTab"]);
|
|
|
|
const card = readSrc(
|
|
"src/app/(dashboard)/dashboard/settings/components/LogToolSourcesCard.tsx"
|
|
);
|
|
assert.match(card, /t\("logToolSourcesToggle"\)/);
|
|
assert.match(card, /t\("logToolSourcesDescription"\)/);
|
|
assert.match(card, /logToolSources: value/);
|
|
|
|
const schema = readSrc("src/shared/validation/settingsSchemas.ts");
|
|
assert.match(schema, /logToolSources: z\.boolean\(\)\.optional\(\)/);
|
|
|
|
const en = readSrc("src/i18n/messages/en.json");
|
|
assert.match(en, /"logToolSourcesToggle": "Log Tool Sources"/);
|
|
});
|
|
|
|
test("Proxy Logs table uses the same blue row hover emphasis as Logs", () => {
|
|
const proxyLogger = readSrc("src/shared/components/ProxyLogger.tsx");
|
|
const requestLogger = readSrc("src/shared/components/RequestLoggerV2.tsx");
|
|
|
|
assert.match(proxyLogger, /hover:bg-sky-500\/10 dark:hover:bg-sky-400\/10/);
|
|
assert.match(requestLogger, /hover:bg-sky-500\/10 dark:hover:bg-sky-400\/10/);
|
|
assert.doesNotMatch(proxyLogger, /hover:bg-primary\/5/);
|
|
});
|
|
|
|
test("General settings navigation is labeled Storage in English", () => {
|
|
const en = readSrc("src/i18n/messages/en.json");
|
|
|
|
assert.match(en, /"settingsGeneral": "Storage"/);
|
|
assert.match(en, /"systemStorage": "Storage"/);
|
|
});
|
|
|
|
test("Global Routing page renders top-level modules in the requested order", () => {
|
|
const page = readSrc("src/app/(dashboard)/dashboard/settings/routing/page.tsx");
|
|
const routingTab = readSrc("src/app/(dashboard)/dashboard/settings/components/RoutingTab.tsx");
|
|
|
|
assertInOrder(page, [
|
|
"<RoutingStrategyCard",
|
|
"<ComboDefaultsTab",
|
|
"<ModelAliasesUnified",
|
|
"<FallbackChainsEditor",
|
|
"<ModelRoutingSection",
|
|
"<RoutingTab",
|
|
"<BackgroundDegradationTab",
|
|
]);
|
|
|
|
assertInOrder(routingTab, [
|
|
't("routingZeroConfigTitle")',
|
|
't("systemTransforms")',
|
|
't("cliFingerprint")',
|
|
't("routingClientCacheControlTitle")',
|
|
't("routingAntigravitySignatureTitle")',
|
|
't("lkgpToggleTitle")',
|
|
't("adaptiveVolumeRouting")',
|
|
]);
|
|
});
|