Files
skills/tests/e2e/test_box_heads_e2e.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

210 lines
11 KiB
Python

from __future__ import annotations
import json
import os
import shutil
import sys
import unittest
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path[:0] = [str(HERE.parent), str(HERE)]
import hub_e2e_kit as base
import test_home_bookmarks_e2e as bm
import test_home_dashboard_e2e as dash
import test_match_review_e2e as matched
import test_workbench_w4_e2e as w4
from hub_case import HubCase
OUT = Path(os.environ.get("E2E_OUT", "/tmp/box-heads-shots"))
VIEWS = {
"stream": "Stream",
"tasks/match": "Match",
"tasks/list": "Tasks",
"tasks/board": "Tasks",
"resources": "Resources",
"agents/orbit": "Agents",
"artifacts/orbit": "Artifacts",
"stream/rules": "Controls",
}
PINNED = ["tasks/match", "tasks/list", "tasks/board", "agents/orbit", "artifacts/orbit"]
PATTERNS = ["dots", "stripes", "waves", "grid", "rings"]
BUTTON = """
const buttonHeight = (root, selector) => {
const found = all(selector, root).find((node) => node.getClientRects().length);
return found ? Math.round(found.getBoundingClientRect().height) : null;
};
"""
BAND = """(async () => {@HELPERS@@BUTTON@
if (!(await screenShown(8000))) {
return {error: "no screen"};
}
const main = document.getElementById("main");
const head = await until(() => main.querySelector(".box-head"), 8000);
if (!head) {
return {error: text(main).slice(0, 300)};
}
await sleep(400);
let first = true;
for (let node = head; node !== main; node = node.parentElement) {
first = first && node.parentElement.firstElementChild === node;
}
const style = getComputedStyle(main);
const outer = main.getBoundingClientRect();
const box = head.getBoundingClientRect();
const shown = [...head.querySelectorAll(":scope > *, :scope > .box-slot > *")].filter((node) => node.getClientRects().length);
const tops = shown.map((node) => Math.round(node.getBoundingClientRect().top));
const control = ':is(.btn, .field, select, input[type="search"], input[type="text"], .segmented, .chip, .menu > summary, .mic-line)';
const controls = all(control, head).filter((node) => node.getClientRects().length && !node.closest(".menu-box") && !node.parentElement.closest(".mic-line, .segmented"))
.map((node) => [node.getAttribute("aria-label") || node.className || node.tagName, Math.round(node.getBoundingClientRect().height * 10) / 10]);
const centers = shown.map((node) => {
const box = node.getBoundingClientRect();
return Math.round((box.top + box.height / 2) * 10) / 10;
});
return {
controls, centers, token: getComputedStyle(document.documentElement).getPropertyValue("--control-h").trim(),
label: head.getAttribute("aria-label"), count: all(".box-head", main).length, cards: all(".card.controls", main).length, first,
edges: [box.top - outer.top - parseFloat(style.borderTopWidth), box.left - outer.left - parseFloat(style.borderLeftWidth), outer.left + main.clientLeft + main.clientWidth - box.right].map((value) => Math.round(value * 10) / 10),
height: Math.round(box.height), rows: new Set(tops).size, button: buttonHeight(head, "button.btn.small, button.btn"),
wide: document.documentElement.scrollWidth > innerWidth + 1, violations: window.e2eViolations || null,
};
})()"""
SEED = """(async () => {@HELPERS@
await ViewStore.update("home.pins", () => @PINNED@.map((id) => ({kind: "panel", id, w: innerWidth > 640 ? 6 : 4, h: 5})));
return true;
})()"""
TILES = """(async () => {@HELPERS@@HOME@@BUTTON@
await go("home");
await until(() => all("#main .home-tile").length === @COUNT@, 8000);
await sleep(1200);
const head = document.querySelector("#main .home-tile .home-head");
return {
head: head ? Math.round(head.getBoundingClientRect().height) : null, button: head ? buttonHeight(head, ".home-unpin") : null,
tiles: all("#main .home-tile").map((tile) => ({
key: tile.dataset.pin, heads: all(".home-body .box-head", tile).length, kanban: Boolean(tile.querySelector(".home-head .kanban-bar")),
})),
wide: document.documentElement.scrollWidth > innerWidth + 1, violations: window.e2eViolations || null,
};
})()"""
EDGE = """(async () => {@HELPERS@
if (!(await screenShown(8000))) {
return {error: "no screen"};
}
const card = await until(() => document.querySelector("#main .match-card.front"), 8000);
if (!card) {
return {error: text(document.getElementById("main")).slice(0, 300)};
}
const head = card.querySelector(".match-head");
const kept = card.dataset.pattern;
const found = {};
for (const pattern of @PATTERNS@) {
card.dataset.pattern = pattern;
await sleep(60);
const shown = getComputedStyle(card);
const edge = getComputedStyle(card, "::before");
const after = getComputedStyle(head, "::before");
found[pattern] = {
border: shown.borderTopWidth, bar: edge.backgroundImage.startsWith("linear-gradient"), size: edge.height, scroll: shown.overflowY,
fade: (edge.maskImage || edge.webkitMaskImage || "").replace(/\\s+/g, " "),
flush: Math.round(head.getBoundingClientRect().top - card.getBoundingClientRect().top), top: after.top,
mask: (after.maskImage || after.webkitMaskImage || "").replace(/\\s+/g, " "), hatch: after.backgroundImage !== "none",
};
}
card.dataset.pattern = kept;
return {found};
})()"""
def probe(template: str, **names: str) -> str:
fills = {"@HELPERS@": base.HELPERS, "@HOME@": dash.HOME, "@BUTTON@": BUTTON, "@PINNED@": json.dumps(PINNED), "@COUNT@": str(len(PINNED)), "@PATTERNS@": json.dumps(PATTERNS)}
fills.update({f"@{key.upper()}@": value for key, value in names.items()})
for key, value in fills.items():
template = template.replace(key, value)
return template
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
class TestBoxHeads(HubCase):
seed = base.OrchestratorE2ECase.seed
subagents = base.OrchestratorE2ECase.subagents
drive = base.OrchestratorE2ECase.drive
cards = matched.TestMatchReview.cards
review = matched.TestMatchReview.review
payload = matched.TestMatchReview.payload
def setUp(self):
super().setUp()
OUT.mkdir(parents=True, exist_ok=True)
self.seed()
self.cards()
def steps(self, browser: str) -> list[dict]:
steps = []
for width, height in base.WIDTHS:
at = {"width": width, "height": height}
shot = OUT / f"{browser}-{width}"
steps += [{**at, "url": f"{self.base}?{width}-{view.replace('/', '-')}#{view}", "wait": 1500, "probe": probe(BAND), "shot": f"{shot}-{view.replace('/', '-')}.png"} for view in VIEWS]
steps += [
{**at, "url": f"{self.base}?{width}-clear#stream", "wait": 600, "probe": bm.CLEAR, "shot": None},
{**at, "url": f"{self.base}?{width}-seed#stream", "wait": 800, "probe": probe(SEED), "shot": None},
{**at, "url": f"{self.base}?{width}-home#home", "wait": 1500, "probe": probe(TILES), "shot": f"{shot}-home-tiles.png"},
{**at, "url": f"{self.base}?{width}-edge#tasks/match", "wait": 1500, "probe": probe(EDGE), "shot": f"{shot}-match-edge.png"},
]
return steps
def check_band(self, row: dict, view: str, width: int, home: dict) -> None:
self.assertNotIn("error", row, row)
self.assertEqual((row["label"], row["count"], row["cards"], row["first"]), (VIEWS[view], 1, 0, True), row)
self.assertEqual(row["edges"], [0, 0, 0], row)
self.assertEqual((row["wide"], w4.quiet(row["violations"])), (False, []), row)
self.assertEqual(row["token"], "36px", row)
self.assertTrue(row["controls"], row)
self.assertEqual([control for control in row["controls"] if abs(control[1] - 36) > 1], [], row)
if view == "stream" and row["rows"] == 1:
self.assertLessEqual(max(row["centers"]) - min(row["centers"]), 2, row)
if width == 1920 and row["rows"] == 1:
self.assertLessEqual(abs(row["height"] - home["head"]), 1, (row, home["head"]))
self.assertLessEqual(abs(row["button"] - home["button"]), 1, (row, home["button"]))
else:
self.assertLessEqual(row["height"], row["rows"] * (home["head"] + 6) + 1, (row, home["head"]))
def check(self, data: dict, browser: str) -> None:
self.assertEqual([error for error in data["errors"] if "/favicon.ico" not in error], [])
results = iter(data["results"])
for width, _ in base.WIDTHS:
bands = {view: next(results) for view in VIEWS}
next(results)
next(results)
home = next(results)
edge = next(results)
with self.subTest(browser=browser, width=width, step="tiles"):
self.assertEqual(sorted(tile["key"] for tile in home["tiles"]), sorted(f"panel:{view}" for view in PINNED), home)
self.assertEqual([tile["key"] for tile in home["tiles"] if tile["heads"]], [], home)
self.assertEqual([tile["key"] for tile in home["tiles"] if tile["kanban"]], ["panel:tasks/board"], home)
self.assertEqual((home["wide"], w4.quiet(home["violations"])), (False, []), home)
for view, row in bands.items():
with self.subTest(browser=browser, width=width, view=view):
self.check_band(row, view, width, home)
with self.subTest(browser=browser, width=width, step="edge"):
self.assertNotIn("error", edge, edge)
for pattern, found in edge["found"].items():
self.assertEqual((found["border"], found["bar"], found["size"], found["scroll"], found["flush"], found["top"], found["hatch"]), ("0px", True, "22px", "hidden", 0, "0px", True), (pattern, found))
self.assertTrue(found["fade"].startswith("linear-gradient(rgb(0, 0, 0) 0px"), (pattern, found))
self.assertTrue(found["mask"].startswith("linear-gradient(rgba(0, 0, 0, 0) 0px"), (pattern, found))
def test_chromium_puts_one_flush_band_on_every_box_and_keeps_the_card_bar_on_the_edge(self):
data = self.drive(self.steps("chromium"), None, init=w4.GUARD)
(OUT / "chromium-box-heads.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
self.check(data, "chromium")
@unittest.skipUnless(shutil.which(os.environ.get("FIREFOX", "firefox")), "no Firefox")
def test_firefox_puts_one_flush_band_on_every_box_and_keeps_the_card_bar_on_the_edge(self):
data = self.drive(self.steps("firefox"), None, "bidi.mjs", os.environ.get("FIREFOX", "firefox"), init=w4.GUARD)
(OUT / "firefox-box-heads.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
self.check(data, "firefox")
if __name__ == "__main__":
unittest.main()