Files
openclaw/src/plugins/startup-trace-segment.test.ts
samzong 1d121c1f08 chore(gateway): add startup trace attribution (#81738)
Adds owner-level startup trace attribution for gateway auth, plugin loading, lookup counts, and plugin sidecar services.

Verification:
- node scripts/run-vitest.mjs src/plugins/startup-trace-segment.test.ts src/plugins/services.test.ts src/plugins/loader.test.ts src/gateway/server-startup-config.secrets.test.ts
- pnpm build
- pnpm check

CI override:
- Red checks are unrelated baseline noise. The failed CI shard is src/cli/plugins-install-persist.test.ts, which fails on origin/main 336ba2a2b3 with the same missing resolveIsNixMode mock export. PR #81738 touches gateway/plugin startup trace files and CHANGELOG.md, not the failing CLI plugin install test.

Thanks @samzong.

Co-authored-by: samzong <13782141+samzong@users.noreply.github.com>
2026-05-14 16:50:08 +08:00

26 lines
738 B
TypeScript

import { describe, expect, it } from "vitest";
import { encodeStartupTraceSegment } from "./startup-trace-segment.js";
describe("encodeStartupTraceSegment", () => {
it("keeps distinct trace owner ids non-colliding", () => {
const encoded = [
encodeStartupTraceSegment("plugin:test"),
encodeStartupTraceSegment("plugin_test"),
encodeStartupTraceSegment("service/a"),
encodeStartupTraceSegment("service_a"),
encodeStartupTraceSegment(""),
encodeStartupTraceSegment("~"),
];
expect(encoded).toEqual([
"plugin~003Atest",
"plugin_test",
"service~002Fa",
"service_a",
"~",
"~007E",
]);
expect(new Set(encoded).size).toBe(encoded.length);
});
});