mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 10:44:52 +01:00
fix: include REST creation recipients in composer assignment history
This commit is contained in:
1 parent
c41b6bcc12
commit
5a7d5e98a8
5 files changed
+42
-4
No files matched your search
@@ -78,6 +78,7 @@ describeEmbeddedPostgres("issue comment attribution and patch audit routes", ()
|
||||
async function seed() {
|
||||
const company = await db.insert(companies).values({
|
||||
name: "Attribution Company",
|
||||
issueCounter: 2,
|
||||
issuePrefix: `AT${randomUUID().replaceAll("-", "").slice(0, 6).toUpperCase()}`,
|
||||
}).returning().then((rows) => rows[0]!);
|
||||
const [actorAgent, targetAgent] = await db.insert(agents).values(["Actor", "Target"].map((name) => ({
|
||||
@@ -162,6 +163,27 @@ describeEmbeddedPostgres("issue comment attribution and patch audit routes", ()
|
||||
};
|
||||
}
|
||||
|
||||
it("records the human recipient for REST task and child creation", async () => {
|
||||
const fixture = await seed();
|
||||
const app = await createApp(db, agentActor(fixture));
|
||||
for (const [path, action] of [
|
||||
[`/api/companies/${fixture.company.id}/issues`, "issue.created"],
|
||||
[`/api/issues/${fixture.issue.id}/children`, "issue.child_created"],
|
||||
]) {
|
||||
const response = await request(app).post(path!).send({
|
||||
title: "Task for the human", status: "todo", assigneeUserId: fixture.responsibleUserId,
|
||||
});
|
||||
expect(response.status, JSON.stringify(response.body)).toBe(201);
|
||||
const events = await db.select().from(activityLog).where(and(
|
||||
eq(activityLog.entityId, response.body.id), eq(activityLog.action, action!),
|
||||
));
|
||||
expect(events).toEqual([expect.objectContaining({
|
||||
actorType: "agent", actorId: fixture.actorAgent.id,
|
||||
details: expect.objectContaining({ assigneeAgentId: null, assigneeUserId: fixture.responsibleUserId }),
|
||||
})]);
|
||||
}
|
||||
});
|
||||
|
||||
it("attributes foreign-issue agent comments and emits complete agent and human PATCH receipts", async () => {
|
||||
const fixture = await seed();
|
||||
const agentApp = await createApp(db, agentActor(fixture));
|
||||
|
||||
@@ -653,7 +653,7 @@ const attachmentArtifactMetadataInputSchema = z
|
||||
.passthrough();
|
||||
|
||||
function buildCreateIssueActivityStatusDetails(
|
||||
issue: { assigneeAgentId: string | null; status: string },
|
||||
issue: { assigneeAgentId: string | null; assigneeUserId: string | null; status: string },
|
||||
res: Response,
|
||||
) {
|
||||
const statusDefault = res.locals.createIssueStatusDefault as
|
||||
@@ -661,6 +661,8 @@ function buildCreateIssueActivityStatusDetails(
|
||||
const assignmentWakeSkipped =
|
||||
!issue.assigneeAgentId || issue.status === "backlog";
|
||||
return {
|
||||
assigneeAgentId: issue.assigneeAgentId,
|
||||
assigneeUserId: issue.assigneeUserId,
|
||||
status: issue.status,
|
||||
statusDefaulted: statusDefault?.defaulted ?? false,
|
||||
statusDefaultReason: statusDefault?.reason ?? "explicit",
|
||||
|
||||
Reference in new issue
Block a user