From 63fb7fc834bb326197f658e8ddb5cc5ad0cfdb25 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Tue, 29 Sep 2026 04:56:58 +0000 Subject: [PATCH] check:selection-kinds requires a handler only for the export items this plugin can show The legend's card-deck item is opt-in: it sits behind v-if="exportCards", a prop that defaults to false. countries-map passes it and handles 'cards'; upg-100-list passes nothing, so its legend never shows the item and cannot emit it. The gate still demanded a 'cards' branch in upg-100-list's handler and failed gates:pre on a menu item that plugin never renders. An item guarded by a prop now needs a handler only where upg-100-list passes that prop. Both sides planted: upg-100-list opting in without a branch fails, and the legend losing the guard fails. --- internal/check-selection-kinds.mjs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/check-selection-kinds.mjs b/internal/check-selection-kinds.mjs index ee4ef0079..7dff731d2 100644 --- a/internal/check-selection-kinds.mjs +++ b/internal/check-selection-kinds.mjs @@ -131,8 +131,17 @@ for (const fn of ['onLegendExport', 'makeSelectionPacket', 'makeSelectionPoster' 'onLegendExport no longer splits the kind — a packet: emit would fall through as an unknown kind and print nothing') for (const kind of emitted) { const [base] = kind.split(':') - ok(base === 'poster' || base === 'packet', - `the legend emits '${kind}', whose base '${base}' is neither poster nor packet — the plugin's handler has no branch for it`) + if (base === 'poster' || base === 'packet') continue + // ★ AN OPT-IN ITEM IS ONLY THIS PLUGIN'S PROBLEM IF THIS PLUGIN OPTS IN. The card deck ('cards') sits + // behind v-if="exportCards", a prop that defaults to false: countries-map passes it and handles it, + // and a legend here that never shows the item cannot emit it. So an item guarded by a prop is + // required to have a handler branch only when upg-100-list.vue passes that prop. + const line = LEGEND.split('\n').find((l) => l.includes(`emitExport('${kind}')`)) || '' + const guard = (line.match(/v-if="(\w+)"/) || [])[1] + const kebab = guard && guard.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()) + const optedIn = !!guard && new RegExp(`[\\s:](?:${kebab}|${guard})\\b`).test(VUE) + ok(guard && !optedIn, + `the legend emits '${kind}', whose base '${base}' is neither poster nor packet — ${optedIn ? `upg-100-list passes ${guard}, but ` : ''}the plugin's handler has no branch for it`) } // The variant must actually travel to the renderer. Asserting the split alone would pass while // the parsed value was dropped on the floor.