From bd4f9eaee414d4739b3c87d60a0e963ea558c1c8 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Tue, 10 Nov 2026 15:01:39 +0400 Subject: [PATCH] Keep the strict scenarios in step with main's photos and satellite groups Main's flight photos ask Planespotters for every tracked aircraft, which the strict network policy counted as a violation; the harness now answers those lookups with no photos, as the other QA scripts already do. Main also reads five more TLE groups (resource, weather, planet, SAR and science): the satellite fixture serves them, and the space switch expects all twelve groups and derives its catalog sizes from the fixture. --- scripts/qa-space-engine-switch.mjs | 36 +++++++++++++++++++++-------- scripts/qa-strict-harness.mjs | 15 ++++++++++++ src/bench/satelliteFixture.js | 5 ++++ src/bench/satelliteFixture.test.mjs | 5 ++++ 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/scripts/qa-space-engine-switch.mjs b/scripts/qa-space-engine-switch.mjs index b00adc8c1..a97a4e502 100644 --- a/scripts/qa-space-engine-switch.mjs +++ b/scripts/qa-space-engine-switch.mjs @@ -31,8 +31,20 @@ await strict.run({}, async (b) => { 'galileo', 'geo', 'starlink', + 'resource', + 'weather', + 'planet', + 'sar', + 'science', ].map((g) => [g, satelliteFixture(g)]), ); + // The core catalog is every group but Starlink, which only the dense + // catalog adds; each fixture satellite is three lines. + const satellitesIn = (g) => groups[g].trim().split('\n').length / 3; + const coreCount = Object.keys(groups) + .filter((g) => g !== 'starlink') + .reduce((sum, g) => sum + satellitesIn(g), 0); + const denseCount = coreCount + satellitesIn('starlink'); await p.evaluateOnNewDocument( (groups, launches, epoch) => { const fetch = window.fetch.bind(window); @@ -76,14 +88,18 @@ await strict.run({}, async (b) => { } else await dataManager.setEnabled('satellites', true, { origin: 'user' }); }, missions); if (!missions) { - await p.waitForFunction(() => window.sa.getStats().count === 839, { - timeout: 40000, - }); + await p.waitForFunction( + (count) => window.sa.getStats().count === count, + { timeout: 40000 }, + coreCount, + ); console.log('core catalog ready'); await p.evaluate(() => window.sa.setParams({ catalog: 'dense' })); - await p.waitForFunction(() => window.sa.getStats().count === 6839, { - timeout: 60000, - }); + await p.waitForFunction( + (count) => window.sa.getStats().count === count, + { timeout: 60000 }, + denseCount, + ); console.log('dense catalog ready'); assert.ok( await p.evaluate(() => window.sa.trackById(25544, { origin: 'user' })), @@ -119,7 +135,7 @@ await strict.run({}, async (b) => { before.mission, before.replay?.active, ); - // Each source read exactly once: the seven TLE groups of the dense + // Each source read exactly once: the twelve TLE groups of the dense // catalog; in Space Missions the launch list and every TLE group the // mission view asks for. const groupPaths = Object.keys(groups).map((g) => '/api/celestrak/' + g); @@ -130,7 +146,7 @@ await strict.run({}, async (b) => { layer, missions ? 'the launch list and each TLE group read exactly once' - : 'each of the seven TLE groups read exactly once', + : 'each of the twelve TLE groups read exactly once', Object.values(reads).every((n) => n === 1) && (missions ? reads['/api/launches'] === 1 @@ -181,7 +197,7 @@ await strict.run({}, async (b) => { before.replay.phaseProgress, ); } else { - assert.equal(state.sat.count, 6839); + assert.equal(state.sat.count, denseCount); assert.equal(state.params.selectedSatTrackingId, 25544); assert.ok(state.follow && state.ring > 0); assert.equal(state.sat.lastUpdate, before.stamp); @@ -191,7 +207,7 @@ await strict.run({}, async (b) => { layer, missions ? 'same models; Space Missions mode, the same mission paused at the same progress, speed 4' - : 'same models; 6 839 objects, the ISS tracked with its ring, same update stamp', + : `same models; ${denseCount} objects, the ISS tracked with its ring, same update stamp`, ); await readsOnce(); } diff --git a/scripts/qa-strict-harness.mjs b/scripts/qa-strict-harness.mjs index de9d9821f..4b459d95b 100644 --- a/scripts/qa-strict-harness.mjs +++ b/scripts/qa-strict-harness.mjs @@ -29,6 +29,20 @@ import { import { createMissLoader, tileCacheFile } from './qa/tileCache.mjs'; import { closeBrowser, diagnoseExit, exitAfterFlush } from './qa/browser.mjs'; import { DAYTIME, shiftTime } from './qa/time.mjs'; +import { + PLANESPOTTERS_EMPTY_BODY, + PLANESPOTTERS_ORIGIN, +} from './qa-photo-stub.mjs'; + +// Tracking a civil flight asks Planespotters for its photo; strict runs +// answer every lookup with no photos instead of leaving the machine. +const PHOTO_ROUTE = Object.freeze({ + pattern: `${PLANESPOTTERS_ORIGIN}/*`, + respond: () => ({ + contentType: 'application/json', + body: PLANESPOTTERS_EMPTY_BODY, + }), +}); export const ENGINES = Object.freeze(['cesium', 'navara']); /** What the Globe Engine picker offers: the engines and Navara HD. */ @@ -104,6 +118,7 @@ export async function installStrictNetwork( }, ) { const preview = new URL(origin); + routes = [...routes, PHOTO_ROUTE]; fixtures = [...fixtures, ...routes.map((route) => route.pattern)]; const urlPatterns = strictBlockPatterns(origin, { fixtures, tileHosts }); const answers = routes.map((route) => ({ diff --git a/src/bench/satelliteFixture.js b/src/bench/satelliteFixture.js index ca6fa03ed..103f5d74c 100644 --- a/src/bench/satelliteFixture.js +++ b/src/bench/satelliteFixture.js @@ -28,6 +28,11 @@ const GROUPS = { galileo: [42000, 30, 56, 1.7047, 'QA GALILEO'], geo: [45000, 32, 0.1, 1.0027, 'QA GEO'], starlink: [50000, 6000, 53, 15.2, 'QA STARLINK'], + resource: [60000, 12, 98.2, 14.6, 'QA RESOURCE'], + weather: [61000, 8, 98.7, 14.1, 'QA WEATHER'], + planet: [62000, 24, 97.5, 15.1, 'QA PLANET'], + sar: [63000, 6, 97.9, 15.0, 'QA SAR'], + science: [64000, 6, 28.5, 15.1, 'QA SCIENCE'], }; export const SATELLITE_FIXTURE_EPOCH = W1_FROZEN_MS; export function satelliteFixture(group) { diff --git a/src/bench/satelliteFixture.test.mjs b/src/bench/satelliteFixture.test.mjs index d70c3b965..472e023f3 100644 --- a/src/bench/satelliteFixture.test.mjs +++ b/src/bench/satelliteFixture.test.mjs @@ -16,6 +16,11 @@ test('satellite fixture has distinct, valid SGP4 catalogs including LEO, MEO and galileo: 30, geo: 32, starlink: 6000, + resource: 12, + weather: 8, + planet: 24, + sar: 6, + science: 6, }; for (const [group, count] of Object.entries(counts)) { const lines = satelliteFixture(group).trim().split('\n');