Files
PaperClipAI/ui/src/lib/honeycomb-run-link.test.ts
T
DottaandPaperclip f53db0c70f perf(server): overlap OpenCode setup and trace reply recovery (#18367)
Overlap eligible OpenCode GitHub and assigned MCP preparation. Trace deferred reply discovery and recovery, and forward the native GitHub transport recorder.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-30 15:21:05 -05:00

43 lines
1.6 KiB
TypeScript

import { webcrypto } from "node:crypto";
import { describe, expect, it } from "vitest";
import {
HONEYCOMB_RUN_HASH_ATTRIBUTE,
buildHoneycombRunQueryUrl,
hashPaperclipRunId,
} from "./honeycomb-run-link";
describe("Honeycomb run links", () => {
it("uses the same 12-character SHA-256 run hash as the tracer", async () => {
await expect(
hashPaperclipRunId("abc", webcrypto.subtle as unknown as SubtleCrypto),
).resolves.toBe("ba7816bf8f01");
});
it("finds native and legacy root spans for the exact run with clickable trace-id breakdowns", () => {
const url = new URL(buildHoneycombRunQueryUrl("ba7816bf8f01"));
const query = JSON.parse(url.searchParams.get("query") ?? "null") as {
calculations: Array<{ op: string }>;
breakdowns: string[];
filters: Array<{ column: string; op: string; value: string | string[] }>;
filter_combination: string;
};
expect(url.origin).toBe("https://ui.honeycomb.io");
expect(url.pathname).toBe(
"/paperclip/environments/test/datasets/paperclip/",
);
expect(query.calculations).toEqual([{ op: "COUNT" }]);
expect(query.breakdowns).toEqual(["trace.trace_id"]);
expect(query.filter_combination).toBe("AND");
expect(query.filters).toEqual([
{ column: "service.name", op: "=", value: "paperclip" },
{ column: "name", op: "in", value: ["task.run", "task.provider_session", "task.execution_attempt", "task.workspace_finalization", "task.response_presentation"] },
{
column: HONEYCOMB_RUN_HASH_ATTRIBUTE,
op: "=",
value: "ba7816bf8f01",
},
]);
});
});