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>
68 lines
2.9 KiB
Python
68 lines
2.9 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import unittest
|
|
|
|
from hub_support import HUB
|
|
|
|
PASSKEY = HUB / "templates" / "page-passkey.js"
|
|
PROBE = """
|
|
const source = require("fs").readFileSync(process.argv[1], "utf8");
|
|
const toasts = [];
|
|
const gates = [];
|
|
let asked = 0;
|
|
let served = 0;
|
|
const window = {location: {hostname: "localhost", port: "8737", pathname: "/", hash: ""}};
|
|
const navigator = {credentials: {get: () => {
|
|
asked += 1;
|
|
return new Promise((resolve, reject) => gates.push({resolve, reject}));
|
|
}}};
|
|
const sendJson = async () => {
|
|
served += 1;
|
|
return {ok: true, data: {payload: {nonce: served}, challenge: "AAAA", credentials: ["AAAA"]}};
|
|
};
|
|
const toast = (title) => toasts.push(title);
|
|
const bytes = new Uint8Array([1]).buffer;
|
|
const credential = {rawId: bytes, response: {clientDataJSON: bytes, authenticatorData: bytes, signature: bytes}};
|
|
const P = new Function("window", "navigator", "sendJson", "toast", "fail", "h", "promptText", "document", "vanish", `${source}\\nreturn {signedProof};`)(window, navigator, sendJson, toast, () => [], () => ({remove: () => {}}), (label) => label, {body: {append: () => {}}}, (node) => node.remove());
|
|
const tick = () => new Promise((resolve) => setImmediate(resolve));
|
|
const nonce = (signed) => (signed ? signed.proof.payload.nonce : null);
|
|
(async () => {
|
|
const first = P.signedProof("/api/board/sign", {action: "resume"}, "Resume");
|
|
const second = P.signedProof("/api/board/sign", {action: "resume"}, "Resume");
|
|
await tick();
|
|
const open = {asked, served, toasts: [...toasts]};
|
|
gates.splice(0).forEach((gate) => gate.resolve(credential));
|
|
const both = [nonce(await first), nonce(await second)];
|
|
const canceled = P.signedProof("/api/board/sign", {action: "drain"}, "Drain");
|
|
await tick();
|
|
gates.splice(0).forEach((gate) => gate.reject(new Error("canceled")));
|
|
const dropped = nonce(await canceled);
|
|
const after = P.signedProof("/api/board/sign", {action: "suspend"}, "Suspend");
|
|
await tick();
|
|
gates.splice(0).forEach((gate) => gate.resolve(credential));
|
|
console.log(JSON.stringify({open, both, canceled: dropped, after: nonce(await after), asked, toasts}));
|
|
})();
|
|
"""
|
|
|
|
|
|
class TestPasskeyPage(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
done = subprocess.run(["node", "-e", PROBE, str(PASSKEY)], capture_output=True, text=True, timeout=60, check=True)
|
|
cls.data = json.loads(done.stdout)
|
|
|
|
def test_a_second_signature_while_one_is_open_asks_no_passkey_and_sends_nothing(self):
|
|
self.assertEqual(self.data["open"], {"asked": 1, "served": 1, "toasts": ["Resume: not signed"]})
|
|
self.assertEqual(self.data["both"], [1, None])
|
|
|
|
def test_a_canceled_signature_frees_the_next_one(self):
|
|
self.assertIsNone(self.data["canceled"])
|
|
self.assertEqual((self.data["after"], self.data["asked"]), (3, 3))
|
|
self.assertEqual(self.data["toasts"], ["Resume: not signed", "Drain: not signed"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|