fix: report stale and partial data in more tool answers

A sweep for the same pattern found more answers presented as current and
complete: launches and satellite orbits served from a stale proxy cache, a
regional aircraft fallback read as worldwide, license plate cameras trimmed
or partly loaded, and a radio directory of popular stations read as every
station. The launch and satellite sources now report the proxies' stale
markers, and each answer says what it covers.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent 6a45a8f6a2
commit e779432925
10 files changed
+185 -25

No files matched your search

+46
View File
@@ -150,3 +150,49 @@ test('satellites overhead are those above the elevation, highest first', async (
/^0 satellites from the stations group are at least 90° above/,
);
});
test('stale orbit and launch data are reported', async () => {
const stale = {
readGroup: async () => ({ ok: true, status: 200, text: TLE, stale: true }),
};
const catalog = composeCatalog({
tools: coreTools,
services: {
satellites: stale,
clock: CLOCK,
launches: {
getLaunchSnapshot: async () => ({ payload: [], stale: true }),
},
},
});
const overhead = await catalog.call('satellites_overhead', {
location: { lat: 0, lon: 0 },
});
assert.equal(overhead.data.stale, true);
assert.match(overhead.summary, /\(orbit data may be stale\)\.$/);
const launches = await catalog.call('get_recent_launches', {});
assert.equal(launches.data.stale, true);
assert.match(launches.summary, /\(data may be stale\)\.$/);
});
test('satellite and launch sources read the proxies stale markers', async () => {
const { createSatelliteSource } =
await import('../../layers/satellites/source.js');
const { createLaunchSource } =
await import('../../layers/launches/source.js');
const satellites = createSatelliteSource({
fetchImpl: async () =>
new Response(TLE, { headers: { 'x-tle-cache': 'STALE-ERROR' } }),
});
assert.equal((await satellites.readGroup('stations')).stale, true);
const launches = createLaunchSource({
fetchImpl: async () =>
Response.json([], { headers: { 'X-GEV-Cache': 'STALE-ERROR' } }),
});
assert.deepEqual(await launches.getLaunchSnapshot(), {
payload: [],
stale: true,
});
const { getLaunches } = launches;
assert.deepEqual(await getLaunches(), []);
});