nisse-review: later reviews, replies, rounds, stop and review (M7.5)

Back on a PR it reviewed: a new head gets a later review of the commits
since (each one's diff, through the API) and of its earlier points; what
was said since gets replies, answered where it was said or skipped with a
reason. It signs off once and stays quiet while still happy. Past
tuning.review.max_rounds it sums up for the operator and goes quiet,
until a push or someone other than the PR's author joins in. An
operator's `stop` quiets it; `review` asks for a fresh review.

Reviews carry numbered markers and replies their point's key, so
recovery posts nothing twice.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk
This commit is contained in:
dongarandClaude Opus 5.5 committed 2026-10-17 07:06:06 +00:00
1 parent 7e73b8fb37
commit 37bbac7e72
14 files changed
+1268 -157

No files matched your search

+50 -3
View File
@@ -74,6 +74,14 @@ class FakeGitea:
public: set[str] = field(default_factory=set)
unlisted: set[str] = field(default_factory=set) # its PRs can't be listed
ci: dict[str, str] = field(default_factory=dict) # head -> checks; success
# What others said: top-level comments and comments on lines (M7.5).
thread: list[Comment] = field(
default_factory=lambda: [Comment(1, "don", "Please keep it simple.", "t")]
)
notes: list[ReviewNote] = field(default_factory=list)
since: list[str] = field(default_factory=list) # commits_between's answer
reactions: list[tuple[int, str]] = field(default_factory=list)
_ids: int = 1000
def _up(self) -> None:
if self.down:
@@ -118,11 +126,48 @@ class FakeGitea:
def pull_request_diff(self, repo: str, index: int) -> str:
return self.diff
def _id(self) -> int:
self._ids += 1
return self._ids
def say(self, author: str, body: str) -> int:
"""Someone else's top-level comment on the PR."""
n = self._id()
self.thread.append(Comment(n, author, body, "t"))
return n
def note(self, author: str, body: str, where: str) -> str:
"""Someone else's comment on a line."""
key = f"line-{self._id()}"
self.notes.append(ReviewNote(key, author, body, where))
return key
def list_comments(self, repo: str, index: int, since: str | None = None):
return [Comment(1, "don", "Please keep it simple.", "t")]
self._up()
return list(self.thread)
def review_notes(self, repo: str, index: int) -> list[ReviewNote]:
return []
self._up()
mine: list[ReviewNote] = []
for n, p in enumerate(self.posted, 1):
if (p["repo"], p["pr"]) != (repo, index):
continue
if p["body"].strip():
mine.append(ReviewNote(f"review-{n}", self.account, p["body"], ""))
mine += [
ReviewNote(f"line-{n}-{i}", self.account, c.body, f"{c.path}:{c.line}")
for i, c in enumerate(p["comments"])
]
return mine + list(self.notes)
def commits_between(self, repo: str, base: str, head: str) -> list[str]:
return list(self.since)
def commit_diff(self, repo: str, sha: str) -> str:
return f"diff of {sha}\n"
def react(self, repo: str, comment_id: int, content: str) -> None:
self.reactions.append((comment_id, content))
def checks(self, repo: str, sha: str) -> str:
return self.ci.get(sha, "success")
@@ -169,7 +214,9 @@ class FakeGitea:
def post_comment(self, repo: str, index: int, body: str) -> Comment:
self.comments.append((repo, index, body))
return Comment(99, self.account, body, "t")
said = Comment(self._id(), self.account, body, "t")
self.thread.append(said)
return said
def close(self) -> None:
pass