Files
multica/packages/views/common/task-transcript/trace-issue-labels.test.ts
Jiayuan Zhang 028f3b4437 feat(issues): show agent execution inline in comment threads (#8131)
* feat(issues): show agent runs inline with comment replies

* fix(issues): unify run comment projection and preserve disclosure focus

* refactor(issues): replace nested run cards with inline status rows

* fix(issues): align thread roots with reply content

* style(issues): remove thread toggle background

* style(issues): group reaction picker with comment actions

* feat(issues): show readable issue references in run summaries

* style(issues): move completed run logs into comment headers

* style(issues): balance comment block vertical spacing

* style(issues): shimmer live agent progress text

* style(issues): unify comment action hover feedback

* style(issues): reveal comment actions on block hover

* fix(issues): move published reply activity into the header

* fix(issues): settle comment UI as soon as replies are published

* fix(issues): reveal comment log buttons on hover

* fix(issues): defer run placement until trigger comments arrive

* fix(issues): isolate agent comment queues by thread

* fix(issues): display pending runs in execution order

* fix(ci): align integration tests with thread-scoped queues

* fix(issues): fit run actions to narrow comment columns
2026-09-08 12:58:16 +08:00

44 lines
2.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { collectTraceIssueIds, replaceTraceIssueIds } from "./trace-issue-labels";
import { traceEventCopyText, traceEventDetail, traceToolArgSummary } from "./trace-event-presenter";
const issue = "01a07eca-8e82-775e-be06-e4a97ccfa299";
const other = "01a07cd3-f171-706d-9e76-b3428d0de333";
const thread = "01a07cd9-610f-7b89-98e2-a194339b1372";
const labels = new Map([[issue, "DEV-17"], [other, "DEV-14"]]);
describe("trace issue labels", () => {
it("resolves only issue targets, deduplicating commands and preserving comment IDs", () => {
expect(collectTraceIssueIds(issue, [
{ type: "tool_use", input: { command: `multica issue comment list '${issue}' --thread ${thread}` } },
{ type: "tool_use", input: { cmd: `multica issue get ${other.toUpperCase()} --output json` } },
{ type: "tool_use", input: { issue_id: other } },
{ type: "tool_use", input: { command: `multica issue comment update ${thread}` } },
{ type: "tool_result", output: `multica issue get ${thread}` },
{ type: "text", content: `multica issue get ${thread}` },
])).toEqual([issue, other]);
});
it("replaces exact known UUIDs case-insensitively and leaves unknown IDs intact", () => {
expect(replaceTraceIssueIds(`${issue.toUpperCase()} (${other}) --thread ${thread}`, labels))
.toBe(`DEV-17 (DEV-14) --thread ${thread}`);
expect(replaceTraceIssueIds(`prefix${issue} ${issue}-suffix ${issue}f`, labels))
.toBe(`prefix${issue} ${issue}-suffix ${issue}f`);
expect(replaceTraceIssueIds(issue, new Map())).toBe(issue);
});
it("formats before truncation without changing raw input, detail or copy text", () => {
const command = `multica issue update ${issue} --description '${other} ${issue} visible-tail'`;
const input = { command };
const event = { type: "tool_use", tool: "exec_command", input };
expect(traceToolArgSummary(input, { formatText: (text) => replaceTraceIssueIds(text, labels) }))
.toBe("multica issue update DEV-17 --description 'DEV-14 DEV-17 visible-tail'");
expect(traceToolArgSummary({ cmd: command }, { formatText: (text) => replaceTraceIssueIds(text, labels) }))
.toBe("multica issue update DEV-17 --description 'DEV-14 DEV-17 visible-tail'");
expect(input.command).toBe(command);
expect(traceEventDetail(event)).toEqual({ kind: "text", text: JSON.stringify(input, null, 2) });
expect(traceEventCopyText(event)).toContain(issue);
expect(traceEventCopyText(event)).not.toContain("DEV-17");
});
});