fix(hub): list commit-range files in the review overview
Stage 2.0 now submits reviews whose change sits in a commit range (master..HEAD) instead of the staged tree. review_files() skipped every file inside a commit block, so the overview from the stream and the inbox showed "No diff available" while the full page held the diff. The parser now keeps those files under the section commits, and the tree pane titles it Commits. 🎯 Fix: 93 % 💥 Break: 2 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 91 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ad03188335
commit
0f71fba0a4
3 files changed
+8
-4
No files matched your search
@@ -28,7 +28,7 @@ class ReviewPage(HTMLParser):
|
||||
if tag == "section":
|
||||
self.section = values.get("id") or ""
|
||||
elif tag == "details":
|
||||
if first == "file" and "commit" not in self.details:
|
||||
if first == "file":
|
||||
self.file = {"section": self.section, "status": "", "tags": [], "lines": []}
|
||||
self.texts = {name: [] for name in TEXTS}
|
||||
self.spans = []
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
running: ["running", "ok"], queued: ["waiting", "info"], blocked: ["blocked", "bad"], stale: ["stale", "warn"], pending: ["open", "warn"], done: ["done", "neutral"], stopped: ["stopped", "neutral"],
|
||||
approved: ["approved", "ok"], rejected: ["denied", "bad"], allowed: ["allowed", "ok"], denied: ["denied", "bad"], expired: ["expired", "neutral"], decided: ["decided", "ok"], failed: ["failed", "bad"], refused: ["refused", "bad"],
|
||||
};
|
||||
const SECTIONS = {staged: "Staged", unstaged: "Not staged", untracked: "Untracked"};
|
||||
const SECTIONS = {staged: "Staged", unstaged: "Not staged", untracked: "Untracked", commits: "Commits"};
|
||||
const FILE_STATUS = {added: ["A", "ok"], deleted: ["D", "bad"], modified: ["M", "info"], renamed: ["R", "violet"], copied: ["C", "violet"], untracked: ["U", "warn"]};
|
||||
const SIGNS = {add: "+", del: "-", ctx: " ", meta: " "};
|
||||
const NODE_KINDS = {operator: "Operator", chair: "Chair", session: "Session", subagent: "Subagent"};
|
||||
|
||||
@@ -46,7 +46,9 @@ REVIEW_PAGE = """<!DOCTYPE html><html><head><script>const x = "<details class='f
|
||||
<section class="group" id="commits">
|
||||
<details class="commit" id="c1" open><summary><code class="sha">abc1234</code></summary>
|
||||
<div class="commit-files">
|
||||
<details class="file" id="f3" data-path="skip.py"><summary><span class="badge added" title="added">A</span><span class="path">skip.py</span></summary></details>
|
||||
<details class="file" id="f3" data-path="committed.py"><summary><span class="badge added" title="added">A</span><span class="path">committed.py</span><span class="stat"><span class="add">+1</span><span class="del">−0</span></span></summary>
|
||||
<table class="diff"><tbody><tr class="add"><td class="num"></td><td class="num">1</td><td class="sign">+</td><td class="code">x = 1</td></tr></tbody></table>
|
||||
</details>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
@@ -176,7 +178,9 @@ class TestHubReviews(HubCase):
|
||||
self.assertEqual([(f["section"], f["path"], f["old"], f["status"], f["added"], f["removed"]) for f in files], [
|
||||
("staged", "hub/server.py", "", "modified", 2, 1),
|
||||
("staged", "docs/new.md", "docs/old.md", "renamed", 0, 0),
|
||||
("commits", "committed.py", "", "added", 1, 0),
|
||||
])
|
||||
self.assertEqual([(line["kind"], line["new"], line["text"]) for line in files[2]["lines"]], [("add", "1", "x = 1")])
|
||||
lines = [(line["kind"], line["old"], line["new"], line["text"]) for line in files[0]["lines"]]
|
||||
self.assertEqual(lines, [
|
||||
("hunk", "", "", "@@ -1,2 +1,3 @@"),
|
||||
@@ -190,7 +194,7 @@ class TestHubReviews(HubCase):
|
||||
review_id = self.tool("review_request", self.arguments("feat: tree", "", self.page("tree.html", REVIEW_PAGE)))["structuredContent"]["id"]
|
||||
status, _, body = self.get(f"/reviews/{review_id}/files")
|
||||
self.assertEqual((status, json.loads(body)), (200, {"files": files}))
|
||||
self.assertEqual([(r["id"], r["files"]) for r in self.snapshot()["reviews"]], [(review_id, 2)])
|
||||
self.assertEqual([(r["id"], r["files"]) for r in self.snapshot()["reviews"]], [(review_id, 3)])
|
||||
self.assertEqual(self.get(f"/reviews/{review_id}/page")[2].decode("utf-8"), REVIEW_PAGE)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user