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:
1 parent
ca97776b4d
commit
b15dd5e414
11 files changed
+301
-49
No files matched your search
@@ -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()
|
||||
Reference in new issue
Block a user