feat(orchestrator): hub page for requirements 085 to 099
085 calm Match deck: no header hourglass, centred bare empty state, the release card as a deck card (Cancel, Skip, Release), fixed card height. 086 motion: vanish() fade everywhere with a lint test, view transitions, a lub-dub heartbeat for working objects, confetti that lands and fades. 087 time readout under the pivot of every analog clock. 088 prune dialog grouped by prefix with tri-state boxes, search, stepper and sticky footer. 089 one-row task toolbar with Filter and Actions menus and a filter chip. 090 card border by state colour with a soft glow and owner avatars. 091 draggable limit lines with staged changes and one Save, a Limits menu with the matrix, View toggles, the GPU cause in its tooltip. 093 request chips Open, Expired, Stale, Failed, All and a signed Delete. 094 closed cards leave the deck within 5 s; open in Claude stamps. 095 compact agent message box with Post/Call, attach, mic and Send in the field. 096 Reject on an expired card drops it silently as Drop (expired). 097 Show filter in Match's right-click menu. 098 docked speech bubbles carry the speaker's avatar and a skip button. 099 Match card headlines cut to 120 characters with the full title in the tooltip; the code box keeps the whole command. tests/test_hub_path_links.py: a unicode fixture without German. Full make test green through the queue (2605 tests, ruff, shellcheck, markdownlint). Gate missed on the operator's word: break 7 %, the E2E specs (13 new, 15 updated) run next. 🎯 Fix: 92 % 💥 Break: 7 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 86 🚦 Gate: ⛔ break 7 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ee52644c8
commit
6323f087bc
95 files changed
+5807
-704
No files matched your search
@@ -17,21 +17,25 @@ import hub_e2e_kit as base
|
||||
from hub_case import HubCase
|
||||
from hub_support import ASK, signing
|
||||
from kvb_orchestrator import batches, skill_scripts
|
||||
from kvb_orchestrator.denying import LAPSED
|
||||
|
||||
OUT = Path(os.environ.get("E2E_OUT", "/tmp/hub-080-expired-shots"))
|
||||
FEEDBACK = "run it again after the gate"
|
||||
OUT = Path(os.environ.get("E2E_OUT", "/tmp/hub-096-expired-shots"))
|
||||
AGO = 690
|
||||
GONE_MS = 300
|
||||
TIP = re.compile(r"^expired \d{2}:\d{2}, 12 minutes ago$")
|
||||
FLOW = """(async () => {@HELPERS@
|
||||
const posted = [];
|
||||
const send = window.fetch.bind(window);
|
||||
window.fetch = async (path, init) => {
|
||||
if (["/api/sign", "/api/inbox/approve"].includes(String(path))) {
|
||||
posted.push([String(path), JSON.parse(init.body).items.map((item) => [item.kind, item.id, item.verb, item.channel || null, item.reason || null, item.to || null])]);
|
||||
if (["/api/sign", "/api/inbox/approve", "/api/requests/dismiss"].includes(String(path))) {
|
||||
posted.push([String(path), JSON.parse(init.body).items.map((item) => [item.kind, item.target || null, item.id, item.verb || null, item.scope || null, item.channel || null])]);
|
||||
}
|
||||
return send(path, init);
|
||||
};
|
||||
const sheet = document.getElementById("sheet");
|
||||
let opened = false;
|
||||
new MutationObserver(() => {
|
||||
opened = opened || !sheet.hidden;
|
||||
}).observe(sheet, {attributes: true, attributeFilter: ["hidden"]});
|
||||
const card = () => document.querySelector("#main .match-card.front");
|
||||
const front = () => (card() ? card().dataset.card : null);
|
||||
if (!(await until(card, 8000))) {
|
||||
@@ -47,29 +51,39 @@ FLOW = """(async () => {@HELPERS@
|
||||
const style = getComputedStyle(stamp);
|
||||
const found = {id, stamp: text(stamp), kind: stamp.dataset.stamp, tip: stamp.title, color: style.color, opacity: style.opacity, pointer: style.pointerEvents,
|
||||
accept: document.querySelector("#main .match-accept").disabled, reject: document.querySelector("#main .match-reject").disabled};
|
||||
key("ArrowRight");
|
||||
await sleep(500);
|
||||
const head = card().querySelector(".match-head");
|
||||
const box = head.getBoundingClientRect();
|
||||
const at = (x) => ({bubbles: true, cancelable: true, pointerId: 9, pointerType: "touch", isPrimary: true, button: 0, clientX: x, clientY: box.top + 20});
|
||||
head.dispatchEvent(new PointerEvent("pointerdown", at(box.left + box.width / 2)));
|
||||
window.dispatchEvent(new PointerEvent("pointermove", at(box.left + box.width * 0.8)));
|
||||
found.leaned = card().dataset.leaning || "";
|
||||
window.dispatchEvent(new PointerEvent("pointerup", at(box.left + box.width * 0.95)));
|
||||
const swipe = async (share) => {
|
||||
const head = card().querySelector(".match-head");
|
||||
const box = head.getBoundingClientRect();
|
||||
const at = (x) => ({bubbles: true, cancelable: true, pointerId: 9, pointerType: "touch", isPrimary: true, button: 0, clientX: x, clientY: box.top + 20});
|
||||
head.dispatchEvent(new PointerEvent("pointerdown", at(box.left + box.width / 2)));
|
||||
window.dispatchEvent(new PointerEvent("pointermove", at(box.left + box.width * (0.5 + share / 2))));
|
||||
const leaned = card().dataset.leaning || "";
|
||||
const start = performance.now();
|
||||
window.dispatchEvent(new PointerEvent("pointerup", at(box.left + box.width * (0.5 + share))));
|
||||
return {leaned, start};
|
||||
};
|
||||
const right = await swipe(0.45);
|
||||
await sleep(500);
|
||||
found.leaned = right.leaned;
|
||||
found.kept = front() === id;
|
||||
found.tally = text(document.querySelector("#main .match-tally"));
|
||||
found.wide = document.documentElement.scrollWidth > window.innerWidth + 1;
|
||||
if (@RELEASE@) {
|
||||
key("ArrowLeft");
|
||||
const feedback = await until(() => document.querySelector(".sheet-box .match-feedback"), 3000);
|
||||
if (!feedback) {
|
||||
return {...found, error: "no feedback sheet"};
|
||||
const left = await swipe(-0.45);
|
||||
found.leftLeaned = left.leaned;
|
||||
while (front() === id && performance.now() - left.start < 2000) {
|
||||
await sleep(10);
|
||||
}
|
||||
feedback.value = "@FEEDBACK@";
|
||||
document.querySelector(".sheet-box .match-feedback-reject").click();
|
||||
found.goneMs = performance.now() - left.start;
|
||||
await sleep(400);
|
||||
found.sheetAfterSwipe = opened;
|
||||
found.dropRows = all("#main .match-decision").map((row) => [row.dataset.card, row.dataset.verdict, text(row.querySelector(".match-verdict")), Boolean(row.querySelector(".match-decision-feedback"))]);
|
||||
key("s");
|
||||
found.undone = Boolean(await until(() => front() === id, 3000));
|
||||
key("ArrowLeft");
|
||||
const overview = await until(() => document.querySelector("#main .match-overview"), 4000);
|
||||
found.rows = overview ? all("#main .match-decision").map((row) => [row.dataset.card, row.dataset.verdict]) : [];
|
||||
found.sheetAfterKey = opened;
|
||||
found.rows = overview ? all("#main .match-decision").map((row) => [row.dataset.card, row.dataset.verdict, text(row.querySelector(".match-verdict")), Boolean(row.querySelector(".match-decision-feedback"))]) : [];
|
||||
const shown = new Set(all("#toasts .toast"));
|
||||
document.querySelector("#main .match-release").click();
|
||||
found.toast = await until(() => all("#toasts .toast").filter((node) => !shown.has(node)).map(text).find((entry) => entry.startsWith("Release")), 15000);
|
||||
@@ -78,6 +92,13 @@ FLOW = """(async () => {@HELPERS@
|
||||
}
|
||||
return found;
|
||||
})()"""
|
||||
AGAIN = """(async () => {@HELPERS@
|
||||
await until(() => document.querySelector("#main .match-stack .empty, #main .match-card.front"), 8000);
|
||||
const response = await fetch("/api/match", {cache: "no-store"});
|
||||
const cards = (await response.json()).cards.map((card) => card.id);
|
||||
const front = document.querySelector("#main .match-card.front");
|
||||
return {again: true, cards, front: front ? front.dataset.card : null, empty: Boolean(document.querySelector("#main .match-stack .empty"))};
|
||||
})()"""
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
|
||||
@@ -95,23 +116,28 @@ class TestMatchExpired(HubCase):
|
||||
return [args for script, args in self.scripts.calls if script == skill_scripts.RADIO]
|
||||
|
||||
def step(self, width: int, height: int, release: bool) -> dict:
|
||||
flow = FLOW.replace("@HELPERS@", base.HELPERS).replace("@FEEDBACK@", FEEDBACK).replace("@RELEASE@", "true" if release else "false")
|
||||
flow = FLOW.replace("@HELPERS@", base.HELPERS).replace("@RELEASE@", "true" if release else "false")
|
||||
shot = OUT / f"chromium-{width}-{'released' if release else 'expired'}.png"
|
||||
return {"width": width, "height": height, "url": f"http://localhost:{self.port}/?{width}-{release}#tasks/match", "wait": 1500, "probe": flow, "shot": str(shot)}
|
||||
|
||||
def test_chromium_stamps_an_expired_ask_offers_only_deny_and_releases_the_deny_by_radio(self):
|
||||
def again(self) -> dict:
|
||||
return {"width": 1366, "height": 768, "url": f"http://localhost:{self.port}/?again#tasks/match", "wait": 1500, "probe": AGAIN.replace("@HELPERS@", base.HELPERS), "shot": str(OUT / "chromium-1366-again.png")}
|
||||
|
||||
def test_chromium_drops_an_expired_ask_silently_and_the_release_dismisses_it_for_every_page(self):
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
steps = [self.step(width, height, False) for width, height in base.WIDTHS] + [self.step(1366, 768, True)]
|
||||
with mock.patch.object(batches, "UNDO", 0.3):
|
||||
data = self.drive(steps, self.authenticator())
|
||||
self.settle(lambda: self.httpd.hub.asks.get(self.ask)["status"] == "denied")
|
||||
(OUT / "chromium-expired.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
|
||||
self.settle(lambda: self.httpd.hub.dismissals.listed() != [])
|
||||
again = self.drive([self.again()], None)
|
||||
(OUT / "chromium-expired.json").write_text(json.dumps({"release": data, "again": again}, indent=1), encoding="utf-8")
|
||||
self.assertEqual([error for error in data["errors"] if "(style-src-elem)" not in error and "/favicon.ico" not in error], [])
|
||||
self.assertEqual(len(data["results"]), len(steps), data)
|
||||
card = f"ask:{self.ask}"
|
||||
for found in data["results"]:
|
||||
with self.subTest(step=found.get("toast") is not None):
|
||||
self.assertNotIn("error", found, found)
|
||||
self.assertEqual((found["id"], found["stamp"], found["kind"]), (f"ask:{self.ask}", "EXPIRED", "expired"), found)
|
||||
self.assertEqual((found["id"], found["stamp"], found["kind"]), (card, "EXPIRED", "expired"), found)
|
||||
self.assertRegex(found["tip"], TIP)
|
||||
self.assertEqual((found["opacity"], found["pointer"]), ("1", "auto"), found)
|
||||
channels = [int(part) for part in found["color"].removeprefix("rgb(").removesuffix(")").split(",")[:3]]
|
||||
@@ -120,17 +146,26 @@ class TestMatchExpired(HubCase):
|
||||
self.assertEqual((found["leaned"], found["kept"], found["tally"]), ("", True, "0"), found)
|
||||
self.assertFalse(found["wide"], found)
|
||||
released = data["results"][-1]
|
||||
self.assertEqual(released["rows"], [[f"ask:{self.ask}", "reject"]], released)
|
||||
self.assertEqual(released["leftLeaned"], "reject", released)
|
||||
self.assertLess(released["goneMs"], GONE_MS, released)
|
||||
self.assertFalse(released["sheetAfterSwipe"], released)
|
||||
self.assertEqual(released["dropRows"], [[card, "drop", "Drop (expired)", False]], released)
|
||||
self.assertTrue(released["undone"], released)
|
||||
self.assertFalse(released["sheetAfterKey"], released)
|
||||
self.assertEqual(released["rows"], [[card, "drop", "Drop (expired)", False]], released)
|
||||
self.assertNotIn("not possible", released["toast"], released)
|
||||
self.assertTrue(released["emptied"], released)
|
||||
self.assertEqual([path for path, _ in released["posted"]], ["/api/sign", "/api/inbox/approve"], released)
|
||||
self.assertEqual(released["posted"][1][1], [["ask", self.ask, "reject", "call", FEEDBACK, "Skills"]], released)
|
||||
self.settle(lambda: self.radio() != [])
|
||||
self.assertEqual(self.radio()[-1][:4], ["send", "call", "--to", "Skills session"])
|
||||
self.assertTrue(self.radio()[-1][-1].endswith(f"Denied by the operator: ask Bash: make deploy, {LAPSED} (from Skills). Reason: {FEEDBACK}"), self.radio()[-1])
|
||||
self.assertEqual(released["posted"][1][1], [["dismiss", "ask", self.ask, None, "expired", None]], released)
|
||||
self.assertEqual(len(again["results"]), 1, again)
|
||||
shown = again["results"][0]
|
||||
self.assertNotIn(card, shown["cards"], shown)
|
||||
self.assertEqual((shown["front"], shown["empty"]), (None, True), shown)
|
||||
self.assertEqual(self.httpd.hub.asks.get(self.ask)["status"], "pending")
|
||||
self.assertEqual(self.radio(), [])
|
||||
status, _, body = self.get("/api/match")
|
||||
self.assertEqual(status, 200, body)
|
||||
self.assertNotIn(f"ask:{self.ask}", [card["id"] for card in json.loads(body)["cards"]])
|
||||
self.assertNotIn(card, [entry["id"] for entry in json.loads(body)["cards"]])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user