Files
skills/tests/test_hub_speak_card.py
T
Kevin Veen-BirkenbachandClaude Opus 5.5 0fad1bfae3 feat: hub and skills requirements 032 to 063
Hub: send in the field (032), coherent speak box (033), stream head band (034), Match at full width with its pile (035, 036), Home without the outer box (037), badge to Match (038), rejects that survive a changed or withdrawn card (039), the release card (040), code marks in the review diff (041), why Deny is off (042), the undo window clock (043), widgets without inner boxes (044), the Artifacts head on one line (045), accepting a red gate's risk (046), one code box (047), done rows greyed and folded (048), one control height (049), menus that stay open (050), radio settings in the Device card (051), bubbles beside the modes (052), agent settings on every face and name (053), pin only by menu (054), WASD in Match (055), the flowing card edge (056), Schedules in Controls (057) and the hub poll cost (059).

Skills: the coach leaves for its own repository kevinveenbirkenbach/coach (058; test_install pins its four skills in skills-lock.json and stays red until that repository is published and pinned), hooks and timers start fewer processes (060), council files on hot paths stay bounded and mirror by marker instead of mtime (061), scripts and hooks hand agents less output (062), and block.py builds the commit table and message block in one run (063). Requirement documents 032 to 063 with their implementation amendments.

MEDUSA false positives accepted after kvb-think-criticize (36 lines): MM-SCAN-058 (pla inside replace or plan), JB-SCAN-616/641 (the local clip helper), CODEGEN-SCAN-001 (drop-in paths), CGS-SCAN-029 (systemctl argv from constants), CGS-SCAN-040 (runner poll loop), FLA-SCAN-055 (feedback), WM-SCAN-354, AI-BACKDOOR-006, GENAI-SCAN-1270, B604 (runner shell path for passkey-verified commands), TC004, EXA002, EXA006, EXA010 and WEB-SSRF.

🎯 Fix: 92 %
💥 Break: 8 %
💸 Tokens: 89 %
⏱️ Velocity: –
🛡️ Security: ~100 %
🏆 Score: 95
🚦 Gate: ⛔ break 8 % > 5

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:44:15 +00:00

92 lines
4.5 KiB
Python

from __future__ import annotations
import json
import re
import subprocess
import unittest
from hub_support import HUB
TEMPLATES = HUB / "templates"
MODULES = ["page-constants.js", "page-reveal.js", "page-dom.js", "page-board.js", "page-composer.js"]
PROBE = r"""
const fs = require("fs");
const vm = require("vm");
const [dir, names] = [process.argv[1], JSON.parse(process.argv[2])];
class El {
constructor(tag) { Object.assign(this, {tag, children: [], attrs: {}, dataset: {}, style: {}}); }
setAttribute(key, value) { this.attrs[key] = String(value); }
getAttribute(key) { return Object.hasOwn(this.attrs, key) ? this.attrs[key] : null; }
append(...nodes) { this.children.push(...nodes); }
replaceChildren(...nodes) { this.children = nodes; }
addEventListener() {}
}
const document = {
currentScript: null, body: new El("body"),
getElementById: () => Object.assign(new El("div"), {textContent: "[]"}),
createElement: (tag) => new El(tag), createElementNS: (ns, tag) => new El(tag),
};
const context = {
console, document, JSON, Math, Date, Intl, Promise, Set, Map, Number, String, Array, Object, RegExp, Boolean, Error,
El, Node: El, Element: El, HTMLElement: El,
window: {location: {hash: ""}, setTimeout: () => 0, matchMedia: () => ({matches: false})},
state: {inbox: [], radio: [], silence: null}, ui: {}, settings: {},
};
const source = names.map((name) => fs.readFileSync(`${dir}/${name}`, "utf8")).join("\n");
const probe = `
const toggle = new El("button");
state.silence = null;
drawMayday(toggle);
const idle = [toggle.attrs["aria-pressed"], toggle.children[1], toggle.title];
state.silence = {since: 1, by: "Docs", text: "disk full"};
drawMayday(toggle);
const active = [toggle.attrs["aria-pressed"], toggle.children[1], toggle.title];
JSON.stringify({idle, active, channels: CHANNELS.map(([id]) => id), titled: CHANNELS.every(([id]) => typeof CHANNEL_HINTS[id] === "string" && CHANNEL_HINTS[id].length > 0)});
`;
console.log(vm.runInNewContext(`${source}\n${probe}`, context));
"""
class TestSpeakCard(unittest.TestCase):
def probe(self) -> dict:
done = subprocess.run(["node", "-e", PROBE, str(TEMPLATES), json.dumps(MODULES)], capture_output=True, text=True, timeout=60, check=False)
self.assertEqual(done.returncode, 0, done.stderr)
return json.loads(done.stdout)
def test_the_toggle_reads_mayday_until_one_holds_the_radio_silent_then_cancel_mayday(self):
out = self.probe()
self.assertEqual(out["idle"][:2], ["false", "MAYDAY"])
self.assertTrue(out["idle"][2].startswith("MAYDAY: "), out)
self.assertEqual(out["active"], ["true", "Cancel mayday", "Cancel mayday: lift the radio silence so the agents write again; your passkey signs it"])
def test_the_channel_select_holds_no_mayday_and_every_channel_keeps_its_hint_for_the_choice_buttons(self):
out = self.probe()
self.assertEqual(out["channels"], ["post", "call", "newsletter", "broadcast", "pan-pan", "security"])
self.assertTrue(out["titled"], out)
def test_the_card_has_no_hint_sentence_no_hint_tooltip_and_no_browser_confirm(self):
composer = (TEMPLATES / "page-composer.js").read_text(encoding="utf-8")
self.assertNotIn("window.confirm", composer)
self.assertNotIn("Your passkey signs every message", composer)
self.assertNotIn("composer-hint", composer)
self.assertNotIn("CHANNEL_HINTS[", composer)
def test_channel_row_textarea_and_footer_share_one_frame_with_ptt_and_mayday_after_the_mic(self):
composer = (TEMPLATES / "page-composer.js").read_text(encoding="utf-8")
self.assertIn("const frame = micFrame(text, [record, status]);", composer)
self.assertIn('frame.prepend(h("div", {class: "composer-grid"}', composer)
self.assertRegex(composer, r'frame\.querySelector\("\.mic-foot"\)\.append\(h\("div", \{class: "ptt-split".*\), mayday\);')
self.assertIn('h("form", {class: "composer"}, frame, replay)', composer)
def test_the_card_is_one_rounded_surface(self):
css = (TEMPLATES / "style-ui.css").read_text(encoding="utf-8")
self.assertRegex(css, r"\.radio-card\.radio-speak \{ border-radius: 14px; \}")
self.assertRegex(css, r"\.composer-grid \{ display: flex; min-width: 0; border-bottom: 1px solid var\(--line\); \}")
self.assertNotRegex(css, r"\.composer textarea \{[^}]*border-radius")
self.assertNotIn(".radio-cancel", css)
self.assertIsNone(re.search(r'class: "[^"]*\bcard\b', (TEMPLATES / "page-composer.js").read_text(encoding="utf-8")))
if __name__ == "__main__":
unittest.main()