mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 02:20:38 +09:00
Track blocker and review activity events
This commit is contained in:
parent
8894520ed0
commit
3baebee2df
6 changed files with 719 additions and 151 deletions
60
ui/src/lib/activity-format.test.ts
Normal file
60
ui/src/lib/activity-format.test.ts
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import type { Agent } from "@paperclipai/shared";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { formatActivityVerb, formatIssueActivityAction } from "./activity-format";
|
||||
|
||||
describe("activity formatting", () => {
|
||||
const agentMap = new Map<string, Agent>([
|
||||
["agent-reviewer", { id: "agent-reviewer", name: "Reviewer Bot" } as Agent],
|
||||
["agent-approver", { id: "agent-approver", name: "Approver Bot" } as Agent],
|
||||
]);
|
||||
|
||||
it("formats blocker activity using linked issue identifiers", () => {
|
||||
const details = {
|
||||
addedBlockedByIssues: [
|
||||
{ id: "issue-2", identifier: "PAP-22", title: "Blocked task" },
|
||||
],
|
||||
removedBlockedByIssues: [],
|
||||
};
|
||||
|
||||
expect(formatActivityVerb("issue.blockers_updated", details)).toBe("added blocker PAP-22 to");
|
||||
expect(formatIssueActivityAction("issue.blockers_updated", details)).toBe("added blocker PAP-22");
|
||||
});
|
||||
|
||||
it("formats reviewer activity using agent names", () => {
|
||||
const details = {
|
||||
addedParticipants: [
|
||||
{ type: "agent", agentId: "agent-reviewer", userId: null },
|
||||
],
|
||||
removedParticipants: [],
|
||||
};
|
||||
|
||||
expect(formatActivityVerb("issue.reviewers_updated", details, { agentMap })).toBe("added reviewer Reviewer Bot to");
|
||||
expect(formatIssueActivityAction("issue.reviewers_updated", details, { agentMap })).toBe("added reviewer Reviewer Bot");
|
||||
});
|
||||
|
||||
it("formats approver removals using user-aware labels", () => {
|
||||
const details = {
|
||||
addedParticipants: [],
|
||||
removedParticipants: [
|
||||
{ type: "user", agentId: null, userId: "local-board" },
|
||||
],
|
||||
};
|
||||
|
||||
expect(formatActivityVerb("issue.approvers_updated", details)).toBe("removed approver Board from");
|
||||
expect(formatIssueActivityAction("issue.approvers_updated", details)).toBe("removed approver Board");
|
||||
});
|
||||
|
||||
it("falls back to updated wording when reviewers are both added and removed", () => {
|
||||
const details = {
|
||||
addedParticipants: [
|
||||
{ type: "agent", agentId: "agent-reviewer", userId: null },
|
||||
],
|
||||
removedParticipants: [
|
||||
{ type: "agent", agentId: "agent-approver", userId: null },
|
||||
],
|
||||
};
|
||||
|
||||
expect(formatActivityVerb("issue.reviewers_updated", details, { agentMap })).toBe("updated reviewers on");
|
||||
expect(formatIssueActivityAction("issue.reviewers_updated", details, { agentMap })).toBe("updated reviewers");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue