feat(hub): Controls page switches MCP servers, plugins and Artifacts

The Firewall page becomes Controls with three tabs: Tools lists every MCP server, plugin and feature switch of ~/.claude/settings.json with each other settings file that sets it differently, Rules keeps the settings lists and the hub rule form, Groups the groups and sets. A flip stages a change in one shared Apply bar; Apply shows the diff and signs it with the passkey as before. The signer writes deniedMcpServers rules, enabledPlugins entries and switches only in the own file and refuses wrong types and no-op flips; switching, the capability views and the per-item checks are one function each.

🎯 Fix: 88 %
💥 Break: 6 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 83
🚦 Gate: ⛔ fix 88 % < 90, break 6 % > 5

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-18 20:39:10 +00:00
1 parent 78f2fec339
commit 50363b1a33
16 files changed
+645 -78

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ WIDTHS = ((1920, 1080), (1366, 768), (390, 844))
VIEWS = ("orbit", "chord", "swimlane", "tree", "3d")
TASK_VIEWS = ("list", "board", "rasci", "gantt", "burn", "3d")
SCREENS = ["home", "stream", "tasks/operator", "tasks/match", "stream/rules", *(f"{tab}/{view}" for tab in ("agents", "artifacts") for view in VIEWS), "agents/hierarchy", *(f"tasks/{view}" for view in TASK_VIEWS), "resources"]
SUBS = ["Firewall"]
SUBS = ["Controls"]
TABS = ["Home", "Stream", "Agents", "Artifacts", "Tasks", "Resources"]
HELPERS = """
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
+78 -2
View File
@@ -23,6 +23,9 @@ SECRET = ORIGINAL["env"]["EXAMPLE_FLAG"]
ASKED = ["Bash(make deploy:*)", "Bash(make clean:*)", "Bash(git push:*)"]
SHOW = """(async () => {@HELPERS@
await screenShown(8000);
const tabs = () => all('#main [role="tab"]').map((node) => [node.dataset.tab, node.getAttribute("aria-selected"), document.getElementById(node.getAttribute("aria-controls")).hidden]);
const first = tabs();
document.querySelector('#main [role="tab"][data-tab="rules"]').click();
const ready = await until(() => all("#main table.fw-table tbody[data-source]").length > 1, 10000);
if (!ready) {
return {error: text(document.getElementById("main"))};
@@ -45,6 +48,7 @@ SHOW = """(async () => {@HELPERS@
await sleep(100);
return {
title: text(document.querySelector("#main h2.title")),
tabs: {first, picked: tabs()},
subs: all("#tabs .subtabs button").map(name),
sources,
folded,
@@ -75,7 +79,7 @@ SIGN = """(async () => {@HELPERS@
form.requestSubmit();
await sleep(100);
const staged = all('#main [aria-label="Staged changes"] li').map((node) => node.dataset.staged);
document.querySelector('#main button[aria-label="Review and sign"]').click();
document.querySelector("#main .apply-bar button[data-apply]").click();
const diff = await until(() => document.querySelector('.sheet-box [aria-label="Diff"] pre.fw-diff'), 8000);
if (!diff) {
return {error: "no diff", toasts: all("#toasts .toast").map(text)};
@@ -90,6 +94,47 @@ SIGN = """(async () => {@HELPERS@
shown.wide = document.documentElement.scrollWidth > innerWidth + 1;
return shown;
})()"""
TOOLS = """(async () => {@HELPERS@
await screenShown(8000);
const rowOf = (name) => document.querySelector(`#main .tool-row[data-tool="${name}"]`);
const flip = async (name, staged) => {
rowOf(name).querySelector("input.switch").click();
return until(() => rowOf(name).hasAttribute("data-staged") === staged, 4000);
};
if (!await until(() => rowOf("blender"), 10000)) {
return {error: text(document.getElementById("main"))};
}
const rows = () => all("#main .tool-row").map((node) => [node.closest("[data-list]").dataset.list, node.dataset.tool, node.dataset.on, node.hasAttribute("data-staged")]);
const bar = () => document.querySelector("#main .apply-bar");
const found = {before: rows(), hidden: bar().hidden};
await flip("blender", true);
await flip("caveman@caveman", true);
await flip("caveman@caveman", false);
await flip("enableArtifact", true);
found.staged = {rows: rows(), apply: text(bar().querySelector("button[data-apply]")), hidden: bar().hidden, list: all("li code", bar()).map(text)};
found.wide = document.documentElement.scrollWidth > innerWidth + 1;
found.unlabelled = all("#main input.switch").filter((node) => !node.getAttribute("aria-label")).length;
if (!@SIGN@) {
bar().querySelector('button[aria-label="Discard"]').click();
found.discarded = {hidden: bar().hidden, rows: rows()};
return found;
}
bar().querySelector("button[data-apply]").click();
const diff = await until(() => document.querySelector('.sheet-box [aria-label="Diff"] pre.fw-diff'), 8000);
if (!diff) {
return {...found, error: "no diff", toasts: all("#toasts .toast").map(text)};
}
const lines = (cls) => all(`span.${cls}`, diff).map((node) => node.textContent.trim());
found.added = lines("add");
found.removed = lines("del");
document.querySelector('.sheet-box button[aria-label="Sign and apply"]').click();
const done = await until(() => document.querySelector(".sheet-box [data-result]"), 30000);
found.result = done ? done.dataset.result : null;
found.after = await until(() => rowOf("blender") && rowOf("blender").dataset.on === "false" && !rowOf("blender").hasAttribute("data-staged") && rows(), 15000);
found.barAfter = bar().hidden;
found.secret = document.documentElement.innerHTML.includes("fixture-secret");
return found;
})()"""
GROUP_RULE = """(async () => {@HELPERS@
const prompts = [];
new MutationObserver((records) => records.forEach((record) => record.addedNodes.forEach((node) => {
@@ -244,7 +289,8 @@ class TestFirewallE2E(HubCase):
shown, signed = data["results"][2 * index : 2 * index + 2]
with self.subTest(width=width):
self.assertNotIn("error", shown, shown)
self.assertEqual((shown["title"], shown["subs"]), ("Firewall", base.SUBS))
self.assertEqual((shown["title"], shown["subs"]), ("Controls", base.SUBS))
self.assertEqual(shown["tabs"], {"first": [["tools", "true", False], ["rules", "false", True], ["groups", "false", True]], "picked": [["tools", "false", True], ["rules", "true", False], ["groups", "false", True]]})
self.assertEqual(shown["sources"], ["hub", str(self.settings), str(self.outside / "demo" / ".claude" / "settings.json")])
self.assertEqual(shown["folded"], {"expanded": ["false"] * 3, "rows": 0})
self.assertEqual(shown["opened"], ["true"] * 3)
@@ -280,6 +326,36 @@ class TestFirewallE2E(HubCase):
backups = sorted(self.settings.parent.glob("settings.json.before-firewall-*"))
self.assertEqual((len(backups), self.settings.stat().st_mode & 0o777), (3, 0o640))
def test_chromium_switches_tools_stages_them_in_the_apply_bar_and_signs_them_at_three_widths(self):
home = self.settings.parent.parent
(home / ".claude.json").write_text(json.dumps({"mcpServers": {"blender": {"command": "fixture-secret-command"}}, "claudeAiMcpEverConnected": ["claude.ai Google Drive"]}), encoding="utf-8")
(home / ".claude" / "plugins").mkdir()
(home / ".claude" / "plugins" / "installed_plugins.json").write_text(json.dumps({"plugins": {"caveman@caveman": []}}), encoding="utf-8")
self.settings.write_text(json.dumps({**ORIGINAL, "enabledPlugins": {"caveman@caveman": True}}, indent=2) + "\n", encoding="utf-8")
verifier.write_private(self.spool / "view.json", self.writer.view())
authenticator = self.authenticator()
self.beside(self.host_unit)
steps = [{"width": width, "height": height, "url": f"{self.page_url}?{width}#stream/rules", "wait": 1500, "probe": probe(TOOLS, {"SIGN": "true" if width == 390 else "false"}), "shot": str(OUT / f"chromium-{width}-controls-tools.png")} for width, height in base.WIDTHS]
data = self.drive(steps, authenticator)
(OUT / "chromium-controls-tools.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
self.assertEqual(data["errors"], [])
before = [["deniedMcpServers", "blender", "true", False], ["deniedMcpServers", "claude.ai Google Drive", "true", False], ["enabledPlugins", "caveman@caveman", "true", False], ["switches", "enableArtifact", "true", False]]
staged = [["deniedMcpServers", "blender", "false", True], before[1], before[2], ["switches", "enableArtifact", "false", True]]
for (width, _), found in zip(base.WIDTHS, data["results"], strict=True):
with self.subTest(width=width):
self.assertNotIn("error", found, found)
self.assertEqual((found["before"], found["hidden"]), (before, True))
self.assertEqual(found["staged"], {"rows": staged, "apply": "Apply (2)", "hidden": False, "list": ["Block server blender", "Turn off Artifacts"]})
self.assertEqual((found["wide"], found["unlabelled"]), (False, 0))
if width != 390:
self.assertEqual(found["discarded"], {"hidden": True, "rows": before})
signed = data["results"][-1]
self.assertTrue(any('"serverName": "blender"' in line for line in signed["added"]), signed["added"])
self.assertTrue(any('"enableArtifact": false' in line for line in signed["added"]), signed["added"])
self.assertEqual((signed["result"], signed["after"], signed["barAfter"], signed["secret"]), ("done", [[*row[:3], False] for row in staged], True, False), signed)
written = json.loads(self.settings.read_text(encoding="utf-8"))
self.assertEqual(written, {**ORIGINAL, "enabledPlugins": {"caveman@caveman": True}, "deniedMcpServers": [{"serverName": "blender"}], "enableArtifact": False})
def test_chromium_names_a_group_and_signs_a_rule_for_it(self):
authenticator = self.authenticator()
steps = [{"width": 1366, "height": 768, "url": f"{self.page_url}#stream/rules", "wait": 1500, "probe": probe(GROUP_RULE, {}), "shot": str(OUT / "chromium-1366-firewall-group-rule.png")}]
+1 -1
View File
@@ -206,7 +206,7 @@ class TestOrchestratorE2E(base.OrchestratorE2ECase):
self.assertEqual(actions["ambience"], ["sky-look", "music-toggle", "leitstand", "notify"])
self.assertEqual((actions["settingsUnlabelled"], actions["popupUnlabelled"]), (0, 0))
self.assertEqual((actions["sections"], actions["radioFields"]), (["Ambience", "Location", "Appearance", "Music", "Notifications", "Passkey"], 0))
for tool in ("Radio …", "Cancel mayday", "Priority …", "Drain", "Suspend", "Resume", "Firewall …", "Settings …", "Look at the sky", "Toggle control room", "Enable notifications"):
for tool in ("Radio …", "Cancel mayday", "Priority …", "Drain", "Suspend", "Resume", "Controls …", "Settings …", "Look at the sky", "Toggle control room", "Enable notifications"):
with self.subTest(tool=tool):
self.assertTrue(any(tool in entry for entry in actions["palette"]), actions["palette"])
self.assertEqual(actions["popup"], [["post", True], ["call", False]])
+1 -1
View File
@@ -189,7 +189,7 @@ class TestWorkbenchOperatorTasks(HubCase):
self.assertEqual(feedback["labels"], {"float": [], "menu": [], "sheet": []})
with self.subTest(browser=browser, width=width):
self.assertNotIn("error", tasks, tasks)
self.assertEqual((tasks["hash"], tasks["tabs"], tasks["subs"], tasks["streamInbox"], tasks["current"]), ("#tasks/operator", base.TABS, ["Firewall"], False, ["Tasks"]))
self.assertEqual((tasks["hash"], tasks["tabs"], tasks["subs"], tasks["streamInbox"], tasks["current"]), ("#tasks/operator", base.TABS, ["Controls"], False, ["Tasks"]))
self.assertRegex(tasks["badge"] or "", r"^[1-9][0-9]*$")
self.assertEqual((tasks["kinds"], tasks["boxes"]), (["k-review", "k-operator", "k-ask"], [True, True, True]))
operator = tasks["operator"]