FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: harden review comment workflows by qiankunli · Pull Request #140 · compforge/devloop · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (2) .py  (3) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion devloop/.claude-plugin/plugin.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "devloop",
"version": "0.3.7",
"version": "0.3.8",
"description": "Dev-loop workflow, native-first rebuild: git/PR (GitHub + GitLab) + cwd-aware enter + Board-managed context delivery + lint/test gates. Built on native Claude Code events (CwdChanged / PostCompact / FileChanged / monitors).",
"author": {
"name": "compforge",
Expand Down
2 changes: 1 addition & 1 deletion devloop/.codex-plugin/plugin.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "devloop",
"version": "0.3.7",
"version": "0.3.8",
"description": "Dev-loop workflow: git/PR (GitHub + GitLab) + Board-managed workspace/repo context delivery + lint/test gates + execution-level hard intercepts for Claude Code and Codex.",
"author": {
"name": "compforge",
Expand Down
2 changes: 1 addition & 1 deletion devloop/scripts/pr.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def cmd_show(ns) -> int:
print(f" comments ({count}):")
for c in comments[:20]:
body = (c.body or "").strip().replace("\n", " ")
print(f" - {c.author}: {body[:120]}")
print(f" - {c.id or '?'} {c.author}: {body[:120]}")
for reply in c.replies:
body = (reply.body or "").strip().replace("\n", " ")
print(f" ↳ {reply.author}: {body[:120]}")
Expand Down
6 changes: 5 additions & 1 deletion devloop/scripts/review.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def cmd_findings(ns) -> int:


def cmd_label(ns) -> int:
reason = ns.reason.strip()
if not reason:
print("review label: --reason cannot be empty", file=sys.stderr)
return 1
forge = _forge_or_exit(ns, "review label")
number = _number_or_exit(ns.number, "review label")
found = _findings(forge, number, "review label")
Expand All @@ -127,7 +131,7 @@ def cmd_label(ns) -> int:
file=sys.stderr,
)
return 1
body = review_feedback.verdict_reply(ns.verdict, ns.reason)
body = review_feedback.verdict_reply(ns.verdict, reason)
try:
forge.reply(number, finding.comment, body)
except ForgeError as exc:
Expand Down
34 changes: 34 additions & 0 deletions devloop/tests/test_forge.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"""
from __future__ import annotations

import io
import os
import shutil
import subprocess
import sys
from contextlib import redirect_stdout
from dataclasses import replace

from _testkit import _FakeForge, _git, _load_script, run_main # noqa: E402 (bootstrap first)
Expand Down Expand Up @@ -159,6 +161,34 @@ class _R:
prcli.cli.resolve_repo_or_exit = orig_resolve


def test_pr_show_exposes_replyable_comment_ids():
"""`pr show` exposes the top-level comment id consumed by `pr reply`."""
from domain.forge import Comment
prcli = _load_script("pr")

class _F(_FakeForge):
def comments(self, number):
return [Comment(id="30", author="reviewer", body="please fix")]

fake = _F([PullRequest(number=5, state="open", source_branch="feat/x")])

class _R:
git_root = "/x"

orig_forge = prcli.forge_for_repo
orig_resolve = prcli.cli.resolve_repo_or_exit
try:
prcli.forge_for_repo = lambda repo: fake
prcli.cli.resolve_repo_or_exit = lambda ns, prog: (_R(), "test")
output = io.StringIO()
with redirect_stdout(output):
assert prcli.main(["show", "5"]) == 0
assert "- 30 reviewer: please fix" in output.getvalue()
finally:
prcli.forge_for_repo = orig_forge
prcli.cli.resolve_repo_or_exit = orig_resolve


def test_review_cli_separates_verdict_from_resolution():
"""The review CLI owns typed Verdicts; recording one never resolves its thread."""
from domain.forge import Comment, CommentResolution
Expand Down Expand Up @@ -205,6 +235,10 @@ class _R:
reviewcli.cli.resolve_repo_or_exit = lambda ns, prog: (_R(), "test")
assert reviewcli.main(["findings", "5"]) == 0
assert reviewcli.main(["findings", "5", "--pending"]) == 0
assert reviewcli.main([
"label", "5", "30", "minor", "--reason", " ",
]) == 1
assert fake.replied == []
assert reviewcli.main([
"label", "5", "30", "minor", "--reason", "真问题,待修复",
]) == 0
Expand Down

Back | FazBrowse Home | New Git URL