fix(match): release card repairs, hotfix 092

An Ask accepted while pending expired before the release, and the hub
refused all 11 decisions with a raw 409. The release card now checks
every row first: an unreleasable row turns red with its reason, Release
names the rows on click, and a red Cancel drops them and their cards.
A hub refusal names the card's title and marks its row. The verdict pill
opens a menu (options, Accept, Reject, Back to the stack, impossible
entries greyed with their reason). Back to the stack puts the card
behind the release card, last in the deck. W no longer puts a skipped
card in front of the release card. An expired decision no longer claims
its tool call went back to the terminal.

🎯 Fix: 85 %
💥 Break: 8 %
💸 Tokens: -
⏱️ Velocity: -
🛡️ Security: 100 %
🏆 Score: 78
🚦 Gate: ⛔ fix 85 % < 90, break 8 % > 5 (E2E rerun after 085 to 094, operator word 2026-11-27)

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-27 20:53:57 +00:00
1 parent ca97776b4d
commit b15dd5e414
11 files changed
+301 -49

No files matched your search

+11 -3
View File
@@ -84,8 +84,11 @@ FLOW = """(async () => {@HELPERS@
const leaned = await swipe(width * 0.4, 0);
await until(() => front() !== order[2], 3000);
order.push(front());
key("w");
await until(() => front() !== order[3], 3000);
order.push(front());
const short = await swipe(width * 0.1, 0);
const stayed = front() === order[3];
const stayed = front() === order[4];
await swipe(width * 0.4, 4);
const overview = await until(() => document.querySelector("#main .match-overview"), 3000);
const rows = overview ? all("#main .match-decision").map((item) => [item.dataset.card, item.dataset.verdict, text(item.querySelector(".match-decision-feedback"))]) : [];
@@ -102,7 +105,12 @@ FLOW = """(async () => {@HELPERS@
found.kept = all("#main .match-decision").length;
}
const flashed = new Set();
const watch = window.setInterval(() => all("#main .match-card").forEach((node) => flashed.add(node.dataset.card)), 20);
const shownBefore = new Set(all("#main .match-card").map((node) => node.dataset.card));
let cleared = false;
const watch = window.setInterval(() => {
cleared = cleared || Boolean(document.querySelector("#main .match-stack .empty"));
all("#main .match-card").filter((node) => !node.hasAttribute("data-blocked") && (cleared || !shownBefore.has(node.dataset.card))).forEach((node) => flashed.add(node.dataset.card));
}, 20);
found.toast = await toastAfter(() => document.querySelector("#main .match-release").click());
found.emptied = @SIGNS@ ? Boolean(await until(() => document.querySelector("#main .match-stack .empty"), 15000)) : false;
await sleep(@SIGNS@ ? 2500 : 0);
@@ -175,7 +183,7 @@ class TestMatchRelease(HubCase):
def check_flow(self, found: dict) -> None:
reason = f"{FIRST}:3: rename it"
self.assertNotIn("error", found, found)
self.assertEqual(found["order"], [self.cards[0], self.cards[1], self.cards[2], self.cards[1]], found)
self.assertEqual(found["order"], [self.cards[0], self.cards[1], self.cards[2], "release", self.cards[1]], found)
self.assertEqual((found["prefill"], found["leaned"], found["short"], found["stayed"]), (reason, "accept", "accept", True), found)
expected = [[self.cards[0], "reject", f"{reason}\nalso add a test"], [self.cards[1], "accept", None], [self.cards[2], "accept", None]]
self.assertEqual(sorted(found["rows"]), sorted(expected), found)
+4 -1
View File
@@ -65,9 +65,12 @@ WASD = """(async () => {@HELPERS@@CARD@@STEPS@
for (let step = 0; step < 8; step += 1) {
lap.push(await press("w"));
}
while (front() !== "release") {
for (let tries = 0; tries < 12 && front() !== "release"; tries += 1) {
await press("w");
}
if (front() !== "release") {
return {error: "W never brought the release card", seen, lap};
}
const onRelease = {a: await press("a")};
document.querySelector("#main .match-open-overview").click();
await until(releasing, 3000);
+7 -2
View File
@@ -48,7 +48,12 @@ RELEASED = """(async () => {@HELPERS@@CARD@@STEPS@
if (!(await until(card, 8000)) || !(await decideAll())) {
return {error: text(document.getElementById("main")).slice(0, 300)};
}
return {title: document.querySelector("#main .match-release").title};
const risk = document.querySelector('#main .match-decision[data-card="@RED@"] .match-accept-risk');
if (risk) {
risk.click();
}
const release = await until(() => document.querySelector("#main .match-release"), 4000);
return release ? {title: release.title} : {error: text(document.getElementById("main")).slice(0, 300)};
})()"""
@@ -63,7 +68,7 @@ class TestUndoDial(deck.ReleaseDeck):
def test_chromium_sets_the_undo_window_on_a_dial_and_every_undo_text_names_the_saved_seconds(self):
steps = [
{"width": 1366, "height": 768, "url": f"{self.base}?dial#stream/inbox", "wait": 1500, "shot": str(OUT / "chromium-1366-undo-dial.png"), "probe": deck.probe(TEXTS, red=f"review:{self.red}")},
{"width": 1920, "height": 1080, "url": f"{self.base}?dial-release#tasks/match", "wait": 1500, "shot": str(OUT / "chromium-1920-undo-release.png"), "probe": deck.probe(RELEASED)},
{"width": 1920, "height": 1080, "url": f"{self.base}?dial-release#tasks/match", "wait": 1500, "shot": str(OUT / "chromium-1920-undo-release.png"), "probe": deck.probe(RELEASED, red=f"review:{self.red}")},
]
data = self.drive(steps, None, init=deck.INIT)
(OUT / "chromium-undo-dial.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
+8 -3
View File
@@ -12,7 +12,7 @@ from kvb_orchestrator import batches, skill_scripts
from kvb_orchestrator.asking import TERMINAL
from kvb_orchestrator.denying import LAPSED
from kvb_orchestrator.inbox import LAPSE_WINDOW, lapsed_of
from kvb_orchestrator.matching import EXPIRED, EXPIRED_REASON, expired_card
from kvb_orchestrator.matching import EXPIRED, EXPIRED_REASONS, expired_card
from test_hub_match import MatchCase
FEEDBACK = "run it again after the gate"
@@ -49,9 +49,14 @@ class TestExpiredFilter(unittest.TestCase):
def test_an_expired_card_is_greyed_with_blocked_kind_expired_and_keeps_its_expires(self):
card = expired_card({"id": "ask:a1", "kind": "ask", "blocked": "", "stale": False}, 990.0)
self.assertEqual((card["blocked_kind"], card["blocked"], card["expires"], card["stale"]), (EXPIRED, EXPIRED_REASON, 990.0, False))
self.assertEqual((card["blocked_kind"], card["blocked"], card["expires"], card["stale"]), (EXPIRED, EXPIRED_REASONS["ask"], 990.0, False))
self.assertIn(LAPSED, card["blocked"].lower())
def test_an_expired_decision_says_its_agent_stopped_waiting_not_that_a_tool_call_returned(self):
card = expired_card({"id": "decision:d1", "kind": "decision", "blocked": "", "stale": False}, 990.0)
self.assertEqual(card["blocked"], EXPIRED_REASONS["decision"])
self.assertNotIn("tool call", card["blocked"])
class TestExpiredRelease(MatchCase):
def radio(self) -> list[list[str]]:
@@ -81,7 +86,7 @@ class TestExpiredRelease(MatchCase):
def test_an_expired_ask_stays_a_greyed_card_with_its_expiry_but_leaves_the_inbox_and_the_badge(self):
ask = self.lapsed_ask(CALLED)
card = self.card(f"ask:{ask}")
self.assertEqual((card["kind"], card["blocked_kind"], card["blocked"], card["to"]), ("ask", EXPIRED, EXPIRED_REASON, "Skills"))
self.assertEqual((card["kind"], card["blocked_kind"], card["blocked"], card["to"]), ("ask", EXPIRED, EXPIRED_REASONS["ask"], "Skills"))
self.assertEqual(card["expires"], self.httpd.hub.asks.get(ask)["expires"])
snapshot = self.snapshot()
self.assertNotIn(ask, [item["id"] for item in snapshot["inbox"]])
+2 -2
View File
@@ -87,8 +87,8 @@ class TestReleaseCardLast(unittest.TestCase):
def test_a_new_card_queues_before_the_release_card(self):
self.assertEqual(self.data["fresh"], "a,b,c,release")
def test_later_puts_a_card_before_the_release_card(self):
self.assertEqual(self.data["later"], "a,c,b,release")
def test_later_puts_a_card_behind_the_release_card(self):
self.assertEqual(self.data["later"], "a,c,release,b")
def test_a_shown_release_card_stays_in_front_and_new_cards_queue_behind_it(self):
self.assertEqual(self.data["shown"], "release,b,c,a,d")
+92
View File
@@ -0,0 +1,92 @@
from __future__ import annotations
import json
import re
import subprocess
import unittest
from hub_support import HUB
MATCH = HUB / "templates" / "page-match.js"
NAMES = ("lapsedCard", "toBack", "logStep", "backToStack", "unreleasable", "risky", "releasePlan")
PROBE = r"""
const vm = require("vm");
const sandbox = {
RELEASE: "release",
matchView: {order: [], decisions: new Map(), history: []},
refusedIds: new Map(),
expiredWords: () => "expired 20:41, 3 minutes ago",
drawMatch: () => {},
out: {},
};
vm.runInNewContext(process.argv[1], sandbox);
vm.runInNewContext(`
const accept = {verdict: "accept"};
const reject = {verdict: "reject"};
const card = (id, extra) => ({id, ref: id, kind: "ask", title: id, blocked: "", ...extra});
const expired = card("x", {blocked: "expired", blocked_kind: "expired"});
out.expiredAccept = unreleasable(expired, accept);
out.expiredReject = unreleasable(expired, reject);
out.blocked = unreleasable(card("b", {blocked: "runs", blocked_kind: "running"}), accept);
out.fine = unreleasable(card("f"), accept);
refusedIds.set("r", "expired");
out.refused = unreleasable(card("r"), accept);
const plan = releasePlan([[expired, accept], [card("f"), accept], [card("w", {withdrawn: true}), reject]]);
out.plan = {bad: plan.bad.map(([c]) => c.id), rest: plan.rest.map(([c]) => c.id), gone: plan.gone.map(([c]) => c.id)};
matchView.order = ["a", "release", "c"];
matchView.decisions.set("a", accept);
refusedIds.set("a", "expired");
backToStack(card("a"));
out.order = matchView.order.join(",");
out.undecided = !matchView.decisions.has("a") && !refusedIds.has("a");
out.steps = matchView.history.length;
`, sandbox);
console.log(JSON.stringify(sandbox.out));
"""
def extracted() -> str:
source = MATCH.read_text(encoding="utf-8")
parts = []
for name in NAMES:
found = re.search(rf"^ const {name} = [^\n]*;$", source, re.MULTILINE) or re.search(rf"^ (?:function {name}\(|const {name} = ).*?^ }};?$", source, re.MULTILINE | re.DOTALL)
if found is None:
raise AssertionError(f"{name} not found in {MATCH}")
parts.append(found.group(0).replace(f"const {name} = ", f"var {name} = "))
return "\n".join(parts)
class TestReleaseCardRepairs(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_accepted_card_that_expired_names_its_expiry(self):
self.assertEqual(self.data["expiredAccept"], "expired 20:41, 3 minutes ago: can no longer be granted; reject or drop it")
def test_a_reject_of_an_expired_card_still_releases(self):
self.assertEqual(self.data["expiredReject"], "")
def test_a_blocked_card_names_its_block(self):
self.assertIn("not possible now: runs", self.data["blocked"])
def test_a_card_the_hub_refused_names_the_refusal(self):
self.assertIn("the hub refused it: expired", self.data["refused"])
def test_a_fine_card_releases(self):
self.assertEqual(self.data["fine"], "")
def test_the_plan_keeps_bad_rows_out_of_the_signed_batch(self):
self.assertEqual(self.data["plan"], {"bad": ["x"], "rest": ["f"], "gone": ["w"]})
def test_back_to_the_stack_puts_the_card_last_behind_the_release_card(self):
self.assertEqual(self.data["order"], "release,c,a")
self.assertTrue(self.data["undecided"])
self.assertEqual(self.data["steps"], 1)
if __name__ == "__main__":
unittest.main()