Files
skills/tests/test_hub_path_links.py
T
Kevin Veen-BirkenbachandClaude Opus 5.5 6323f087bc 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>
2026-11-28 01:47:41 +00:00

67 lines
2.6 KiB
Python

from __future__ import annotations
import json
import re
import subprocess
import unittest
from hub_support import HUB
DOM = HUB / "templates" / "page-dom.js"
PROBE = r"""
const vm = require("vm");
const sandbox = {};
vm.runInNewContext(process.argv[1], sandbox);
console.log(JSON.stringify(vm.runInNewContext(`({
absolute: vscodeHref("/home/op/repo"),
folder: vscodeHref("/home/op/repo/"),
encoded: vscodeHref("/home/op/my repo/a#b/100%.md"),
unicode: vscodeHref("/home/op/café?x=1"),
relative: vscodeHref("repo/src/app.py"),
dotted: vscodeHref("./src/app.py"),
empty: vscodeHref(""),
missing: vscodeHref(undefined),
under: vscodeHref(pathUnder("/repo/.worktrees/feature/match/", "src/my app.py")),
rootless: vscodeHref(pathUnder("", "src/app.py")),
relativeRoot: vscodeHref(pathUnder("repo", "src/app.py")),
fileless: pathUnder("/repo", ""),
})`, sandbox)));
"""
def extracted() -> str:
source = DOM.read_text(encoding="utf-8")
function = re.search(r"^ function vscodeHref\(.*?^ }$", source, re.MULTILINE | re.DOTALL)
under = re.search(r"^ const pathUnder = .*;$", source, re.MULTILINE)
if function is None or under is None:
raise AssertionError(f"vscodeHref or pathUnder not found in {DOM}")
return function.group(0) + "\n" + under.group(0).replace("const ", "var ", 1)
class TestPathLinks(unittest.TestCase):
@classmethod
def setUpClass(cls):
done = subprocess.run(["node", "-e", PROBE, extracted()], capture_output=True, text=True, timeout=60, check=False)
if done.returncode != 0:
raise AssertionError(done.stderr[-4000:])
cls.data = json.loads(done.stdout)
def test_an_absolute_path_becomes_a_vscode_file_link(self):
self.assertEqual(self.data["absolute"], "vscode://file/home/op/repo")
self.assertEqual(self.data["folder"], "vscode://file/home/op/repo/")
def test_every_segment_is_uri_encoded_and_the_slashes_are_kept(self):
self.assertEqual(self.data["encoded"], "vscode://file/home/op/my%20repo/a%23b/100%25.md")
self.assertEqual(self.data["unicode"], "vscode://file/home/op/caf%C3%A9%3Fx%3D1")
def test_a_relative_or_empty_path_gets_no_link(self):
self.assertEqual([self.data[key] for key in ("relative", "dotted", "empty", "missing")], ["", "", "", ""])
def test_a_diff_file_links_below_its_worktree_only_when_the_worktree_is_absolute(self):
self.assertEqual(self.data["under"], "vscode://file/repo/.worktrees/feature/match/src/my%20app.py")
self.assertEqual((self.data["rootless"], self.data["relativeRoot"], self.data["fileless"]), ("", "", ""))
if __name__ == "__main__":
unittest.main()