mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 01:50:39 +09:00
Broaden comment matches in issue search
This commit is contained in:
parent
fcab770518
commit
1f78e55072
7 changed files with 267 additions and 26 deletions
|
|
@ -298,6 +298,51 @@ describeEmbeddedPostgres("issueService.list participantAgentId", () => {
|
|||
expect(result.map((issue) => issue.id)).toEqual([titleMatchId, descriptionMatchId]);
|
||||
});
|
||||
|
||||
it("ranks comment matches ahead of description-only matches", async () => {
|
||||
const companyId = randomUUID();
|
||||
const commentMatchId = randomUUID();
|
||||
const descriptionMatchId = randomUUID();
|
||||
|
||||
await db.insert(companies).values({
|
||||
id: companyId,
|
||||
name: "Paperclip",
|
||||
issuePrefix: `T${companyId.replace(/-/g, "").slice(0, 6).toUpperCase()}`,
|
||||
requireBoardApprovalForNewAgents: false,
|
||||
});
|
||||
|
||||
await db.insert(issues).values([
|
||||
{
|
||||
id: commentMatchId,
|
||||
companyId,
|
||||
title: "Comment match",
|
||||
status: "todo",
|
||||
priority: "medium",
|
||||
},
|
||||
{
|
||||
id: descriptionMatchId,
|
||||
companyId,
|
||||
title: "Description match",
|
||||
description: "Contains pull/3303 in the description",
|
||||
status: "todo",
|
||||
priority: "medium",
|
||||
},
|
||||
]);
|
||||
|
||||
await db.insert(issueComments).values({
|
||||
companyId,
|
||||
issueId: commentMatchId,
|
||||
body: "Reference: https://github.com/paperclipai/paperclip/pull/3303",
|
||||
});
|
||||
|
||||
const result = await svc.list(companyId, {
|
||||
q: "pull/3303",
|
||||
limit: 2,
|
||||
includeRoutineExecutions: true,
|
||||
});
|
||||
|
||||
expect(result.map((issue) => issue.id)).toEqual([commentMatchId, descriptionMatchId]);
|
||||
});
|
||||
|
||||
it("accepts issue identifiers through getById", async () => {
|
||||
const companyId = randomUUID();
|
||||
const issueId = randomUUID();
|
||||
|
|
|
|||
|
|
@ -997,8 +997,8 @@ export function issueService(db: Db) {
|
|||
WHEN ${titleContainsMatch} THEN 1
|
||||
WHEN ${identifierStartsWithMatch} THEN 2
|
||||
WHEN ${identifierContainsMatch} THEN 3
|
||||
WHEN ${descriptionContainsMatch} THEN 4
|
||||
WHEN ${commentContainsMatch} THEN 5
|
||||
WHEN ${commentContainsMatch} THEN 4
|
||||
WHEN ${descriptionContainsMatch} THEN 5
|
||||
ELSE 6
|
||||
END
|
||||
`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue