From 2e01d1fa00ef57ee370a67b11c3e1dfb1c8e35c2 Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 21 Apr 2026 07:28:20 -0500 Subject: [PATCH] Fix issue reference QA findings Co-Authored-By: Paperclip --- ui/src/components/IssueReferencePill.tsx | 5 +- .../components/IssueRelatedWorkPanel.test.tsx | 2 + ui/src/lib/optimistic-issue-runs.test.ts | 23 ------- ui/src/lib/remark-issue-references.ts | 64 ------------------- ui/src/pages/IssueDetail.tsx | 1 + 5 files changed, 7 insertions(+), 88 deletions(-) delete mode 100644 ui/src/lib/remark-issue-references.ts diff --git a/ui/src/components/IssueReferencePill.tsx b/ui/src/components/IssueReferencePill.tsx index d3014c5db1f..b2a74728788 100644 --- a/ui/src/components/IssueReferencePill.tsx +++ b/ui/src/components/IssueReferencePill.tsx @@ -9,14 +9,17 @@ export function IssueReferencePill({ issue: Pick; className?: string; }) { + const issueLabel = issue.identifier ?? issue.id; + return ( {issue.identifier ?? issue.title} diff --git a/ui/src/components/IssueRelatedWorkPanel.test.tsx b/ui/src/components/IssueRelatedWorkPanel.test.tsx index f5e09c6437d..f2ca0493dee 100644 --- a/ui/src/components/IssueRelatedWorkPanel.test.tsx +++ b/ui/src/components/IssueRelatedWorkPanel.test.tsx @@ -55,6 +55,8 @@ describe("IssueRelatedWorkPanel", () => { expect(html).toContain("Referenced by"); expect(html).toContain("PAP-22"); expect(html).toContain("PAP-33"); + expect(html).toContain('aria-label="Issue PAP-22: Downstream task"'); + expect(html).toContain('aria-label="Issue PAP-33: Upstream task"'); expect(html).toContain("plan"); expect(html).toContain("comment"); }); diff --git a/ui/src/lib/optimistic-issue-runs.test.ts b/ui/src/lib/optimistic-issue-runs.test.ts index dfae93f6742..f8614a64104 100644 --- a/ui/src/lib/optimistic-issue-runs.test.ts +++ b/ui/src/lib/optimistic-issue-runs.test.ts @@ -30,30 +30,7 @@ function createActiveRun(overrides: Partial = {}): ActiveRunF status: "running", startedAt: new Date("2026-04-08T21:00:00.000Z"), finishedAt: null, - error: null, - wakeupRequestId: null, - exitCode: null, - signal: null, - usageJson: { inputTokens: 1 }, - resultJson: { summary: "partial" }, - sessionIdBefore: null, - sessionIdAfter: null, - logStore: null, - logRef: null, - logBytes: null, - logSha256: null, - logCompressed: false, - stdoutExcerpt: null, - stderrExcerpt: null, - errorCode: null, - externalRunId: null, - processPid: null, - processStartedAt: null, - retryOfRunId: null, - processLossRetryCount: 0, - contextSnapshot: null, createdAt: new Date("2026-04-08T21:00:00.000Z"), - updatedAt: new Date("2026-04-08T21:00:00.000Z"), ...overrides, }; } diff --git a/ui/src/lib/remark-issue-references.ts b/ui/src/lib/remark-issue-references.ts deleted file mode 100644 index 38f71801753..00000000000 --- a/ui/src/lib/remark-issue-references.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { buildIssueReferenceHref, findIssueReferenceMatches } from "@paperclipai/shared"; - -type MdastNode = { - type?: string; - value?: string; - url?: string; - children?: MdastNode[]; -}; - -function replacementNodes(value: string): MdastNode[] { - const matches = findIssueReferenceMatches(value); - if (matches.length === 0) return [{ type: "text", value }]; - - const nodes: MdastNode[] = []; - let cursor = 0; - - for (const match of matches) { - if (match.index < cursor) continue; - if (match.index > cursor) { - nodes.push({ type: "text", value: value.slice(cursor, match.index) }); - } - nodes.push({ - type: "link", - url: buildIssueReferenceHref(match.identifier), - children: [{ type: "text", value: match.identifier }], - }); - cursor = match.index + match.length; - } - - if (cursor < value.length) { - nodes.push({ type: "text", value: value.slice(cursor) }); - } - - return nodes; -} - -function shouldSkipChildren(node: MdastNode): boolean { - return node.type === "link" || node.type === "inlineCode" || node.type === "code" || node.type === "definition"; -} - -function visit(node: MdastNode) { - if (!Array.isArray(node.children) || shouldSkipChildren(node)) return; - - for (let index = 0; index < node.children.length; index += 1) { - const child = node.children[index]; - if (!child) continue; - - if (child.type === "text" && typeof child.value === "string") { - const nodes = replacementNodes(child.value); - if (nodes.length === 1 && nodes[0]?.type === "text") continue; - node.children.splice(index, 1, ...nodes); - index += nodes.length - 1; - continue; - } - - visit(child); - } -} - -export function remarkIssueReferences() { - return (tree: MdastNode) => { - visit(tree); - }; -} diff --git a/ui/src/pages/IssueDetail.tsx b/ui/src/pages/IssueDetail.tsx index 25d917cb0d6..9bd278d45e3 100644 --- a/ui/src/pages/IssueDetail.tsx +++ b/ui/src/pages/IssueDetail.tsx @@ -96,6 +96,7 @@ import { Copy, EyeOff, Hexagon, + ListTree, MessageSquare, MoreHorizontal, MoreVertical,