check:dashboard-geocoder-provider: a leaf with no search bar fails instead of passing hollow

It measured the research-dashboard leaf, which mounts no search bar, so every run reported 'search bars: 0'
and passed without ever exercising search. It now defaults to doxa-research-map/research-map (which mounts
the library GeocoderComponent), takes --leaf, and fails when no bar renders.
This commit is contained in:
Doxa Maps 2026-09-26 05:49:19 +00:00
parent 91c060974e
commit af436bff6f

View file

@ -28,9 +28,8 @@
* ASSERTIONS, on the built tree:
* maplibre ZERO requests to api.mapbox.com.
* both whatever search bars this leaf renders still produce suggestions — a zero bought by
* breaking search is not a fix. MEASURED: this leaf renders NONE, because the search
* header is not mounted here, so that half reports rather than asserts. Point the gate
* at a leaf that mounts the bars and it starts asserting again.
* breaking search is not a fix. A leaf with NO bar now FAILS (it used to pass hollow);
* the default leaf is doxa-research-map/research-map, which mounts one (--leaf to change).
*
* Exit: 0 pass or SKIP (no built tree, no browser, no data) · 1 fail.
*/
@ -51,9 +50,14 @@ let chromium
try { ({ chromium } = await import('playwright')) } catch { skip('playwright is not installed.') }
const manifest = JSON.parse(readFileSync(MANIFEST, 'utf8'))
const bundle = (manifest.bundles || []).find((b) => b.bundle === 'research-dashboard')
const profile = bundle && (bundle.profiles || []).find((p) => p.iframeUrl)
if (!profile) skip('the manifest declares no research-dashboard leaf to load.')
// ★ A LEAF THAT MOUNTS THE SEARCH BAR, or the suggestion half proves nothing (2026-09-26: the
// research-dashboard leaf renders no bar, so every run passed with "search bars: 0" — a hollow PASS).
// Default: the research map, which mounts the library GeocoderComponent. --leaf <bundle>/<profile>.
const leafArg = (() => { const i = process.argv.indexOf('--leaf'); return i >= 0 ? process.argv[i + 1] : 'doxa-research-map/research-map' })()
const [wantBundle, wantProfile] = leafArg.split('/')
const bundle = (manifest.bundles || []).find((b) => b.bundle === wantBundle)
const profile = bundle && (bundle.profiles || []).find((p) => p.iframeUrl && (!wantProfile || p.profile === wantProfile))
if (!profile) skip(`the manifest declares no ${leafArg} leaf to load.`)
const freePort = () => new Promise((ok) => {
const s = createServer().listen(0, '127.0.0.1', () => { const p = s.address().port; s.close(() => ok(p)) })
@ -114,8 +118,10 @@ try {
fails.push(`under maplibre the dashboard made ${mapboxCalls.length} request(s) to api.mapbox.com:`)
for (const u of [...new Set(mapboxCalls)].slice(0, 8)) fails.push(` ${u.slice(0, 150)}`)
}
// Reported, not asserted, when the leaf mounts no bars at all — see the header note.
if (search.bars && !search.suggestions) {
// NO BAR IS A FAILURE, not a pass: this gate exists to prove search still works with zero Mapbox calls.
if (!search.bars) {
fails.push(`under ${engine} the leaf rendered NO search bar, so search was never exercised — point --leaf at a leaf that mounts one.`)
} else if (!search.suggestions) {
fails.push(`under ${engine} the search bar rendered but typing produced no suggestions — zero Mapbox traffic bought by a broken search is not a fix.`)
}
}