fix(hub): a denied review's status carries the operator's reason
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s
review_status and review_wait returned only status, tree and proof, so a denial note on a card without a known recipient (every MCP card since the agent field came, because sessions keep the tool list they loaded) reached nobody: the hub logged no recipient for call and the note sat unread in reviews.json. state_of now adds channel, reason and to when the denial carries a note, as the ask status already does; a plain rejection adds nothing. The review_status description names the fields. Negative control: on the old code both new subtests fail with KeyError 'channel'. 🎯 Fix: 95 % 💥 Break: 2 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 93 🚦 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
6720ee3e70
commit
0fece7664a
3 files changed
+26
-4
No files matched your search
@@ -234,6 +234,26 @@ class TestHubDeny(HubCase):
|
||||
self.settle(lambda: any("no recipient" in row["text"] for row in self.events("kinds=approval")["events"]))
|
||||
self.assertEqual((self.ask_status(ask_id, "0"), self.radio()), ("denied", []))
|
||||
|
||||
def test_a_review_denied_without_recipient_still_returns_its_reason(self):
|
||||
review_id = self.tool("review_request", self.arguments("feat: nameless", "", self.page("bundle.html", PAGE)))["structuredContent"]["id"]
|
||||
entry = self.denial("review", review_id, "", "call", " drop the\n comments ")
|
||||
self.assertEqual(entry["to"], "")
|
||||
with mock.patch.object(batches, "UNDO", 0.05):
|
||||
self.assertEqual(self.approve([entry], self.signed([entry], self.pin()))[0], 202)
|
||||
self.settle(lambda: any("no recipient" in row["text"] for row in self.events("kinds=approval")["events"]))
|
||||
self.assertEqual(self.radio(), [])
|
||||
for name, arguments in (("review_status", {"id": review_id}), ("review_wait", {"id": review_id, "timeout_seconds": 0})):
|
||||
with self.subTest(tool=name):
|
||||
state = self.tool(name, arguments)["structuredContent"]
|
||||
self.assertEqual((state["status"], state["channel"], state["reason"], state["to"]), ("rejected", "call", "drop the comments", ""))
|
||||
|
||||
def test_a_review_rejected_without_a_note_carries_no_reason(self):
|
||||
review_id = self.tool("review_request", self.arguments("feat: plain", "", self.page("bundle.html", PAGE)))["structuredContent"]["id"]
|
||||
with mock.patch.object(batches, "UNDO", 0.05):
|
||||
self.assertEqual(self.approve([{**self.entry("review", review_id, "", ""), "verb": "reject"}], None)[0], 202)
|
||||
self.settle(lambda: self.tool("review_status", {"id": review_id})["structuredContent"]["status"] == "rejected")
|
||||
self.assertFalse({"channel", "reason", "to"} & set(self.tool("review_status", {"id": review_id})["structuredContent"]))
|
||||
|
||||
def answer(self, signer: Key, item: dict, channel: str, reason: str) -> dict:
|
||||
payload = signing.approval_payload([signing.item_hash(signing.denial_item(item, channel, reason, "Skills"))], secrets.token_hex(16), int(time.time()) + 60)
|
||||
return {"status": "denied", "channel": channel, "reason": reason, "to": "Skills", "proof": signer.proof(payload, self.origin)}
|
||||
|
||||
Reference in new issue
Block a user