feat(hub): Select collects option picks, rules and red-gate reviews too
In Select mode every grant button and every option pick toggles its item into the selection (operator 2026-11-20): a decision or decision row keeps the option picked for it and picking it again takes it out; a rule request or red-gate review joins the selection as a solo item. Grant n signs every batchable item under one passkey signature, then asks one more signature per rule and red-gate review, one after the other, since the server accepts neither inside a batch; the sheet's note counts them. Requirement 020 decision 3 and its acceptance criteria follow.
Stacked on allow (aa4a337). The one conflict in page-inbox.js keeps the ux reason chips in the deny sheet next to the new solo note. node --check and ruff pass.
Tests: test_hub_grant_mode (pick collects with its label, rule and red-gate review get their own signature after the batch). Written, not run: the full suite runs once on master after all bundles (operator order).
Security: MEDUSA over the staged tree on master: 100, no findings, all 5 files covered. The server checks are unchanged.
🎯 Fix: 90 %
💥 Break: 5 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 86
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa4a337c9a
commit
14bb4f38df
5 files changed
+191
-66
No files matched your search
@@ -11,18 +11,36 @@
|
||||
h("p", {class: "muted"}, RULE_HINTS[rule.kind]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} item a rule request.
|
||||
* @param {string} label the toast and passkey prompt label.
|
||||
* @returns {Promise<Object|null>} the accept body with the rule and its passkey assertion, null when the server refused or the operator cancelled.
|
||||
*/
|
||||
async function signRule(item, label) {
|
||||
const prepared = await sendJson(`/api/rule-requests/${encodeURIComponent(item.id)}/sign`, {});
|
||||
if (!prepared.ok || !prepared.data) {
|
||||
if (!closeGone(prepared, [keyOf(item)], label)) {
|
||||
toast(`${label}: not possible`, fail(prepared), false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const signed = await assertion(prepared.data, label);
|
||||
return signed ? {rule: prepared.data.payload, assertion: signed} : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} item a rule request.
|
||||
* @returns {Promise<boolean>} whether the rule was created.
|
||||
*/
|
||||
async function acceptRule(item) {
|
||||
const label = `Rule: ${short(item.title)}`;
|
||||
ui.busy = true;
|
||||
const prepared = await sendJson(`/api/rule-requests/${encodeURIComponent(item.id)}/sign`, {});
|
||||
const signed = prepared.ok && prepared.data ? await assertion(prepared.data, label) : null;
|
||||
if ((!prepared.ok || !prepared.data) && !closeGone(prepared, [keyOf(item)], label)) {
|
||||
toast(`${label}: not possible`, fail(prepared), false);
|
||||
}
|
||||
const result = signed ? await sendJson(`/api/rule-requests/${encodeURIComponent(item.id)}/accept`, {rule: prepared.data.payload, assertion: signed}) : null;
|
||||
const body = await signRule(item, label);
|
||||
const result = body ? await sendJson(`/api/rule-requests/${encodeURIComponent(item.id)}/accept`, body) : null;
|
||||
ui.busy = false;
|
||||
if (result && !closeGone(result, [keyOf(item)], label)) {
|
||||
toast(result.ok ? `Created: ${short(item.title)}` : `${label}: not created`, result.ok ? [] : fail(result), result.ok);
|
||||
}
|
||||
await load();
|
||||
return Boolean(result && result.ok);
|
||||
}
|
||||
Reference in new issue
Block a user