feat(orchestrator): Match cards show the score line as metric chips
scores.metric_chips() reads each metric's value from an agent's free score line by emoji, label or former label from labels.json, and Match cards render them as chips under the name instead of the raw score pill. New e2e: real mouse swipes send later, reject, refuse a stale card and accept at three widths; the release e2e gains its negative control. Fix stays below 90: the swipe e2e ended in ERROR in the aborted final run of 2026-11-17 without a traceback; the master gate reruns it. 🎯 Fix: 88 % 💥 Break: 3 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 85 🚦 Gate: ⛔ fix 88 % < 90 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b711c3b83b
commit
78d4e4a6aa
8 files changed
+302
-16
No files matched your search
+23
-1
@@ -13,7 +13,7 @@ from unittest import mock
|
||||
|
||||
from hub_case import HubCase
|
||||
from hub_support import APPROVAL, GIT_ENV, HUB, REPO_ROOT, key, signing
|
||||
from kvb_orchestrator import batches, payloads, skill_scripts
|
||||
from kvb_orchestrator import batches, payloads, scores, skill_scripts
|
||||
|
||||
MATCH = REPO_ROOT / "skills" / "kvb-match" / "scripts" / "match.py"
|
||||
CLIENT = HUB / "client"
|
||||
@@ -167,6 +167,11 @@ class TestMatchRelease(MatchCase):
|
||||
argv = ["verify", "--port", str(self.port), "--approvers", str(self.approvers), "--replay", str(self.replay / "commit.json"), "--review", review, "--gate", "pass"]
|
||||
return subprocess.run([sys.executable, str(APPROVAL), *argv], cwd=repo, env={**os.environ, **GIT_ENV}, capture_output=True, text=True, timeout=60, check=False)
|
||||
|
||||
def test_a_commit_card_lists_its_score_line_as_metric_chips_and_a_command_card_none(self):
|
||||
_, review = self.stack()
|
||||
chips = {card["ref"]: [(metric["id"], metric["value"]) for metric in card["metrics"]] for card in self.cards()}
|
||||
self.assertEqual(chips, {review: [("fix", "95"), ("break", "3")], "operator/ship": []})
|
||||
|
||||
def test_every_card_names_the_addressee_its_inbox_entry_shows(self):
|
||||
_, review = self.stack()
|
||||
shown = {item["id"]: item["to"] for item in self.snapshot()["inbox"]}
|
||||
@@ -345,5 +350,22 @@ class TestPayloadHash(unittest.TestCase):
|
||||
self.assertEqual(named, ["/tmp/x/body.md", "/repo/list.txt", "/repo/scripts/run.sh", "/repo/quoted file.md"])
|
||||
|
||||
|
||||
class TestMetricChips(unittest.TestCase):
|
||||
def test_score_lines_of_every_shape_give_one_chip_per_metric_in_label_order(self):
|
||||
labels = scores.score_labels(REPO_ROOT / "skills")
|
||||
line = scores.metric_chips("🎯 fix 94 % · 💥 break 4 % · 💸 tokens 100 % · ⏱️ velocity 100 % · 🛡️ security 100 % · 🏆 score 90", labels)
|
||||
self.assertEqual([(chip["id"], chip["emoji"], chip["label"], chip["value"]) for chip in line], [
|
||||
("fix", "🎯", "Fix", "94 %"), ("break", "💥", "Break", "4 %"), ("tokens", "💸", "Tokens", "100 %"),
|
||||
("velocity", "⏱️", "Velocity", "100 %"), ("security", "🛡️", "Security", "100 %"), ("score", "🏆", "Score", "90"),
|
||||
])
|
||||
block = scores.metric_chips("🎯 Fix: 85 %\n💥 Break: 5 %\n⏱ Speed: new\n🏆 Score: 81\n🚦 Gate: ⛔ fix 85 % < 90", labels)
|
||||
self.assertEqual([(chip["id"], chip["value"]) for chip in block], [("fix", "85 %"), ("break", "5 %"), ("velocity", "new"), ("score", "81")])
|
||||
self.assertEqual([(chip["id"], chip["value"]) for chip in scores.metric_chips("Fix 92% Break 2.5%", labels)], [("fix", "92%"), ("break", "2.5%")])
|
||||
for text in ("", "looks good", "🎯 high", "prefix 90 %"):
|
||||
with self.subTest(text=text):
|
||||
self.assertEqual(scores.metric_chips(text, labels), [])
|
||||
self.assertEqual(scores.metric_chips("🎯 95 💥 3", None), [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user