mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-15 11:22:15 +03:00
Validado em lote numa worktree combinada com os 10 PRs desta leva sobre o tip de `release/v3.8.51`: `typecheck:core` limpo, `check-file-size` OK e **241/242** nos 29 arquivos de teste que os PRs tocam. A única "falha" não é falha: `tests/unit/autoCombo/strict-zero-cost-filter.test.ts` é um teste em estilo Vitest que eu incluí por engano na invocação do runner nativo do Node — ele quebra no import (`@vitest/runner`), não numa asserção. Ao investigar, descobri que esse arquivo não roda em nenhum dos dois runners hoje (o glob do `test:unit` não lista `autoCombo` e o `include` do Vitest só pega `.tsx` nessa pasta); é um problema pré-existente do repositório, sem relação com esta leva, e vou registrá-lo separadamente. O #12636 conflitava apenas na lista de testes do `@omniroute/opencode-plugin/package.json`, de forma aditiva: o tip já tinha `models-fetcher.test.ts` (do #12607, irmão desta mesma leva) e o #12636 acrescenta `telemetry.test.ts`. Fiz a união dos dois lados (25 arquivos contra 24 de cada) em vez de escolher um, o que teria removido um arquivo da suíte do plugin em silêncio. Obrigado, @RaviTharuma.
64 lines
2.3 KiB
TypeScript
64 lines
2.3 KiB
TypeScript
import test from "node:test";
|
||
import assert from "node:assert/strict";
|
||
import { readFileSync } from "node:fs";
|
||
|
||
const dockerGuide = readFileSync(
|
||
new URL("../../docs/guides/DOCKER_GUIDE.md", import.meta.url),
|
||
"utf8"
|
||
);
|
||
const envDoc = readFileSync(
|
||
new URL("../../docs/reference/ENVIRONMENT.md", import.meta.url),
|
||
"utf8"
|
||
);
|
||
|
||
test("DOCKER_GUIDE documents N independent DATA_DIRs as the large-job scale-out (#11024)", () => {
|
||
assert.match(dockerGuide, /## Scale-out: N independent processes/);
|
||
assert.match(dockerGuide, /DATA_DIR/);
|
||
assert.match(dockerGuide, /replicas > 1/);
|
||
assert.match(dockerGuide, /QUOTA_STORE_DRIVER=redis/);
|
||
assert.match(dockerGuide, /#8075/);
|
||
assert.doesNotMatch(
|
||
dockerGuide,
|
||
/deploy:\s*\n\s*replicas:\s*2/,
|
||
"must not show replicas: 2 as the scale-out recipe"
|
||
);
|
||
});
|
||
|
||
test("ENVIRONMENT.md points CHAT_MAX_HEAVY_IN_FLIGHT at per-process V8, not host RAM (#11024)", () => {
|
||
const row = envDoc
|
||
.split("\n")
|
||
.find((line) => line.includes("`OMNIROUTE_CHAT_MAX_HEAVY_IN_FLIGHT`"));
|
||
assert.ok(row);
|
||
assert.match(row, /one process|per process|V8/i);
|
||
assert.match(row, /DATA_DIR|#11024/);
|
||
});
|
||
|
||
test("DOCKER_GUIDE documents the one-process long /v1/responses recipe (healthy-headroom, not max 2)", () => {
|
||
assert.match(dockerGuide, /One-process: more than two long/);
|
||
assert.match(dockerGuide, /tryAcquireHealthyHeadroom/);
|
||
assert.match(dockerGuide, /OMNIROUTE_CHAT_LARGE_BODY_BYTES/);
|
||
assert.match(dockerGuide, /40–50|40-50/);
|
||
assert.match(dockerGuide, /memory-budget/);
|
||
assert.match(dockerGuide, /#10110|#10437/);
|
||
assert.match(dockerGuide, /replicas > 1/);
|
||
});
|
||
|
||
test("ENVIRONMENT.md documents LARGE_BODY_BYTES healthy-headroom and no hard max-2", () => {
|
||
const large = envDoc
|
||
.split("\n")
|
||
.find((line) => line.startsWith("| `OMNIROUTE_CHAT_LARGE_BODY_BYTES`"));
|
||
const heavy = envDoc
|
||
.split("\n")
|
||
.find((line) => line.startsWith("| `OMNIROUTE_CHAT_MAX_HEAVY_IN_FLIGHT`"));
|
||
const headroom = envDoc
|
||
.split("\n")
|
||
.find((line) => line.startsWith("| `OMNIROUTE_CHAT_ADMISSION_HEALTHY_HEADROOM`"));
|
||
assert.ok(large);
|
||
assert.ok(heavy);
|
||
assert.ok(headroom);
|
||
assert.match(large, /healthy-headroom|#10437/);
|
||
assert.match(large, /#10110|#7849/);
|
||
assert.match(heavy, /memory-budget|not a hard product max|not a hard “max 2”/i);
|
||
assert.match(headroom, /BYTE|admitChatRequest/);
|
||
});
|