Scan all of library/ for backticks in shadow-CSS comments
Some checks are pending
build-gate / build (push) Waiting to run
Some checks are pending
build-gate / build (push) Waiting to run
This gate's own header records fixing exactly this bug once already: it walked plugin-designs one level deep, missed the shadow-CSS components under <bundle>/src/components/, reported PASS, and the build broke with a misleading Babel error far from the edit. The note ends "it was wrong about WHICH files, which is the more dangerous failure because it reports success." The other half of the list was never fixed. library/ stayed a hand-written list of three .vue paths while 17 files under library/ carry a useShadowStyles literal. Injecting a backtick into a CSS comment in library/components/hints/PinHint.vue left this gate green AND check:sfc-parse green -- so the documented failure mode was reachable in 36 unscanned files. Now walks library/ the same way plugin-designs is walked: 47 files scanned becomes 84. The injected backtick fails by name at PinHint.vue:236. A hand-maintained file list decays silently, because nothing announces that a new file should have been added to it. That is what makes this worse than a wrong rule -- the rule was always right and was simply never shown the file. The status line also hardcoded "+ 4 library/internal" and so under-reported coverage while sounding precise. Counts are now derived from the file list. Noting a wrong turn for the next reader: the first negative test used a plain string replace and hit the first match at line 140, which is outside any literal, so the gate correctly ignored it and I briefly read that as the fix not working. PinHint has two literals; the target was in the second.
This commit is contained in:
parent
5e6bed7d7a
commit
8609de969e
1 changed files with 35 additions and 4 deletions
|
|
@ -53,11 +53,36 @@ function pluginDesignVues() {
|
|||
return out
|
||||
}
|
||||
|
||||
// ★ THE SAME SCOPE BUG, A SECOND TIME — now in the OTHER half of the list (2026-09-22).
|
||||
// The note above records fixing plugin-designs/ by recursing instead of globbing one level. But
|
||||
// `library/` stayed a hand-written list of THREE .vue files, and 17 files under library/ carry a
|
||||
// useShadowStyles(`…`) literal. So a backtick inside a CSS comment in any of the other 14 — e.g.
|
||||
// library/components/hints/PinHint.vue — passed this gate AND passed check:sfc-parse, and would
|
||||
// have broken the build later with the far-away Babel error this script exists to replace.
|
||||
// MEASURED: injecting `LICENCE \`obligation\`` into PinHint.vue's literal left both gates green.
|
||||
//
|
||||
// A hand-maintained file list decays silently, because nothing tells you when a new file should
|
||||
// have been added to it. That is what makes this class worse than a wrong rule: the rule was
|
||||
// always right, and it was simply never shown the file. Walk the tree instead, so coverage is a
|
||||
// consequence of where code lives rather than of someone remembering.
|
||||
function vuesUnder(root) {
|
||||
if (!existsSync(root)) return []
|
||||
const out = []
|
||||
const walk = (d) => {
|
||||
for (const e of readdirSync(d, { withFileTypes: true })) {
|
||||
if (e.name === 'node_modules' || e.name.startsWith('.')) continue
|
||||
const p = join(d, e.name)
|
||||
if (e.isDirectory()) walk(p)
|
||||
else if (e.name.endsWith('.vue')) out.push(p)
|
||||
}
|
||||
}
|
||||
walk(root)
|
||||
return out
|
||||
}
|
||||
|
||||
const FILES = [
|
||||
'library/layouts/VerticalTabsLayout.vue',
|
||||
'library/layouts/StackLayout.vue',
|
||||
'library/ProfileLoader.vue',
|
||||
'internal/generate-tree.mjs',
|
||||
...vuesUnder('library'),
|
||||
...pluginDesignVues(),
|
||||
]
|
||||
|
||||
|
|
@ -154,5 +179,11 @@ if (bad) {
|
|||
// wrong about its INPUT SET, and that failure mode reports SUCCESS.
|
||||
console.log(
|
||||
`TEMPLATE-LITERAL: PASS — no stray backticks inside template-literal CSS comments ` +
|
||||
`(checked ${FILES.length} file(s): ${FILES.length - 4} under plugin-designs + 4 library/internal).`
|
||||
// Counts are DERIVED, not hardcoded. The previous label said "+ 4 library/internal" because the
|
||||
// library side used to be a hand-written list of exactly four paths; after that list became a
|
||||
// tree walk the constant would have under-reported coverage by 36 files while sounding precise.
|
||||
// A number in a status line is documentation, and documentation drifts — compute it.
|
||||
`(checked ${FILES.length} file(s): ${FILES.filter((f) => f.startsWith('plugin-designs')).length} under ` +
|
||||
`plugin-designs + ${FILES.filter((f) => f.startsWith('library')).length} under library + ` +
|
||||
`${FILES.filter((f) => f.startsWith('internal')).length} internal).`
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue