ci: fix the review continuation the reviewer found
The review switch read the previous-review record before it was fetched, so every automatic review would have thrown before publishing anything. Also fixed: a reused checkout now drops files the new head deleted; the round loop merges every round's findings instead of keeping only the last; the session cleanup honours its keep switch and leaves other files alone; the state cache keeps one entry per pull request instead of one per run; and the job timeout covers all three review rounds. A resumed review still keeps its full budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fcbc77af57
commit
d28b97c4ea
3 files changed
+60
-20
No files matched your search
@@ -17,7 +17,9 @@ import {
|
||||
normalizeLLMBaseURL,
|
||||
encodeRepoPath,
|
||||
parseOCRJSON,
|
||||
previousReviewFor,
|
||||
readResumeState,
|
||||
resumeTarget,
|
||||
resumeSessionDir,
|
||||
revalidationOf,
|
||||
writeResumeState,
|
||||
@@ -527,3 +529,19 @@ test("an incomplete previous review is recognised and never anchors an increment
|
||||
const complete = [{ user: { login: "reims-go-reviewer[bot]" }, state: "COMMENTED", commit_id: B, body: marker.replace(',"incomplete":true', '') + "\n## 自动代码审核" }];
|
||||
assert.equal(extractPreviousReview(complete, [], "reims-go-reviewer[bot]").incomplete, false);
|
||||
});
|
||||
|
||||
test("only the same revision may continue an incomplete review", () => {
|
||||
const incomplete = { incomplete: true, headSha: B };
|
||||
assert.equal(resumeTarget(incomplete, B, true), true);
|
||||
assert.equal(resumeTarget(incomplete, B.toUpperCase(), true), true);
|
||||
assert.equal(resumeTarget(incomplete, B, false), false, "the switch is off by default");
|
||||
assert.equal(resumeTarget(incomplete, A, true), false, "a new push starts a full review");
|
||||
assert.equal(resumeTarget({ incomplete: false, headSha: B }, B, true), false);
|
||||
assert.equal(resumeTarget(null, B, true), false);
|
||||
assert.equal(previousReviewFor(incomplete, false), null, "an unfinished review cannot anchor an incremental range");
|
||||
assert.equal(previousReviewFor(incomplete, true), incomplete);
|
||||
assert.equal(previousReviewFor({ incomplete: false }, false)?.incomplete, false);
|
||||
assert.equal(previousReviewFor(null, true), null);
|
||||
const range = previousReviewFor(incomplete, resumeTarget(incomplete, B, true));
|
||||
assert.equal(range, incomplete, "continuing keeps the range the review was computed over");
|
||||
});
|
||||
Reference in new issue
Block a user