Files
skills/tests/test_hub_settings_files.py
T
Kevin Veen-BirkenbachandClaude Opus 5.5 2722cda1b5 feat(hub): requirements 023 to 031 and line comments on grant-time code
023 box heads: one head band per box under its top border; in widget mode
its controls join the widget title band.
024 Match card content: merge cards show their diff (the runner previews a
review's tree against its worktree HEAD), every card carries legal and
architecture scores, the null under command cards is gone.
025 Radio speak card: no hint text, a rounder flowing card, a MAYDAY toggle
beside push to talk.
026 widget zoom: zoom a widget's content by keyboard and the context menu.
027 slash skill suggestions: every field that messages agents suggests
skills after a slash, from a skills index the tree timer writes.
028 Resources accounts: an Accounts panel (provider, renewal, resets, usage
and remaining, host-local, emails never in git) and panel checkboxes.
029 Controls layout: Rules and Groups pages laid out.
030 Yes/No answers as buttons, and nothing hides: rows the runner cannot
run stay greyed with the reason.
031 mic in fields.
Line comments (operator 2026-11-24): wherever code waits for a grant
(Waits on Operator, the stream, the review overlay) selected lines or a
right-clicked row take a comment that marks its lines and collects on the
card; Deny opens with them as the reason and Call preselected, Grant sends
them after the signed grant as one post. Requirement 003 decision 4 and
its contract follow.

Tests are written for every requirement and run once on this head.

🎯 Fix: 80 %
💥 Break: 20 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: ~95 %
🏆 Score: 61
🚦 Gate: ⛔ fix 80 % < 90, break 20 % > 5; security ~95 % < 100: ask the operator before the commit

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 01:22:03 +00:00

41 lines
1.9 KiB
Python

from __future__ import annotations
import json
import subprocess
import unittest
import hub_support
MODULE = hub_support.HUB / "templates" / "settings-files.js"
LISTED = r"""
const S = require(process.argv[1]);
const files = JSON.parse(process.argv[2]);
const paths = (result) => ({shown: result.shown.map((file) => file.path), missing: result.missing});
console.log(JSON.stringify({folded: paths(S.listed(files, false)), open: paths(S.listed(files, true))}));
"""
def files() -> list[dict]:
present = [{"path": f"/p/{index:02d}/.claude/settings.json", "folder": True, "error": ""} for index in range(10)]
present[7]["error"] = "unreadable: ValueError"
present[3]["error"] = "a link or no directory on the path: Not a directory"
absent = [{"path": f"/a/{index:02d}/.claude/settings.json", "folder": False, "error": "no directory: create it first"} for index in range(30)]
older = {"path": "/o/.claude/settings.json", "error": ""}
return [*absent[15:], present[5], *present[:5], *absent[:15], older, *present[6:]]
class TestSettingsFiles(unittest.TestCase):
def test_files_without_their_folder_fold_away_and_error_rows_lead_then_paths_in_order(self):
done = subprocess.run(["node", "-e", LISTED, str(MODULE), json.dumps(files())], capture_output=True, text=True, timeout=60, check=False)
self.assertEqual(done.returncode, 0, done.stderr)
found = json.loads(done.stdout)
errors = ["/p/03/.claude/settings.json", "/p/07/.claude/settings.json"]
rest = [f"/p/{index:02d}/.claude/settings.json" for index in range(10) if index not in (3, 7)]
self.assertEqual(found["folded"], {"shown": [*errors, "/o/.claude/settings.json", *rest], "missing": 30})
self.assertEqual(found["open"]["shown"], [*errors, "/o/.claude/settings.json", *rest, *[f"/a/{index:02d}/.claude/settings.json" for index in range(30)]])
self.assertEqual(found["open"]["missing"], 30)
if __name__ == "__main__":
unittest.main()