fix: verify bounded analyst scope and empty satellite identity

This commit is contained in:
Bilawal Sidhu committed 2026-09-15 02:18:42 -05:00
1 parent b3f1e17733
commit 5c3f558766
3 files changed
+16 -1

No files matched your search

+14
View File
@@ -248,3 +248,17 @@ test('helpers: haversine sanity + scope radius', () => {
const scoped = applyScope(FLIGHTS, { kind: 'radius' }, { center: { lat: 30.27, lon: -97.74 }, km: 50 });
assert.deepEqual(scoped.map((f) => f.id).sort(), ['GND1', 'SWA1']);
});
test('bounded loaded cohorts disclose truncation before filtering and retain it on follow-up', async () => {
const engine = createAnalystEngine({
getRecords: () => [{ id: 'sample dam', lat: 0, lon: 0, name: 'sample' }],
getRecordCoverage: () => ({ basis: 'bounded-loaded-records', recordsExamined: 1, loadedCount: 3000, sourceTruncated: true }),
getViewContext: () => ({ lat: 0, lon: 0, viewRadiusKm: 25 }),
});
const result = await engine.query({ layers: ['local-dams'], scope: { kind: 'anywhere' }, sortBy: 'distance' });
assert.equal(result.count, 1);
assert.equal(result.coverage.layersQueried[0].sourceTruncated, true);
assert.match(result.coverage.note, /omitted records may change the nearest item or count/);
const followUp = await engine.query({ followUp: true });
assert.equal(followUp.coverage.layersQueried[0].loadedCount, 3000);
});
+1
View File
@@ -175,6 +175,7 @@ test('infra getAnalystRecords: enabled layer snapshots loaded stems; disable ret
assert.deepEqual(layer.getAnalystRecords(), [], 'disable keeps stems but analyst snapshot is empty');
} finally {
layer.destroy(viewer);
assert.deepEqual(layer.getAnalystRecords(), [], 'destroy releases analyst records');
globalThis.fetch = originalFetch;
if (originalWindow === undefined) delete globalThis.window;
else globalThis.window = originalWindow;
+1 -1
View File
@@ -15,7 +15,7 @@ import { ISS_NORAD } from './policy.js';
export function mapAnalystRecord(raw) {
const num = (v) => (Number.isFinite(v) ? v : null);
const text = (v) => { const t = String(v ?? '').trim(); return t || null; };
const noradNum = Number(raw?.noradId);
const noradNum = raw?.noradId == null || raw.noradId === '' ? NaN : Number(raw.noradId);
const noradId = Number.isFinite(noradNum) ? String(Math.trunc(noradNum)) : text(raw?.noradId);
const name = text(raw?.name);
const group = text(raw?.group);