fix(hub): the grant label helper no longer redeclares labelOf, and the grant-mode probe escapes its inner templates

14bb4f3 added function labelOf(item) to page-grant.js beside page-dom.js's labelOf(key), the agent name every other page file calls. The assembled page script then stopped parsing ('Identifier labelOf has already been declared'), so the hub page could not load, and test_page_scope, test_hub_page, test_page_reveal and the decision-row, inbox-gone and operator-task harnesses failed on it. The item helper is now grantLabel(item); its 5 callers in page-inbox.js follow, page-dom.js keeps labelOf.

The same commit put two template literals (b${proofs.length} and ${label}: ) inside test_hub_grant_mode.py's probe, itself a template literal, so they closed it early; both are escaped now.

Checks: the assembled page parses with no name declared twice (test_page_scope's own parse_error and clashes helpers, called inline), and node --check passes the probe. No test ran: the full suite runs again on master after the four fix bundles (operator order).

Security: MEDUSA over the 7 files of the four fix bundles on master: 100, all covered, 0 open findings.

🎯 Fix: 90 %
💥 Break: 2 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 88
🚦 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:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-22 23:28:53 +00:00
1 parent a4f7017691
commit 9b8e2a7d71
3 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@
* @param {Object} item a batchable inbox item.
* @returns {string} the label its grant carries: the picked option, else a decision's recommendation, else "".
*/
function labelOf(item) {
function grantLabel(item) {
const label = chosenLabel(item);
if (label !== undefined) {
return label;
+4 -4
View File
@@ -138,13 +138,13 @@
*/
const choiceOf = (item, after) => {
if (item.kind === "decision") {
return choiceDialog(item, {pick: (label) => { after(); chooseOne(item, label); }, toggled: new Set(), chosen: ui.selected.has(keyOf(item)) ? labelOf(item) : "", locked: item.held, hint: signsFor(item), group: "", other: OTHER_PROMPT});
return choiceDialog(item, {pick: (label) => { after(); chooseOne(item, label); }, toggled: new Set(), chosen: ui.selected.has(keyOf(item)) ? grantLabel(item) : "", locked: item.held, hint: signsFor(item), group: "", other: OTHER_PROMPT});
}
if (item.kind === "ask") {
return choiceDialog(askDialog(item.id), {pick: (answer, typed) => { after(); answerAsk(item, answer, typed); }, toggled: new Set(), chosen: ui.selected.has(keyOf(item)) ? ALLOW : "", locked: item.held, hint: `your passkey signs it, the answer goes to ${item.to || "its session"}`, group: "", other: TELL});
}
const told = answerOf(item);
const shown = told || (ui.selected.has(keyOf(item)) ? labelOf(item) : "");
const shown = told || (ui.selected.has(keyOf(item)) ? grantLabel(item) : "");
return asked(item) ? [answerTo(item), choiceDialog(item, {pick: (label) => { after(); answerPick(item, label); }, toggled: new Set(), chosen: shown, locked: item.held || Boolean(told), hint: signsFor(item), group: "", other: OTHER_PROMPT})] : null;
};
@@ -186,7 +186,7 @@
return;
}
const rows = [...usable, ...alone].map((item) => h("li", {},
h("div", {class: "row"}, pill(ITEM_LABELS[item.kind], KIND_TONES[item.kind]), !deny && labelOf(item) ? h("span", {class: "muted"}, revealed(`→ ${shownPick(labelOf(item))}`)) : null),
h("div", {class: "row"}, pill(ITEM_LABELS[item.kind], KIND_TONES[item.kind]), !deny && grantLabel(item) ? h("span", {class: "muted"}, revealed(`→ ${shownPick(grantLabel(item))}`)) : null),
h("strong", {}, revealed(item.title)),
item.kind === "operator" ? h("div", {class: "command"}, h("code", {}, revealed(item.command))) : null,
item.kind === "operator" ? h("span", {class: "muted"}, revealed(`in ${item.directory}`)) : null,
@@ -201,7 +201,7 @@
}
}
if (usable.length) {
await submit(usable.map((item) => (deny ? denialOf(item, reason.value) : entryOf(item, "approve", labelOf(item)))), `${label}: ${usable.length} entries`);
await submit(usable.map((item) => (deny ? denialOf(item, reason.value) : entryOf(item, "approve", grantLabel(item)))), `${label}: ${usable.length} entries`);
}
});
openSheet(label, [h("p", {class: "muted"}, deny ? DENY_NOTE : grantNote(alone.length, usable.length)), h("ul", {class: "mini"}, rows), ...(deny ? [reasonChips(reason), h("label", {class: "deny-reason"}, "Reason (optional, every requester reads it)", reason)] : []),