Skip to content

Commit 1a51be6

Browse files
committed
fix(review): keep previous findings section-scoped
1 parent d98977d commit 1a51be6

2 files changed

Lines changed: 17 additions & 21 deletions

File tree

‎src/clawsweeper.ts‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,23 +3630,6 @@ function previousReviewProofStatus(body: string): string {
36303630
return firstMergeReadinessLine(body, "Proof:");
36313631
}
36323632

3633-
function previousReviewFindings(body: string): Array<{ priority: string; title: string }> {
3634-
return body
3635-
.split(/\r?\n/)
3636-
.map((line) => line.trim())
3637-
.flatMap((line) => {
3638-
if (!line.startsWith("- [P")) return [];
3639-
const close = line.indexOf("]");
3640-
if (close < 5) return [];
3641-
const priority = line.slice(3, close);
3642-
if (!/^P[0-3]$/.test(priority)) return [];
3643-
const rest = line.slice(close + 1).trim();
3644-
const dash = minNonNegative([rest.indexOf(" - "), rest.indexOf(" — ")]);
3645-
const title = (dash < 0 ? rest : rest.slice(0, dash)).trim();
3646-
return title ? [{ priority, title }] : [];
3647-
});
3648-
}
3649-
36503633
function reviewHistoryFindings(
36513634
cycle: ReviewHistoryCycle | undefined,
36523635
): Array<{ priority: string; title: string }> {
@@ -3689,9 +3672,7 @@ function extractLatestClawSweeperReview(
36893672
nextStep:
36903673
firstNonEmptyLine(markdownSection(body, "Next step before merge")) ||
36913674
firstNonEmptyLine(markdownSection(body, "Next step")),
3692-
findings: currentCycle
3693-
? previousReviewFindings(body)
3694-
: reviewHistoryFindings(latestCompletedCycle),
3675+
findings: reviewHistoryFindings(latestCompletedCycle),
36953676
earlierReviewCycles,
36963677
completedReviewCycles: history.totalCompletedCycles + (currentCycle ? 1 : 0),
36973678
commentId: comment.id,

‎test/review-history.test.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,19 @@ test("latest review extraction exposes earlier cycles and a cycle count", () =>
445445
],
446446
totalCompletedCycles: 1,
447447
});
448-
const body = `${previousDurableComment()}\n\n${ledger}`;
448+
const currentComment = previousDurableComment().replace(
449+
"**Review findings**",
450+
[
451+
"**Risk before merge**",
452+
"- [P1] Durable comments are compatibility-sensitive.",
453+
"",
454+
"**Next step before merge**",
455+
"- [P2] Ask a maintainer to accept the ledger contract.",
456+
"",
457+
"**Review findings**",
458+
].join("\n"),
459+
);
460+
const body = `${currentComment}\n\n${ledger}`;
449461
const review = extractLatestClawSweeperReviewForTest(
450462
[
451463
{
@@ -464,6 +476,9 @@ test("latest review extraction exposes earlier cycles and a cycle count", () =>
464476
assert.equal(review?.completedReviewCycles, 2);
465477
assert.equal(review?.earlierReviewCycles.length, 1);
466478
assert.equal(review?.earlierReviewCycles[0]?.sha, "aaa111");
479+
assert.deepEqual(review?.findings, [
480+
{ priority: "P1", title: "Drop the stale cache before rebuild" },
481+
]);
467482
});
468483

469484
test("stale durable comments expose the latest completed cycle from preserved history", () => {

0 commit comments

Comments
 (0)