The LOCALE column clears for Big Picture: the held numerals decision is allowed at its one site
check:universal-props showed LOCALE 'warn' on research-dashboard and people-groups-grid, both inside Big
Picture. Neither bundle has an en-US of its own any more — the fold put every count through
formatCount(), so both warns cited the SAME line, library/utils/formatCount.js:26, COUNT_LOCALE = 'en-US'.
That line is not a bundle ignoring the reader; it is the held decision written down. NUMERALS ARE HELD —
counts do not follow the locale — so 'ok' is not available here without breaking the policy and the gate
that asserts it. This allows it the way regions-dashboard's popup is allowed, at the SITE.
The site is shared, which is the one thing regions' precedent did not cover. A `bundle:RULE:file` key
would need one entry per importer, so the LOCALE column would warn afresh every time a bundle adopted the
shared helper — the column punishing the fold that made the policy auditable in one line instead of eight
call sites. A `*:RULE:file` key is honoured for every bundle that compiles the file, and ONLY for a path
under library/. That restriction is the whole guard: a bundle's own source can never be wildcarded, so
this cannot be used to clear a column broadly.
Measured on main: 4 LOC-ENUS warns -> 2, both remaining pplr-data-maps' and not mine. research-dashboard
and people-groups-grid read 'allowed', regions-dashboard unchanged.
Negative-tested in both directions, because an exemption that is wider than it reads is the failure here:
a planted toLocaleString('en-US') inside research-dashboard's own composable warns again, and a planted
one in library/composables/useDashboardData.js — shared, imported, but not the allowed file — warns too.
A self-test now also refuses a `*:` entry outside library/, which the lookup would silently never honour.
This commit is contained in:
parent
82e05018ee
commit
a37a4e9c12
1 changed files with 29 additions and 1 deletions
|
|
@ -57,6 +57,16 @@ const BUNDLES = [
|
|||
'upg-neighbor', 'wall-of-people-groups', 'key-cities', 'gospel-internet',
|
||||
]
|
||||
const ALLOW = {
|
||||
'*:LOC-ENUS:library/utils/formatCount.js':
|
||||
'HELD DECISION, and this file IS the decision: formatCount() is the one place the count locale is '
|
||||
+ 'chosen, so COUNT_LOCALE = \'en-US\' is the policy written down rather than a bundle ignoring the '
|
||||
+ 'reader. NUMERALS ARE HELD -- counts do not follow the locale -- and folding every dashboard onto '
|
||||
+ 'this constant is what makes that auditable in one line instead of scattered across eight call '
|
||||
+ 'sites. Bundle-wildcarded ON PURPOSE: the alternative is one entry per importer, so the LOCALE '
|
||||
+ 'column warns every time a bundle adopts the shared helper -- punishing the fix and teaching '
|
||||
+ 'people to stop reading the column. Restricted to library/ (see the lookup): no per-bundle source '
|
||||
+ 'can be wildcarded, and a new toLocaleString(\'en-US\') inside research-dashboard or '
|
||||
+ 'people-groups-grid still warns. Revisit only if the Driver unholds numerals.',
|
||||
'prayer-walk-planner:ENG-PIN': 'keyless by design: always MapLibre, needs no token (index.js header)',
|
||||
'regions-dashboard:LOC-ENUS:plugin-designs/regions-dashboard/src/RegionCountryMap.vue':
|
||||
'HELD DECISION, not an oversight: the map popup formats population as fixed en-US on purpose. '
|
||||
|
|
@ -175,6 +185,15 @@ if (locWrong.length) {
|
|||
+ locWrong.map(([f, l]) => `${f ? 'missed' : 'false-flagged'}: ${l.slice(0, 56)}`).join(' | '))
|
||||
process.exit(3)
|
||||
}
|
||||
// The bundle-wildcard is honoured ONLY under library/. Pinned because the failure is silent: widen it
|
||||
// to any path and one entry could clear the column for a bundle's own source.
|
||||
const wildcardKeys = Object.keys(ALLOW).filter((k) => k.startsWith('*:'))
|
||||
const badWildcard = wildcardKeys.filter((k) => !k.split(':').slice(2).join(':').startsWith('library/'))
|
||||
if (badWildcard.length) {
|
||||
console.error('UNIVERSAL-PROPS: SELF-TEST FAILED — a `*:RULE:file` ALLOW entry outside library/ would '
|
||||
+ 'never be honoured by the lookup, so it silently exempts nothing: ' + badWildcard.join(', '))
|
||||
process.exit(3)
|
||||
}
|
||||
if (missed.length || falsePos.length) {
|
||||
console.error(`UNIVERSAL-PROPS: SELF-TEST FAILED — ${missed.length ? 'rules blind to a planted bypass: ' + missed.join(', ') : ''}${falsePos.length ? ' false positives on clean code: ' + falsePos.join(', ') : ''}`)
|
||||
process.exit(3)
|
||||
|
|
@ -251,7 +270,16 @@ for (const b of BUNDLES.filter((x) => !ONLY || ONLY.includes(x))) {
|
|||
// silenced any FUTURE operative en-US anywhere in that bundle -- clearing a column by going
|
||||
// blind. A `bundle:RULE:file` key exempts the one file that earned it and leaves the rest of the
|
||||
// bundle answerable.
|
||||
const allowed = ALLOW[`${b}:${r.id}:${relative(ROOT, f)}`] || ALLOW[`${b}:${r.id}`]
|
||||
// ★ AND A SHARED LIBRARY FILE CAN BE ALLOWED FOR EVERY BUNDLE THAT IMPORTS IT. A `*:RULE:file`
|
||||
// key is honoured only for a path under library/, because that is the one case where the site is
|
||||
// not the bundle's: library/utils/formatCount.js holds the HELD numerals decision for eight call
|
||||
// sites, and it is attributed to every bundle that compiles it. Per-importer entries would mean
|
||||
// the LOCALE column warns each time a bundle adopts the shared helper -- the column punishing the
|
||||
// fold that made the policy auditable. The library/ restriction is the whole guard: a bundle's own
|
||||
// source can never be wildcarded, so this cannot be used to clear a column broadly.
|
||||
const rel = relative(ROOT, f).replace(/\\/g, '/')
|
||||
const allowed = ALLOW[`${b}:${r.id}:${rel}`] || ALLOW[`${b}:${r.id}`]
|
||||
|| (rel.startsWith('library/') ? ALLOW[`*:${r.id}:${rel}`] : undefined)
|
||||
if (allowed) { if (matrix[b][r.prop] === 'ok') matrix[b][r.prop] = 'allowed'; continue }
|
||||
findings.push({ b, rule: r.id, prop: r.prop, warn: !!r.warn, where: `${relative(ROOT, f)}:${lineOf(src, idx)}`, text: src.slice(idx, idx + 70).replace(/\s+/g, ' ').trim() })
|
||||
matrix[b][r.prop] = r.warn ? (matrix[b][r.prop] === 'BYPASS' ? 'BYPASS' : 'warn') : 'BYPASS'
|
||||
|
|
|
|||
Loading…
Reference in a new issue