From ad9a3976a9d93b695c2e56762c5ff51f704896c1 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 1 Oct 2026 16:25:48 -0700 Subject: [PATCH] fix: say the camera catalog has no cameras rather than none exist An empty camera answer outside the catalog's regions read as "0 public cameras", as if the area had none. It now says the catalog has no cameras there. --- src/tools/queries/media.js | 6 +++++- src/tools/queries/media.test.mjs | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tools/queries/media.js b/src/tools/queries/media.js index 675ef2a27..f866c9c86 100644 --- a/src/tools/queries/media.js +++ b/src/tools/queries/media.js @@ -92,7 +92,11 @@ export const findCctvCameras = defineTool({ .sort((a, b) => a.distance_km - b.distance_km); return { summary: - `${countNoun(rows.length, 'public camera')} in ${area.label}` + + (rows.length || trimmed.length + ? `${countNoun(rows.length, 'public camera')} in ${area.label}` + : // The catalog covers selected regions; an empty answer elsewhere + // means it has no cameras there, not that none exist. + `The camera catalog has no cameras in ${area.label}`) + (trimmed.length ? ` (the catalog serves only some cameras here: ${trimmed .map( diff --git a/src/tools/queries/media.test.mjs b/src/tools/queries/media.test.mjs index d7d014df7..a024191e7 100644 --- a/src/tools/queries/media.test.mjs +++ b/src/tools/queries/media.test.mjs @@ -321,4 +321,8 @@ test('an area the catalog trimmed away entirely is not reported complete', async area: { lat: 40.7, lon: -74, radius_km: 3 }, }); assert.equal(elsewhere.data.complete, true); + assert.equal( + elsewhere.summary, + 'The camera catalog has no cameras in 3 km around 40.700, -74.000.', + ); });