mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
Resynced onto the release tip. Two fixes applied during boarding: (1) the branch forked before the recent optionalDependencies placement of @huggingface/transformers and onnxruntime-node — its own diff re-added both into "dependencies" as duplicates alongside the real new dependency (react18-json-view); removed the duplicates, ran npm install to sync the lockfile. (2) config/quality/dependency-allowlist.json referenced the wrong package name (react-json-view-lite, an earlier iteration per the PR body) — the code actually imports react18-json-view; fixed the allowlist entry to match. RequestLoggerDetail.tsx crossed its frozen file-size cap (1018->1111); rebaselined with a note — the PR does split out the new logic (RequestLoggerDetail.sections.tsx, JsonTreeExpandControls.tsx, useTimestampTitles.ts, jsonTreeExpandStore.ts, all well under cap), the growth here is irreducible wiring. typecheck:core, check:dashboard-typecheck, check:file-size, check-deps all green after resync; 8/8 vitest + 11/11 native tests pass. Nice, well-structured 6-commit feature with full i18n and good test coverage. Thanks!
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { shortCallId } from "../../../src/shared/utils/formatting.ts";
|
|
|
|
// Regression guard: naive id.slice(0, 8) truncation showed as little as 3
|
|
// significant characters for ids with decorative prefixes (call-, call_call-,
|
|
// etc.), making tool-call/tool-result ids visually indistinguishable in the
|
|
// conversation context view. shortCallId finds the actual guid/hex entropy
|
|
// and truncates that instead, git-log-short-hash style.
|
|
|
|
test("extracts a git-log-style short id from a real UUID-shaped call id", () => {
|
|
assert.equal(shortCallId("call-bf7c895d-ae74-421c-890b-6f47eab77508"), "bf7c895");
|
|
});
|
|
|
|
test("extracts the first uuid segment from a composite/doubled-prefix id", () => {
|
|
assert.equal(
|
|
shortCallId("call_call-c5602375-cb46-40e8-867a-4b6ac50f6d2d_fc_cal_f08ecb5ec5"),
|
|
"c560237"
|
|
);
|
|
});
|
|
|
|
test("falls back to a leading hex run when there is no full uuid", () => {
|
|
assert.equal(shortCallId("toolu_01a2b3c4d5e6f7089900"), "01a2b3c");
|
|
});
|
|
|
|
test("falls back to a plain slice when the id has no recognizable hex/uuid segment", () => {
|
|
assert.equal(shortCallId("call_1"), "call_1");
|
|
});
|
|
|
|
test("respects a custom length", () => {
|
|
assert.equal(shortCallId("call-bf7c895d-ae74-421c-890b-6f47eab77508", 4), "bf7c");
|
|
});
|
|
|
|
test("returns an empty string for missing input", () => {
|
|
assert.equal(shortCallId(null), "");
|
|
assert.equal(shortCallId(undefined), "");
|
|
assert.equal(shortCallId(""), "");
|
|
});
|