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>
63 lines
2.9 KiB
Python
63 lines
2.9 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import unittest
|
|
|
|
from hub_case import HubCase
|
|
from kvb_orchestrator import fields, settings
|
|
from kvb_orchestrator.errors import ToolError
|
|
|
|
QUIET = {"sound": False, "aloud": False, "bubbles": True}
|
|
LOUD = {"sound": True, "aloud": True, "bubbles": True}
|
|
|
|
|
|
class TestAgentsSetting(unittest.TestCase):
|
|
def test_each_agent_keeps_three_switches_and_an_all_on_entry_is_dropped(self):
|
|
self.assertEqual(settings.agents_setting({"s1": QUIET, "s2": LOUD, "name:Docs": {**LOUD, "bubbles": False}}), {"s1": QUIET, "name:Docs": {**LOUD, "bubbles": False}})
|
|
self.assertEqual(settings.agents_setting({}), {})
|
|
|
|
def test_unknown_or_missing_switches_wrong_values_and_oversized_maps_are_refused(self):
|
|
wrongs = [
|
|
[],
|
|
"s1",
|
|
{"s1": {**QUIET, "volume": 1}},
|
|
{"s1": {"sound": False, "aloud": False}},
|
|
{"s1": {**QUIET, "sound": "off"}},
|
|
{"s1": {**QUIET, "sound": 0}},
|
|
{"s1": True},
|
|
{"": QUIET},
|
|
{"x" * (fields.NAME_LIMIT + 1): QUIET},
|
|
{f"s{index}": QUIET for index in range(settings.AGENTS_LIMIT + 1)},
|
|
]
|
|
for wrong in wrongs:
|
|
with self.subTest(wrong=str(wrong)[:80]), self.assertRaises(ToolError):
|
|
settings.agents_setting(wrong)
|
|
|
|
|
|
class TestHubAgentSettings(HubCase):
|
|
def test_the_agent_switches_save_without_a_passkey_and_a_page_without_them_keeps_them(self):
|
|
good = self.guard(self.host)
|
|
current = self.snapshot()["settings"]
|
|
self.assertEqual(current["agents"], {})
|
|
quiet = {**current, "agents": {"s1": QUIET, "s2": LOUD}}
|
|
status, _, body = self.post_json("/api/settings/sign", quiet, good)
|
|
self.assertEqual((status, json.loads(body)["payload"]), (200, None), body)
|
|
status, _, body = self.post_json("/api/settings", {**quiet, "proof": None}, good)
|
|
self.assertEqual((status, json.loads(body)["settings"]["agents"]), (200, {"s1": QUIET}), body)
|
|
older = {key: value for key, value in current.items() if key != "agents"}
|
|
status, _, body = self.post_json("/api/settings", {**older, "bubbles": not current["bubbles"], "proof": None}, good)
|
|
self.assertEqual((status, json.loads(body)["settings"]["agents"]), (200, {"s1": QUIET}), body)
|
|
self.assertEqual(settings.Settings(self.state / "settings.json").get()["agents"], {"s1": QUIET})
|
|
|
|
def test_a_save_with_an_unknown_switch_is_refused_and_changes_nothing(self):
|
|
good = self.guard(self.host)
|
|
current = self.snapshot()["settings"]
|
|
for wrong in ({"s1": {**QUIET, "volume": 1}}, {"s1": {**QUIET, "aloud": "no"}}, ["s1"]):
|
|
with self.subTest(wrong=wrong):
|
|
self.assertEqual(self.post_json("/api/settings", {**current, "agents": wrong, "proof": None}, good)[0], 400)
|
|
self.assertEqual(self.snapshot()["settings"]["agents"], {})
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|