023 box heads: one head band per box under its top border; in widget mode its controls join the widget title band. 024 Match card content: merge cards show their diff (the runner previews a review's tree against its worktree HEAD), every card carries legal and architecture scores, the null under command cards is gone. 025 Radio speak card: no hint text, a rounder flowing card, a MAYDAY toggle beside push to talk. 026 widget zoom: zoom a widget's content by keyboard and the context menu. 027 slash skill suggestions: every field that messages agents suggests skills after a slash, from a skills index the tree timer writes. 028 Resources accounts: an Accounts panel (provider, renewal, resets, usage and remaining, host-local, emails never in git) and panel checkboxes. 029 Controls layout: Rules and Groups pages laid out. 030 Yes/No answers as buttons, and nothing hides: rows the runner cannot run stay greyed with the reason. 031 mic in fields. Line comments (operator 2026-11-24): wherever code waits for a grant (Waits on Operator, the stream, the review overlay) selected lines or a right-clicked row take a comment that marks its lines and collects on the card; Deny opens with them as the reason and Call preselected, Grant sends them after the signed grant as one post. Requirement 003 decision 4 and its contract follow. Tests are written for every requirement and run once on this head. 🎯 Fix: 80 % 💥 Break: 20 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: ~95 % 🏆 Score: 61 🚦 Gate: ⛔ fix 80 % < 90, break 20 % > 5; security ~95 % < 100: ask the operator before the commit Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
2.8 KiB
Python
55 lines
2.8 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import unittest
|
|
|
|
import hub_support
|
|
from kvb_orchestrator.jobs import UNRUNNABLE, row_blocked
|
|
|
|
MODULE = hub_support.HUB / "templates" / "answers.js"
|
|
CLASSIFY = r"""
|
|
const A = require(process.argv[1]);
|
|
const option = (label) => ({label, description: ""});
|
|
const items = {
|
|
ask: {kind: "ask"},
|
|
yesNo: {kind: "decision", options: [option("Yes"), option("No")], multi: false},
|
|
row: {kind: "operator", check: "decision", options: [option(" no "), option("YES")], multi: false},
|
|
named: {kind: "decision", options: [option("Commit B11"), option("Don't commit")], multi: false},
|
|
multi: {kind: "decision", options: [option("Yes"), option("No")], multi: true},
|
|
three: {kind: "decision", options: [option("Yes"), option("No"), option("Later")], multi: false},
|
|
command: {kind: "operator", check: "done", options: []},
|
|
};
|
|
console.log(JSON.stringify({
|
|
boolean: Object.fromEntries(Object.entries(items).map(([name, item]) => [name, A.boolean(item)])),
|
|
pair: A.pair(items.yesNo),
|
|
declined: [A.declined("No", "", 1000), A.declined("No", " rebase first,\n then merge ", 1000), A.declined("No", "x".repeat(20), 10), A.declined("No", "Yes", 1000)],
|
|
}));
|
|
"""
|
|
|
|
|
|
class TestAnswers(unittest.TestCase):
|
|
def test_asks_and_yes_no_choices_are_boolean_while_named_multi_and_longer_choices_keep_their_form(self):
|
|
done = subprocess.run(["node", "-e", CLASSIFY, str(MODULE)], capture_output=True, text=True, timeout=60, check=False)
|
|
self.assertEqual(done.returncode, 0, done.stderr)
|
|
found = json.loads(done.stdout)
|
|
self.assertEqual(found["boolean"], {"ask": True, "yesNo": True, "row": True, "named": False, "multi": False, "three": False, "command": False})
|
|
self.assertEqual(found["pair"], {"yes": "Yes", "no": "No"})
|
|
self.assertEqual(found["declined"], ["No", "No: rebase first, then merge", "No: xxxxxx", "No: Yes"])
|
|
|
|
|
|
class TestRowBlocked(unittest.TestCase):
|
|
def test_a_queued_or_running_job_names_its_reason_a_free_row_none_and_a_decision_row_is_never_unrunnable(self):
|
|
row = {"task": "operator/x", "command": "true", "directory": "/repo", "check": "done"}
|
|
reasons = {"operator/q": "Queued in the hub runner for 3 min", "operator/r": "The hub runner runs it for 9 min"}
|
|
self.assertEqual(row_blocked(row, reasons), "")
|
|
self.assertEqual(row_blocked({**row, "task": "operator/q"}, reasons), reasons["operator/q"])
|
|
self.assertEqual(row_blocked({**row, "task": "operator/r", "directory": "relative"}, reasons), reasons["operator/r"])
|
|
self.assertEqual(row_blocked({**row, "directory": "relative"}, reasons), UNRUNNABLE)
|
|
self.assertEqual(row_blocked({**row, "command": "-"}, reasons), UNRUNNABLE)
|
|
self.assertEqual(row_blocked({**row, "check": "decision", "directory": "-"}, reasons), "")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|