co-maintainer 0.6.7 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "co-maintainer",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "An imitator of yours, A PR review tool like co-maintainer.",
5
5
  "keywords": [
6
6
  "ai",
@@ -28,14 +28,19 @@ export declare function splitInline(findings: ParsedFinding[], files: Json[]): {
28
28
  export declare function reviewEvent(findingsCount: number): "REQUEST_CHANGES" | "COMMENT";
29
29
  /** The GitHub review event for a set of stored findings.
30
30
  *
31
- * `model` keeps the 0.4.13 behavior: any finding requests changes, because the
32
- * model's label already decided. `severity` ignores that label and requests
33
- * changes only for a P0 or P1, so the same finding set always yields the same
34
- * event. */
31
+ * Only open findings count. A re-review that closed the last finding used to
32
+ * request changes from the closed row while its body said "No actionable
33
+ * findings", so a review with no open finding approves.
34
+ *
35
+ * `model` keeps the 0.4.13 behavior: any open finding requests changes, because
36
+ * the model's label already decided. `severity` ignores that label and
37
+ * requests changes only for a P0 or P1, so the same finding set always yields
38
+ * the same event. */
35
39
  export declare function appReviewEvent(findings: {
36
40
  severity: string;
37
41
  title: string;
38
- }[], mode?: ReviewBlocking): "REQUEST_CHANGES" | "COMMENT";
42
+ state?: string;
43
+ }[], mode?: ReviewBlocking): "REQUEST_CHANGES" | "COMMENT" | "APPROVE";
39
44
  export interface ReviewMetadata {
40
45
  jobId: string;
41
46
  model: string;
@@ -141,16 +141,21 @@ export function reviewEvent(findingsCount) {
141
141
  }
142
142
  /** The GitHub review event for a set of stored findings.
143
143
  *
144
- * `model` keeps the 0.4.13 behavior: any finding requests changes, because the
145
- * model's label already decided. `severity` ignores that label and requests
146
- * changes only for a P0 or P1, so the same finding set always yields the same
147
- * event. */
144
+ * Only open findings count. A re-review that closed the last finding used to
145
+ * request changes from the closed row while its body said "No actionable
146
+ * findings", so a review with no open finding approves.
147
+ *
148
+ * `model` keeps the 0.4.13 behavior: any open finding requests changes, because
149
+ * the model's label already decided. `severity` ignores that label and
150
+ * requests changes only for a P0 or P1, so the same finding set always yields
151
+ * the same event. */
148
152
  export function appReviewEvent(findings, mode = DEFAULT_REVIEW_BLOCKING) {
149
- if (findings.length === 0)
150
- return "COMMENT";
153
+ const open = findings.filter((row) => row.state !== "closed");
154
+ if (open.length === 0)
155
+ return "APPROVE";
151
156
  if (mode === "model")
152
157
  return "REQUEST_CHANGES";
153
- const blocking = findings.some((row) => isBlocking(mode, { severity: row.severity, text: row.title }));
158
+ const blocking = open.some((row) => isBlocking(mode, { severity: row.severity, text: row.title }));
154
159
  return reviewEvent(blocking ? 1 : 0);
155
160
  }
156
161
  export function formatDuration(ms) {
@@ -367,16 +372,18 @@ async function updateCheck(client, job, checkRunId, body, log) {
367
372
  }
368
373
  }
369
374
  async function finishCheck(client, job, checkRunId, conclusion, title, findings, log) {
375
+ // A closed finding was fixed; counting it would report work that is done.
376
+ const open = findings.filter((finding) => finding.state !== "closed");
370
377
  await updateCheck(client, job, checkRunId, {
371
378
  status: "completed",
372
379
  conclusion,
373
380
  completed_at: new Date().toISOString(),
374
381
  output: {
375
382
  title: humanCopy(title),
376
- summary: humanCopy(findings.length === 0
383
+ summary: humanCopy(open.length === 0
377
384
  ? "No actionable findings."
378
- : `${findings.length} finding(s) reported.`),
379
- annotations: checkAnnotations(findings),
385
+ : `${open.length} finding(s) reported.`),
386
+ annotations: checkAnnotations(open),
380
387
  },
381
388
  }, log);
382
389
  }
@@ -814,7 +821,8 @@ async function runReviewJobCore(job, log, client, ai) {
814
821
  durationMs: Date.now() - startedAt,
815
822
  }, options.reviewBlocking);
816
823
  await resolveFailureNote(github, job, reviewId, log);
817
- await finishCheck(github, job, checkRunId, totalFindings === 0 ? "success" : "neutral", totalFindings === 0 ? "Review completed" : "Review findings", listFindingsForReview(reviewId), log);
824
+ const openFindings = totalFindings - closedCount;
825
+ await finishCheck(github, job, checkRunId, openFindings === 0 ? "success" : "neutral", openFindings === 0 ? "Review completed" : "Review findings", listFindingsForReview(reviewId), log);
818
826
  }
819
827
  export function registerReviewJobHandler() {
820
828
  registerHandler("review", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "co-maintainer",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "An imitator of yours, A PR review tool like co-maintainer.",
5
5
  "keywords": [
6
6
  "ai",