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>
This commit is contained in:
1 parent
e5fd70e183
commit
0fad1bfae3
265 files changed
+10434
-2242
No files matched your search
@@ -1,9 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
@@ -24,64 +26,103 @@ LABELS = [
|
||||
("channel-aloud", "Read radio aloud"),
|
||||
("channel-title", "Waiting count in the tab title"),
|
||||
]
|
||||
SOURCES = [("resources", "Resource warnings"), ("mayday", "MAYDAY calls"), ("dream", "Dream reminder")]
|
||||
ON = {"browser": True, "sounds": True, "aloud": True, "title": True}
|
||||
SECTIONS = ["Ambience", "Location", "Appearance", "Music", "Undo window", "Passkey"]
|
||||
KIT = """
|
||||
const boxes = (group) => all("input[type=checkbox]", group).map((box) => [box.name, box.checked, words(box.closest("label"))]);
|
||||
const rows = (fold) => all(".notify-source", fold).map((row) => [row.dataset.source, row.dataset.state, words(row.querySelector("label")), text(row.querySelector(".notify-state")), all("button", row).map(text)]);
|
||||
const stored = async () => (await (await fetch("/api/state", {cache: "no-store"})).json()).settings;
|
||||
const fold = async () => {
|
||||
location.hash = "#stream/radio";
|
||||
const notify = await until(() => document.querySelector("#radio-spot details.radio-notify"), 8000);
|
||||
if (notify && !notify.open) {
|
||||
notify.querySelector("summary").click();
|
||||
await sleep(400);
|
||||
}
|
||||
const group = notify ? await until(() => notify.querySelector("fieldset.channels"), 8000) : null;
|
||||
return {notify, group};
|
||||
};
|
||||
const sheet = async () => {
|
||||
document.getElementById("settings-open").click();
|
||||
const form = await until(() => document.querySelector(".sheet-box form.settings"), 8000);
|
||||
const group = form ? form.querySelector("fieldset.channels") : null;
|
||||
if (group) {
|
||||
group.scrollIntoView({block: "center"});
|
||||
await sleep(300);
|
||||
const found = form ? {sections: all("section > h3", form).map(text), channels: all("fieldset.channels, .notify-source", form).length} : null;
|
||||
if (form) {
|
||||
all("button", form).find((button) => text(button) === "Cancel").click();
|
||||
await until(() => !document.querySelector(".sheet-box form.settings"), 8000);
|
||||
}
|
||||
return {form, group};
|
||||
return found;
|
||||
};
|
||||
const look = (form, group) => {
|
||||
const box = group.getBoundingClientRect();
|
||||
const look = (notify, group) => {
|
||||
const layer = notify.querySelector(".station-body").getBoundingClientRect();
|
||||
return {
|
||||
legend: text(group.querySelector("legend")), boxes: boxes(group), sections: all("section > h3", form).map(text), clashes: clashes(form),
|
||||
inside: box.left >= -1 && box.right <= innerWidth + 1, wide: document.documentElement.scrollWidth > innerWidth + 1,
|
||||
legend: text(group.querySelector("legend")), boxes: boxes(group), sources: rows(notify), clashes: clashes(notify.querySelector(".station-body")),
|
||||
inDevice: Boolean(notify.closest(".radio-device > .radio-settings")), stations: Boolean(notify.closest(".radio-settings").querySelector("details.radio-station")),
|
||||
inside: layer.left >= -1 && layer.right <= innerWidth + 1, wide: document.documentElement.scrollWidth > innerWidth + 1,
|
||||
};
|
||||
};
|
||||
const save = async (group, on) => {
|
||||
for (const box of all("input[type=checkbox]", group)) {
|
||||
const save = async (on) => {
|
||||
for (const name of @NAMES@) {
|
||||
const {group} = await fold();
|
||||
const box = group.querySelector(`input[name="${name}"]`);
|
||||
if (box.checked !== on) {
|
||||
box.click();
|
||||
}
|
||||
const key = name.replace("channel-", "");
|
||||
const end = Date.now() + 8000;
|
||||
while (Date.now() < end && (await stored()).channels[key] !== on) {
|
||||
await sleep(200);
|
||||
}
|
||||
}
|
||||
const shown = boxes(group);
|
||||
group.closest("form").querySelector('button[type="submit"]').click();
|
||||
const closed = Boolean(await until(() => !document.querySelector(".sheet-box form.settings"), 8000));
|
||||
const {group} = await fold();
|
||||
const titled = Boolean(await until(() => (on ? /@TITLED@/.test(document.title) : document.title === "@PLAIN@"), 8000));
|
||||
const stored = (await (await fetch("/api/state", {cache: "no-store"})).json()).settings.channels;
|
||||
return {shown, closed, titled, title: document.title, stored};
|
||||
return {shown: boxes(group), titled, title: document.title, stored: (await stored()).channels};
|
||||
};
|
||||
"""
|
||||
OPENED = """(async () => {@HELPERS@@OVERLAP@@KIT@
|
||||
await screenShown(8000);
|
||||
await until(() => /@TITLED@/.test(document.title), 8000);
|
||||
const title = document.title;
|
||||
const {form, group} = await sheet();
|
||||
return group ? {title, ...look(form, group)} : {error: text(document.querySelector(".sheet-box")), title};
|
||||
const general = await sheet();
|
||||
const {notify, group} = await fold();
|
||||
return group ? {title, general, ...look(notify, group)} : {error: "no channel group in the Device card", title};
|
||||
})()"""
|
||||
SWITCHED = """(async () => {@HELPERS@@OVERLAP@@KIT@
|
||||
const group = document.querySelector(".sheet-box fieldset.channels");
|
||||
return group ? save(group, @ON@) : {error: "no channel group"};
|
||||
return save(@ON@);
|
||||
})()"""
|
||||
SAVED_ON = """(async () => {@HELPERS@@OVERLAP@@KIT@
|
||||
const group = document.querySelector(".sheet-box fieldset.channels");
|
||||
if (!group) {
|
||||
return {error: "no channel group"};
|
||||
}
|
||||
const saved = await save(group, true);
|
||||
const again = await sheet();
|
||||
const saved = await save(true);
|
||||
document.querySelector("#radio-spot details.radio-notify").open = false;
|
||||
await sleep(300);
|
||||
const again = await fold();
|
||||
return {...saved, reopened: again.group ? boxes(again.group) : null};
|
||||
})()"""
|
||||
SNOOZED = """(async () => {@HELPERS@@OVERLAP@@KIT@
|
||||
await screenShown(8000);
|
||||
const {notify} = await fold();
|
||||
const row = (id) => notify.querySelector(`.notify-source[data-source="${id}"]`);
|
||||
const button = (id, label) => all("button", row(id)).find((item) => text(item) === label);
|
||||
const wait = async (id, state) => Boolean(await until(() => row(id) && row(id).dataset.state === state, 8000));
|
||||
const before = rows(notify);
|
||||
const titles = all(".notify-source button", notify).map((item) => item.getAttribute("title"));
|
||||
button("resources", "1 h").click();
|
||||
const hour = await wait("resources", "snoozed");
|
||||
const snoozed = rows(notify);
|
||||
row("mayday").querySelector('input[type="checkbox"]').click();
|
||||
const off = await wait("mayday", "off");
|
||||
button("dream", "8:00").click();
|
||||
const morning = await wait("dream", "snoozed");
|
||||
const after = rows(notify);
|
||||
const dream = (await stored()).popups.dream;
|
||||
button("dream", "Resume").click();
|
||||
const resumed = await wait("dream", "on");
|
||||
return {before, titles, hour, snoozed, off, morning, after, dream, resumed, last: rows(notify), popups: (await stored()).popups, toasts: all("#toasts .toast").map(text)};
|
||||
})()"""
|
||||
|
||||
|
||||
def fill(probe: str) -> str:
|
||||
return probe.replace("@HELPERS@", base.HELPERS).replace("@OVERLAP@", base.OVERLAP).replace("@KIT@", KIT).replace("@TITLED@", TITLED).replace("@PLAIN@", PLAIN)
|
||||
names = json.dumps([name for name, _ in LABELS])
|
||||
return probe.replace("@HELPERS@", base.HELPERS).replace("@OVERLAP@", base.OVERLAP).replace("@KIT@", KIT).replace("@NAMES@", names).replace("@TITLED@", TITLED).replace("@PLAIN@", PLAIN)
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
|
||||
@@ -97,7 +138,7 @@ class TestNotificationChannels(HubCase):
|
||||
|
||||
def legacy(self) -> None:
|
||||
file = self.state / "settings.json"
|
||||
older = {key: value for key, value in settings.SETTINGS.items() if key != "channels"}
|
||||
older = {key: value for key, value in settings.SETTINGS.items() if key not in ("channels", "popups")}
|
||||
file.write_text(json.dumps({**older, "notify": False}), encoding="utf-8")
|
||||
held = self.httpd.hub.settings
|
||||
with held.lock:
|
||||
@@ -118,17 +159,18 @@ class TestNotificationChannels(HubCase):
|
||||
self.assertNotIn("error", found, found)
|
||||
self.assertEqual(data["errors"], [])
|
||||
self.assertRegex(opened["title"], TITLED)
|
||||
self.assertEqual(opened["general"], {"sections": SECTIONS, "channels": 0})
|
||||
self.assertEqual((opened["legend"], opened["boxes"]), ("Notification channels", [[name, name != "channel-browser", label] for name, label in LABELS]))
|
||||
self.assertEqual(opened["sections"], ["Ambience", "Location", "Appearance", "Music", "Notifications", "Passkey"])
|
||||
self.assertEqual((opened["clashes"], opened["inside"], opened["wide"]), ({"found": [], "outside": []}, True, False), opened)
|
||||
self.assertEqual((off["shown"], off["closed"], off["titled"], off["title"], off["stored"]), ([[name, False, label] for name, label in LABELS], True, True, PLAIN, dict.fromkeys(ON, False)), off)
|
||||
self.assertEqual([row[:3] for row in opened["sources"]], [[source, "on", label] for source, label in SOURCES])
|
||||
self.assertEqual((opened["inDevice"], opened["stations"], opened["clashes"], opened["inside"], opened["wide"]), (True, True, {"found": [], "outside": []}, True, False), opened)
|
||||
self.assertEqual((off["shown"], off["titled"], off["title"], off["stored"]), ([[name, False, label] for name, label in LABELS], True, PLAIN, dict.fromkeys(ON, False)), off)
|
||||
self.assertEqual((reloaded["title"], reloaded["boxes"], reloaded["clashes"]), (PLAIN, [[name, False, label] for name, label in LABELS], {"found": [], "outside": []}), reloaded)
|
||||
self.assertEqual((back["closed"], back["titled"], back["stored"], back["reopened"]), (True, True, ON, [[name, True, label] for name, label in LABELS]), back)
|
||||
self.assertEqual((back["titled"], back["stored"], back["reopened"]), (True, ON, [[name, True, label] for name, label in LABELS]), back)
|
||||
self.assertRegex(back["title"], TITLED)
|
||||
written = json.loads((self.state / "settings.json").read_text(encoding="utf-8"))
|
||||
self.assertEqual((written["channels"], "notify" in written), (ON, False))
|
||||
|
||||
def test_chromium_migrates_the_old_notify_flag_and_switches_every_channel_off_and_on_through_a_reload_at_three_widths(self):
|
||||
def test_chromium_migrates_the_old_notify_flag_and_switches_every_channel_off_and_on_in_the_device_card_through_a_reload_at_three_widths(self):
|
||||
authenticator = self.authenticator()
|
||||
for width, height in base.WIDTHS:
|
||||
with self.subTest(width=width):
|
||||
@@ -137,6 +179,34 @@ class TestNotificationChannels(HubCase):
|
||||
(OUT / f"chromium-{width}-channels.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
|
||||
self.check(data)
|
||||
|
||||
def test_chromium_snoozes_mutes_and_resumes_each_gnome_popup_source_and_writes_notify_json(self):
|
||||
page = f"http://localhost:{self.port}/?popups"
|
||||
started = time.time()
|
||||
data = self.drive([{"width": 1366, "height": 900, "url": f"{page}#stream", "wait": 1200, "probe": fill(SNOOZED), "shot": str(OUT / "chromium-popups.png")}], self.authenticator())
|
||||
(OUT / "chromium-popups.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
|
||||
self.assertEqual(data["errors"], [])
|
||||
found = data["results"][0]
|
||||
self.assertNotIn("error", found, found)
|
||||
self.assertEqual([row[:3] for row in found["before"]], [[source, "on", label] for source, label in SOURCES])
|
||||
self.assertEqual([row[4] for row in found["before"]], [["1 h", "8:00"]] * 3)
|
||||
self.assertTrue(all(title.split(": ")[0] in dict(SOURCES).values() for title in found["titles"]), found["titles"])
|
||||
self.assertEqual((found["hour"], found["off"], found["morning"], found["resumed"]), (True, True, True, True), found)
|
||||
resources = found["snoozed"][0]
|
||||
self.assertEqual((resources[1], resources[4]), ("snoozed", ["Resume", "1 h", "8:00"]))
|
||||
self.assertRegex(resources[3], r"^snoozed until \d\d:\d\d$")
|
||||
self.assertEqual(found["after"][1][1:], ["off", "MAYDAY calls", "off", []])
|
||||
self.assertEqual(found["last"][2][1], "on")
|
||||
popups = found["popups"]
|
||||
self.assertEqual((popups["mayday"], popups["dream"]), ({"on": False, "until": 0}, {"on": True, "until": 0}))
|
||||
self.assertTrue(popups["resources"]["on"])
|
||||
self.assertLessEqual(abs(popups["resources"]["until"] - (started + 3600)), 120, popups)
|
||||
written = json.loads((self.council / settings.NOTIFY).read_text(encoding="utf-8"))
|
||||
self.assertEqual(written, popups)
|
||||
morning = datetime.datetime.fromtimestamp(found["dream"]["until"])
|
||||
self.assertEqual((found["dream"]["on"], morning.hour, morning.minute, morning.second), (True, 8, 0, 0), found["dream"])
|
||||
self.assertLess(started, found["dream"]["until"])
|
||||
self.assertLessEqual(found["dream"]["until"] - started, 33 * 3600)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user