diff --git a/internal/check-gospel-engine-contract.mjs b/internal/check-gospel-engine-contract.mjs index c7d33f5f1..59cd364dc 100644 --- a/internal/check-gospel-engine-contract.mjs +++ b/internal/check-gospel-engine-contract.mjs @@ -93,28 +93,20 @@ const run = async (browser, provider, block) => { const fails = [] -/* ═══ THE STATIC ARM, AND WHY THE SELF-TEST LIVES HERE ════════════════════════════════════════ - * The six runtime measurements are the behavioural evidence, but they cannot be made to fail on - * demand: with the fallback deleted, planting a substitute engine on the PAGE proves nothing — - * the leaf correctly ignores it, so the arms pass and a --poison that expected a failure was - * asserting the wrong thing (measured: it reported "this check cannot see the defect", about - * itself). The defect is a line of SOURCE, so the falsifiable arm reads the source. */ -const LEAF_SRC = resolve(HERE, '../plugin-designs/gospel-resources/resources-map.vue') -let src = readFileSync(LEAF_SRC, 'utf8') -if (POISON) src = src.replace('const gl = engineGlobal(grProvider)\n', 'const gl = engineGlobal(grProvider) || window.mapboxgl\n') -/* COMMENTS STRIPPED FIRST. The fix's own comment QUOTES the deleted line — "this used to read - `engineGlobal(grProvider) || window.mapboxgl`" — and the first version of this arm read that - quotation as the defect, failing the very commit that removed it. A gate that cannot tell code - from prose about code will keep flagging the explanation forever. */ -const code = src.replace(/\/\*[\s\S]*?\*\//g, ' ').replace(/(^|[^:'"\\])\/\/[^\n]*/g, '$1') -const BAD = /engineGlobal\([^)]*\)\s*\|\|/ -if (BAD.test(code)) { - fails.push('resources-map.vue falls back from engineGlobal() to another engine global — a page that asked for the keyless engine would silently get the one that needs a token') -} +/* ⚠ THE STATIC ARM LIVES ELSEWHERE NOW, DELIBERATELY. It used to read this leaf's source for a + * cross-engine fallback, and check:no-silent-engine-substitution does that for EVERY plugin. Two + * gates owning one source-level rule means this leaf was checked twice while the others were + * checked once, and the copy that drifts is always the narrower one. What stays here is the part + * no source read can do: the six RUNTIME measurements below. + * + * ⚠ SO --poison HAS NOTHING TO FALSIFY HERE. With the fallback deleted, planting a substitute + * engine on the PAGE proves nothing (the leaf correctly ignores it), which is measured: an earlier + * runtime poison reported "this check cannot see the defect" about itself. The falsifiable arm went + * with the static check, and this one says so rather than pretending. + */ if (POISON) { - if (!fails.length) { console.error('ENGINE-CONTRACT --poison: the reintroduced `|| window.mapboxgl` was NOT caught — this check cannot see the defect it exists for.'); process.exit(1) } - console.log(`ENGINE-CONTRACT --poison: caught it — ${fails[0]}`) - console.log('ENGINE-CONTRACT: SELF-TEST PASS — the static arm fails as designed. The six runtime measurements are not re-run here; they cannot be forced to fail without reintroducing the defect in a built bundle.') + console.log('ENGINE-CONTRACT --poison: the falsifiable source arm is check:no-silent-engine, run with --self-test; it owns that rule tree-wide and sits in gates:post as of main 23976fb0.') + console.log('ENGINE-CONTRACT: the six runtime measurements cannot be forced to fail without reintroducing the defect in a built bundle.') process.exit(0) } @@ -152,7 +144,7 @@ try { for (const f of fails) console.error(` ${f}`) process.exit(1) } - console.log('ENGINE-CONTRACT: PASS — the source keeps no cross-engine fallback, and 2 providers x 3 load states: the engine asked for or a named failure, never a substitute.') + console.log('ENGINE-CONTRACT: PASS — 2 providers x 3 load states: the engine asked for or a named failure, never a substitute.') } finally { try { await browser?.close() } catch (_) {} try { srv?.close?.() } catch (_) {}