mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Release v3.8.42 — full CHANGELOG in CHANGELOG.md. CI: 103 checks green incl. CodeQL (all languages), Semgrep, all 8 unit shards, coverage, Node 24 compat, and integration tests. Full unit suite validated locally: 19437 pass / 0 fail. The 3 red checks are advisory and do not gate main (no required status checks): SonarCloud/SonarQube new-code coverage gate, and PR Test Policy (test-masking detector flagging the legitimate dead-Phind provider removal in #5530 — reviewed, correct). Includes cycle-close reconciliation + repair of inherited base-red tests from #5480/#5527/#5427/#5521 that the PR->release fast-path did not exercise.
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { describe, it } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { analyzePrefix, generatePromptCacheKey } from "../../src/lib/promptCache";
|
|
|
|
describe("prompt cache prefix analyzer", () => {
|
|
it("captures stable system prefixes and derives a cache key", () => {
|
|
const messages = [
|
|
{ role: "system", content: "You are helpful." },
|
|
{ role: "user", content: "Hello" },
|
|
];
|
|
|
|
const analysis = analyzePrefix(messages);
|
|
|
|
assert.equal(analysis.prefixEndIdx, 0);
|
|
assert.equal(analysis.prefixType, "system_only");
|
|
assert.equal(analysis.confidence, 0.9);
|
|
assert.ok(analysis.prefixTokens > 0);
|
|
assert.match(generatePromptCacheKey(messages), /^omni-[a-f0-9]{32}$/);
|
|
});
|
|
|
|
it("keeps the legacy empty-content key when there is no prefix", () => {
|
|
const messages = [{ role: "user", content: "Hello" }];
|
|
|
|
const analysis = analyzePrefix(messages);
|
|
|
|
assert.equal(analysis.prefixEndIdx, -1);
|
|
assert.equal(generatePromptCacheKey(messages), "omni-e3b0c44298fc1c149afbf4c8996fb924");
|
|
});
|
|
});
|