Gospel Resources tables: the loading line calls the page's own translator, so it no longer throws on every load; a gate keeps template translators bound
This commit is contained in:
parent
15d0ef3558
commit
723cd53b43
3 changed files with 51 additions and 2 deletions
|
|
@ -117,6 +117,7 @@
|
|||
"check:gospel-internet": "node plugin-designs/gospel-internet/scripts/check-gospel-internet-model.mjs && node plugin-designs/gospel-internet/scripts/check-gospel-internet-i18n.mjs && node plugin-designs/gospel-internet/scripts/check-language-tree.mjs && node plugin-designs/gospel-internet/scripts/check-gospel-internet-render.mjs",
|
||||
"check:gospel-tables-staged": "node internal/check-gospel-tables-staged.mjs",
|
||||
"check:gospel-clear-filter-url": "node plugin-designs/gospel-resources/scripts/check-clear-filter-url.mjs && node plugin-designs/gospel-resources/scripts/check-clear-filter-url.mjs --poison",
|
||||
"check:gospel-template-translators": "node plugin-designs/gospel-resources/scripts/check-template-translators.mjs && node plugin-designs/gospel-resources/scripts/check-template-translators.mjs --poison",
|
||||
"check:gospel-whiteboard": "node internal/check-gospel-whiteboard.mjs",
|
||||
"check:hardcoded-english": "node internal/check-hardcoded-english.mjs",
|
||||
"check:hardcoded-english:self-test": "node internal/check-hardcoded-english.mjs --self-test",
|
||||
|
|
@ -360,7 +361,7 @@
|
|||
"fix:sri": "node internal/fix-sri.mjs",
|
||||
"gallery": "node internal/generate-gallery.mjs",
|
||||
"gates:post": "node internal/run-parallel.mjs --label=post -- check:capability-derived check:drop check:parse verify check:sri check:public-hygiene check:label-joins check:facet-cascade check:facet-one-field check:heartbeat check:kpi-unit check:composite-reg check:descriptions check:no-abs-paths check:no-codename check:dep-names check:composite-srcs check:embed-targets check:nested-token check:i18n-parity check:tabs-localized check:packets-all check:packet-strings-parity check:zone-census check:zoning-declared check:share-policy check:library-index check:csv-shape check:capability-citations check:catalog-identity check:no-orphan-gates check:quoted-scripts check:script-flags check:capability-exemplars check:packet-fixture check:packet-browser check:provider-switch check:locale-reachable check:url-resolver check:manifest-covers check:one-palette check:pin-dim-slider check:legend-source check:clustering-modes check:composite-embed-knobs check:composite-locale-leaks check:linked-vocabulary check:wp-embed check:dashboard-geocoder-provider check:leaf-engine-per-provider check:auto-engine check:engine-contract check:map-props-unit check:composites-mount check:composite-interop check:no-free-identifiers check:map-fly-reduced-motion check:mst-clustering check:list-prop-unit check:profiles-mount check:cdn-pins check:no-eval check:popup-escaping check:i18n-treeshake check:pinned-umd check:one-palette:self-test check:no-cross-plugin-imports check:no-cross-plugin-imports:self-test check:map-attribution check:studio-rail check:approx-pin-note check:embedder-keys check:provider-for check:legend-logical-insets check:legend-logical-insets:self-test check:optional-t-equivalence check:text-highlight check:religion-label-not-value check:i18n-stopped-scope check:no-silent-engine check:no-silent-engine:self-test check:regions-uses-library check:shadow-css-parses check:square-map-controls check:preset-config-merge check:instance-config-keys check:frozen-labels check:plural-forms check:region-fill-repaint check:region-paint-single-source check:poster-print-fallback check:posters-exportable check:country-names check:reduced-motion check:no-dead-library check:universal-props check:readme-size check:tree-relative check:leaf-hints check:snippet-engine check:snippet-engine:self-test check:embed-base check:link-coverage check:no-public-binds check:shared-reached check:tree-weight check:no-fleet-names:self-test check:pin-hint-floor:self-test check:poster-sizes:self-test check:shell-header:self-test check:preview-flag-dev-only:self-test check:poster-type-registry:self-test check:host-floor:self-test check:phone-print-keep:self-test check:pinned-fetch-fresh:self-test",
|
||||
"gates:pre": "node internal/run-parallel.mjs --label=pre -- check:template-literal check:mjs-parse check:sfc-parse check:tab-radius check:synced-css check:doc-scripts check:setup-order check:package-json-unique-keys check:no-repo-pb-hooks check:no-credentials-omit check:no-credentials-omit:self-test check:shadow-reduced-motion check:poster-action-print check:targets check:targets:self-test check:browser-gates-guarded check:pin-selection check:facet-shape check:hardcoded-english:self-test check:list-selection check:selector-fields check:upg-zone-joins check:gospel-set-charts check:gospel-set-fit check:describe-group check:one-scroll-container check:packet-charts check:pins-in-state check:fork-leaders check:circular-layout check:composite-token-url check:language-tree-layout check:i18n-keys-exist check:i18n-never-translated check:packet-variants check:profile-table check:element-bootstrap check:embed-url-absolute check:frame-target check:language-tree-model check:map-menu-anchor check:selection-kinds check:tiered-points check:whiteboard-projection check:mercator-slice check:ring-vocabulary check:map-props-unit check:mobile-gating check:provide-shadowing check:legend-top-offset check:cdn-cache check:plural-forms check:select-zone-race check:script-registry check:map-control-overlap check:poster-attribution check:board-map-options check:gospel-whiteboard check:packet-map-missing-loud check:poster-layout-optin check:ported-globals-identical check:ring-bands check:packet-a1-structure check:india-states check:batch-selection-export check:zone-title-tier-a check:evangelical-share check:map-labels check:packet-offline check:help-reachable check:gated-not-in-tree check:window-globals-released check:legend-data-contract check:no-internal-role-nouns check:poster-fetch-guard check:people-group-records check:sentence-slots check:popup-href-escaped check:popup-pan-controls check:country-map-refetch check:pane-config-reforward check:viewport-meta check:viewport-meta:self-test check:label-key-coverage check:poster-browser-equiv check:poster-render-pinned check:country-sheet-one-path check:country-sheet-one-path:self-test check:side-lanes check:side-lanes:self-test check:poster-section check:poster-section:self-test check:posterverse-shelf check:host-locale-fetch check:print-frame-reclaim check:click-sheet check:coverage-consistent:chained check:coverage-consistent:poison check:dashboard-filter-a11y check:filter-multivalue check:hover-channel check:kit-options-reachable check:layout-key-namespaced check:legend-mirrors check:map-unmount-race check:no-conflict-markers check:series-isolation check:snapshot-guard check:stale-sweep-claim check:surfaces-read-the-tier check:translator-contacts check:wall-wysiwyg check:wall-print-watch check:wall-no-bg-photos check:wall-pan check:template-i18n check:list-pattern-doc check:shadow-style-labels-unique check:grid-image-loading check:retry-fetch check:panel-sheets check:poster-wall-host-seams check:poster-sections check:poster-sections:self-test check:poster-design-catalogue check:poster-design-catalogue:self-test check:upg100-zone-copy check:upg100-zone-copy:self-test check:wall-photo-weight check:no-fleet-names check:pin-hint-floor check:poster-sizes check:upg-count check:shell-header check:pg-name-gate check:preview-flag-dev-only check:poster-type-registry check:host-floor check:phone-print-keep check:pinned-fetch-fresh check:view-address check:view-address:self-test check:gospel-clear-filter-url",
|
||||
"gates:pre": "node internal/run-parallel.mjs --label=pre -- check:template-literal check:mjs-parse check:sfc-parse check:tab-radius check:synced-css check:doc-scripts check:setup-order check:package-json-unique-keys check:no-repo-pb-hooks check:no-credentials-omit check:no-credentials-omit:self-test check:shadow-reduced-motion check:poster-action-print check:targets check:targets:self-test check:browser-gates-guarded check:pin-selection check:facet-shape check:hardcoded-english:self-test check:list-selection check:selector-fields check:upg-zone-joins check:gospel-set-charts check:gospel-set-fit check:describe-group check:one-scroll-container check:packet-charts check:pins-in-state check:fork-leaders check:circular-layout check:composite-token-url check:language-tree-layout check:i18n-keys-exist check:i18n-never-translated check:packet-variants check:profile-table check:element-bootstrap check:embed-url-absolute check:frame-target check:language-tree-model check:map-menu-anchor check:selection-kinds check:tiered-points check:whiteboard-projection check:mercator-slice check:ring-vocabulary check:map-props-unit check:mobile-gating check:provide-shadowing check:legend-top-offset check:cdn-cache check:plural-forms check:select-zone-race check:script-registry check:map-control-overlap check:poster-attribution check:board-map-options check:gospel-whiteboard check:packet-map-missing-loud check:poster-layout-optin check:ported-globals-identical check:ring-bands check:packet-a1-structure check:india-states check:batch-selection-export check:zone-title-tier-a check:evangelical-share check:map-labels check:packet-offline check:help-reachable check:gated-not-in-tree check:window-globals-released check:legend-data-contract check:no-internal-role-nouns check:poster-fetch-guard check:people-group-records check:sentence-slots check:popup-href-escaped check:popup-pan-controls check:country-map-refetch check:pane-config-reforward check:viewport-meta check:viewport-meta:self-test check:label-key-coverage check:poster-browser-equiv check:poster-render-pinned check:country-sheet-one-path check:country-sheet-one-path:self-test check:side-lanes check:side-lanes:self-test check:poster-section check:poster-section:self-test check:posterverse-shelf check:host-locale-fetch check:print-frame-reclaim check:click-sheet check:coverage-consistent:chained check:coverage-consistent:poison check:dashboard-filter-a11y check:filter-multivalue check:hover-channel check:kit-options-reachable check:layout-key-namespaced check:legend-mirrors check:map-unmount-race check:no-conflict-markers check:series-isolation check:snapshot-guard check:stale-sweep-claim check:surfaces-read-the-tier check:translator-contacts check:wall-wysiwyg check:wall-print-watch check:wall-no-bg-photos check:wall-pan check:template-i18n check:list-pattern-doc check:shadow-style-labels-unique check:grid-image-loading check:retry-fetch check:panel-sheets check:poster-wall-host-seams check:poster-sections check:poster-sections:self-test check:poster-design-catalogue check:poster-design-catalogue:self-test check:upg100-zone-copy check:upg100-zone-copy:self-test check:wall-photo-weight check:no-fleet-names check:pin-hint-floor check:poster-sizes check:upg-count check:shell-header check:pg-name-gate check:preview-flag-dev-only check:poster-type-registry check:host-floor check:phone-print-keep check:pinned-fetch-fresh check:view-address check:view-address:self-test check:gospel-clear-filter-url check:gospel-template-translators",
|
||||
"gen:iso3-to-alpha2": "node library/scripts/generate-iso3-to-alpha2.mjs",
|
||||
"internet:adm1": "node plugin-designs/cities-internet/scripts/build-adm1-internet.mjs",
|
||||
"library-index": "node internal/generate-library-index.mjs",
|
||||
|
|
@ -533,6 +534,7 @@
|
|||
"check:gated-not-in-tree": "a GATED profile (the build config's gatedProfiles, today key-cities) never reaches the public tree: no public/<tree>/<name>/ folder, no manifest.json entry, no page referencing <name>/<name>.js. vite.config.js builds a gated bundle into .gated/<tree>/ (ignored by git). Data tables are out of scope on purpose: key-cities.json also feeds the production Cities with Internet map. Two-sided: three planted leaks in a temporary tree, each caught. Node only.",
|
||||
"check:gospel-all": "EVERYTHING gospel-resources owns, in one command. Its ten gates were all hand-run, which is how a dead bundle shipped: a duplicate module killed all five leaves and the one gate run that day was pointed at the map. check:no-orphan-gates was right that they were reachable — reachable is not run. Deliberately NOT in gates:pre/post: three need a browser, the shared wave holds browser gates under load, and a bundle owner should not be able to slow everyone else's build by adding to a list they do not own. Static gates run first and stop the run on failure, so a scarce browser slot is never spent confirming a table is inconsistent. Exit 75 = NOT MEASURED, never folded into a pass.",
|
||||
"check:gospel-clear-filter-url": "the gospel tables' Show all drops ONLY its own filter keys (iso, country, label, province): the page's ?tab=, a host's or partner's keys, the #hash and the history state stay. It used to replaceState the bare pathname, wiping a partner's query. Proves the pure helper (filter-url.js) and that data-tables.vue calls it; --poison runs the old wipe and must fail.",
|
||||
"check:gospel-template-translators": "every translator a gospel-resources template calls (t, tr, T, tShared, tStatic) is a TOP-LEVEL binding of its <script setup>. data-tables.vue called t(...) while its translator is tr, so the tables page threw _ctx.t is not a function on every load and its loading line never drew. Static, node only; --poison restores the old call and must fail.",
|
||||
"check:gospel-internet": "the Gospel x Internet board, headless, against the REAL table and the REAL kit bus: the join table is what its builder makes from main (2,107 / 2,107, province placement agreeing with gospel-by-province), every facet count equals the rows the bus then keeps (the five-numbers-agree invariant), D1 OR-within-key, the country->province cascade, the 369 zero-access headline by band 220/45/45/59, URL state round-trip, CSV header-first/provenance-last with injection neutralised, no engagement column; then every catalogue key the bundle names exists in all 11 locales and is translated. Each half has a --poison arm that must fail. Plugin-local because check:i18n-keys-exist cannot see a useOptionalT-based alias.",
|
||||
"check:gospel-whiteboard": "the gospel set charts' geometry once drawn on a map: the bounded set's gap survives projection, the drawing stays inside the Mercator clamp, and three more properties, each with the arm that would catch its own defect. By the gospel owner. Headless.",
|
||||
"check:hardcoded-english": "English a reader sees that no locale can reach: template text, static title=, script-block sentences, template literals, and quoted literals inside BOUND attributes, across the production plugins. Quiet on translator calls (including discovered aliases and proxy-t misses), te()-guarded fallbacks, css, urls and developer error text. Deliberately NOT in gates:post yet: it reports 179 today (gospel-resources 148, my-upg-100-list 25, cities-internet 6 incl. one cross-area key), with English inside dir=ltr islands listed as deliberate and not counted; it joins when that reaches 0 or every hit is carded. The :self-test (28 assertions, fixtures validated first so a malformed sample cannot pass as silence) runs in gates:pre.",
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ useShadowStyles(
|
|||
</div>
|
||||
|
||||
<div v-if="loadErr" class="gt-err">{{ loadErr }}</div>
|
||||
<div v-else-if="!table" class="gt-load">{{ t('gospel.sheet.loadingTable', { table: current.label }) }}</div>
|
||||
<div v-else-if="!table" class="gt-load">{{ tr('gospel.sheet.loadingTable', { table: current.label }) }}</div>
|
||||
<DataTable
|
||||
v-else
|
||||
:key="current.id + ':' + fIso + ':' + fCountry + ':' + fProvince"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env node
|
||||
/**
|
||||
* check-template-translators.mjs — every translator a gospel-resources template calls is bound in its <script setup>.
|
||||
*
|
||||
* WHY: data-tables.vue's template called t(...) while its translator is `tr`, and no top-level `t` existed. A
|
||||
* <script setup> template resolves an unbound name through the component proxy (_ctx.t), so the tables page threw
|
||||
* "_ctx.t is not a function" (minified "I.t") on every load, the loading line never drew, and nothing failed a gate.
|
||||
*
|
||||
* For each .vue in plugin-designs/gospel-resources: the translator-shaped calls in its template (t, tr, T, tShared,
|
||||
* tStatic) must each be a TOP-LEVEL binding of its <script setup> (const / let / function / import), not a name
|
||||
* that only appears inside a function. `--poison` runs the same check on the old data-tables.vue line and must fail.
|
||||
* Exit 0 pass · 1 fail.
|
||||
*/
|
||||
import { readFileSync, readdirSync } from 'node:fs'
|
||||
import { resolve, dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const DIR = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const POISON = process.argv.includes('--poison')
|
||||
const NAMES = ['t', 'tr', 'T', 'tShared', 'tStatic']
|
||||
|
||||
function unbound(src) {
|
||||
const tpl = (src.match(/^<template>([\s\S]*)^<\/template>/m) || [])[1] || ''
|
||||
const script = (src.match(/^<script setup[^>]*>([\s\S]*?)^<\/script>/m) || [])[1] || ''
|
||||
// TOP-LEVEL bindings: declarations at column 0 of the script block, and imported names.
|
||||
const top = new Set()
|
||||
for (const m of script.matchAll(/^(?:const|let|var|function)\s+([A-Za-z_$][\w$]*)/gm)) top.add(m[1])
|
||||
for (const m of script.matchAll(/^(?:const|let|var)\s+\{([^}]*)\}\s*=/gm)) for (const n of m[1].split(',')) top.add(n.split(':').pop().trim())
|
||||
for (const m of script.matchAll(/^import\s+\{([^}]*)\}/gm)) for (const n of m[1].split(',')) top.add(n.split(/\s+as\s+/).pop().trim())
|
||||
const called = new Set([...tpl.matchAll(/(?:^|[^\w$.])([A-Za-z_$][\w$]*)\(/g)].map((m) => m[1]).filter((n) => NAMES.includes(n)))
|
||||
return [...called].filter((n) => !top.has(n))
|
||||
}
|
||||
|
||||
let fails = 0
|
||||
if (POISON) {
|
||||
const src = readFileSync(join(DIR, 'data-tables.vue'), 'utf8').replace("{{ tr('gospel.sheet.loadingTable'", "{{ t('gospel.sheet.loadingTable'")
|
||||
const u = unbound(src)
|
||||
console.log(u.includes('t') ? 'POISON OK: the old data-tables.vue call t(...) is caught as unbound' : 'POISON FAILED')
|
||||
process.exit(u.includes('t') ? 0 : 1)
|
||||
}
|
||||
for (const f of readdirSync(DIR).filter((f) => f.endsWith('.vue'))) {
|
||||
const u = unbound(readFileSync(join(DIR, f), 'utf8'))
|
||||
if (u.length) { fails++; console.log(`FAIL ${f}: the template calls ${u.map((n) => n + '(…)').join(', ')} but its <script setup> binds no such name at the top level`) }
|
||||
else console.log(`ok ${f}`)
|
||||
}
|
||||
console.log(fails ? `FAIL check-template-translators: ${fails}` : 'PASS check-template-translators')
|
||||
process.exit(fails ? 1 : 0)
|
||||
Loading…
Reference in a new issue