fix: filter out resolved threads in getPendingComments
The method name implies it should only return unresolved/pending review threads. The isResolved data was already fetched via GraphQL but was not being filtered on, causing resolved threads to be included in results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
586079647d
commit
d49fdd7bc4
|
|
@ -370,6 +370,7 @@ function createGitHubSCM(): SCM {
|
|||
|
||||
return threads
|
||||
.filter((t) => {
|
||||
if (t.isResolved) return false; // only pending (unresolved) threads
|
||||
const c = t.comments.nodes[0];
|
||||
if (!c) return false; // skip threads with no comments
|
||||
const author = c.author?.login ?? "";
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ describe("scm-github plugin", () => {
|
|||
};
|
||||
}
|
||||
|
||||
it("returns non-bot comments with isResolved from GraphQL", async () => {
|
||||
it("returns only unresolved non-bot comments from GraphQL", async () => {
|
||||
mockGh(
|
||||
makeGraphQLThreads([
|
||||
{ isResolved: false, id: "C1", author: "alice", body: "Fix line 10", path: "src/foo.ts", line: 10, url: "https://github.com/c/1", createdAt: "2025-01-01T00:00:00Z" },
|
||||
|
|
@ -441,9 +441,8 @@ describe("scm-github plugin", () => {
|
|||
);
|
||||
|
||||
const comments = await scm.getPendingComments(pr);
|
||||
expect(comments).toHaveLength(2);
|
||||
expect(comments).toHaveLength(1);
|
||||
expect(comments[0]).toMatchObject({ id: "C1", author: "alice", isResolved: false });
|
||||
expect(comments[1]).toMatchObject({ id: "C2", author: "bob", isResolved: true });
|
||||
});
|
||||
|
||||
it("filters out bot comments", async () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue