fix: say when the camera catalog serves only part of a region

Camera packs keep their nearest cameras and the catalog cap thins them
further, so London answered 250 cameras while TfL offers many more. The
catalog now records each pack's full count, tags cameras with their pack,
and serves the packs it trimmed; find_cctv_cameras names them.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent e779432925
commit 66b07418bd
6 files changed
+117 -11

No files matched your search

+36
View File
@@ -246,3 +246,39 @@ test('a stale or degraded radio directory is reported', async () => {
);
assert.equal(result.data.degraded, true);
});
test('cameras from a trimmed catalog pack are reported as partial', async () => {
const catalog = composeCatalog({
tools: coreTools,
services: {
cctv: {
getCatalog: async () => ({
trimmedPacks: [
{ pack: 'tfl', available: 900, served: 250 },
{ pack: 'other', available: 10, served: 5 },
],
sources: [
{
id: 'jam-1',
name: 'Strand',
lat: 51.51,
lon: -0.12,
pack: 'tfl',
},
],
}),
},
},
});
const result = await catalog.call('find_cctv_cameras', {
area: { lat: 51.51, lon: -0.12, radius_km: 5 },
});
assert.equal(result.data.complete, false);
assert.deepEqual(result.data.catalog_trimmed, [
{ pack: 'tfl', available: 900, served: 250 },
]);
assert.match(
result.summary,
/\(the catalog serves only some cameras here: 250 of 900 from tfl\)\.$/,
);
});