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

168 lines
7.3 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_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/hub-035-036-shots"))
DECK = """
const widen = () => card() && card().querySelector(".match-widen");
const shown = (node) => Boolean(node && node.getClientRects().length);
const area = () => {
const box = document.querySelector("#main .graph.match");
const look = getComputedStyle(box);
return box.clientWidth - parseFloat(look.paddingLeft) - parseFloat(look.paddingRight);
};
const width = () => card().offsetWidth;
const later = async () => {
const before = card().dataset.card;
document.body.dispatchEvent(new KeyboardEvent("keydown", {key: "ArrowUp", bubbles: true}));
return Boolean(await until(() => card() && card().dataset.card !== before, 4000));
};
const flip = async (wide) => {
widen().click();
await until(() => document.querySelector("#main .match-stack").dataset.wide === String(wide), 4000);
await sleep(200);
};
"""
WIDE = """(async () => {@HELPERS@@CARD@@DECK@
await screenShown(8000);
if (!(await until(card, 8000))) {
return {error: text(document.getElementById("main")).slice(0, 300)};
}
await sleep(300);
if (document.querySelector("#main .match-stack").dataset.wide === "true") {
await flip(false);
}
const before = {button: shown(widen()), width: width(), area: Math.round(area())};
if (!before.button) {
return {before};
}
await flip(true);
const wide = {width: width(), area: Math.round(area()), label: widen().getAttribute("aria-label"), keys: await later()};
wide.after = width();
return {before, wide};
})()"""
KEPT = """(async () => {@HELPERS@@CARD@@DECK@
await screenShown(8000);
if (!(await until(card, 8000))) {
return {error: text(document.getElementById("main")).slice(0, 300)};
}
await sleep(300);
const kept = {wide: document.querySelector("#main .match-stack").dataset.wide, width: width(), area: Math.round(area())};
await flip(false);
const narrow = {width: width(), label: widen().getAttribute("aria-label"), keys: await later()};
narrow.after = width();
return {kept, narrow};
})()"""
PILE = """(async () => {@HELPERS@@CARD@@DECK@
await screenShown(8000);
if (!(await until(card, 8000))) {
return {error: text(document.getElementById("main")).slice(0, 300)};
}
await sleep(300);
const open = () => Number((text(document.querySelector("#main .task-toolbar .muted")) || "").split(" ")[0]);
const pile = () => {
const front = card();
const edge = front.getBoundingClientRect();
return {open: open(), release: front.classList.contains("match-release-card"), layers: all("#main .match-layer").map((layer) => ({
size: Math.abs(layer.offsetWidth - front.offsetWidth) <= 2 && Math.abs(layer.offsetHeight - front.offsetHeight) <= 2,
above: layer.getBoundingClientRect().top < edge.top - 1,
lower: Number(getComputedStyle(layer).zIndex) < Number(getComputedStyle(front).zIndex),
inert: getComputedStyle(layer).pointerEvents === "none" && layer.getAttribute("aria-hidden") === "true",
}))};
};
const seen = [pile()];
for (let tries = 0; open() > 1 && tries < 8; tries += 1) {
const count = open();
document.body.dispatchEvent(new KeyboardEvent("keydown", {key: "ArrowLeft", bubbles: true}));
const confirm = await until(() => document.querySelector(".match-feedback-reject"), 2000);
if (!confirm) {
await later();
continue;
}
confirm.click();
if (await until(() => open() === count - 1 && card(), 4000)) {
await sleep(500);
seen.push(pile());
}
}
return {seen};
})()"""
def probe(template: str) -> str:
return template.replace("@HELPERS@", base.HELPERS).replace("@CARD@", matched.CARD).replace("@DECK@", DECK)
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
class TestMatchPile(HubCase):
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.cards()
def steps(self) -> list[dict]:
steps = []
for width, height in base.WIDTHS:
at = {"width": width, "height": height}
shot = OUT / f"chromium-{width}"
steps.append({**at, "url": f"{self.base}?{width}-wide#tasks/match", "wait": 1500, "probe": probe(WIDE), "shot": f"{shot}-match-wide.png"})
if width > 640:
steps.append({**at, "url": f"{self.base}?{width}-kept#tasks/match", "wait": 1500, "probe": probe(KEPT), "shot": f"{shot}-match-narrow.png"})
steps.append({**at, "url": f"{self.base}?{width}-pile#tasks/match", "wait": 1500, "probe": probe(PILE), "shot": f"{shot}-match-pile.png"})
return steps
def test_chromium_widens_a_match_card_keeps_the_choice_and_piles_the_waiting_cards_behind_it(self):
data = self.drive(self.steps(), None, init=w4.GUARD)
(OUT / "chromium-match-pile.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
self.assertEqual([error for error in data["errors"] if "/favicon.ico" not in error], [])
results = iter(data["results"])
for width, _ in base.WIDTHS:
wide = next(results)
kept = next(results) if width > 640 else None
pile = next(results)
with self.subTest(width=width, step="wide"):
self.assertNotIn("error", wide, wide)
self.assertEqual(wide["before"]["button"], width > 640, wide)
self.assertLessEqual(wide["before"]["width"], 960, wide)
if width > 640:
self.assertLessEqual(abs(wide["wide"]["width"] - wide["wide"]["area"]), 2, wide)
self.assertEqual((wide["wide"]["label"], wide["wide"]["keys"], wide["wide"]["after"]), ("Normal width", True, wide["wide"]["width"]), wide)
if kept:
with self.subTest(width=width, step="kept"):
self.assertNotIn("error", kept, kept)
self.assertEqual(kept["kept"]["wide"], "true", kept)
self.assertLessEqual(abs(kept["kept"]["width"] - kept["kept"]["area"]), 2, kept)
self.assertLessEqual(kept["narrow"]["width"], 960, kept)
self.assertEqual((kept["narrow"]["label"], kept["narrow"]["keys"], kept["narrow"]["after"]), ("Full width", True, kept["narrow"]["width"]), kept)
with self.subTest(width=width, step="pile"):
self.assertNotIn("error", pile, pile)
seen = pile["seen"]
self.assertGreaterEqual(seen[0]["open"], 3, seen)
self.assertEqual(seen[-1]["open"], 1, seen)
for state in seen:
self.assertEqual(len(state["layers"]), min(2, state["open"] - (0 if state["release"] else 1)), state)
for layer in state["layers"]:
self.assertEqual(layer, {"size": True, "above": True, "lower": True, "inert": True}, state)
if __name__ == "__main__":
unittest.main()