From 3b3bf29f9bab49f009f7578532e4d9e534f31c85 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:38:31 -0500 Subject: [PATCH 01/22] perf: cancel superseded imagery thumbnail refinement --- src/layers/recentImagery/thumbnails.js | 41 +++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/layers/recentImagery/thumbnails.js b/src/layers/recentImagery/thumbnails.js index 47c383f139..cd4c8fed7e 100644 --- a/src/layers/recentImagery/thumbnails.js +++ b/src/layers/recentImagery/thumbnails.js @@ -35,6 +35,8 @@ export function createThumbnailLoader({ const queue = []; let inFlight = 0; let touchCounter = 0; + let supersededQueued = 0; + let supersededInFlight = 0; let destroyed = false; function notify(key) { @@ -212,9 +214,39 @@ export function createThumbnailLoader({ candidates.length, extra, ); + const keys = []; order.forEach((index, priority) => { - this.request(candidates[index], box, priority); + const candidate = candidates[index]; + if (!candidate?.key) return; + keys.push(candidate.key); + this.request(candidate, box, priority); }); + return keys; + }, + + /** + * Keep only refinement work still wanted by the current UI intent. + * + * Known decoded/probed entries may remain warm under the LRU residency + * policy, but queued or in-flight acquisition for no-longer-wanted keys is + * cancelled. A cancelled known-present re-fetch keeps its proven metadata. + * @param {Iterable} keys + */ + retain(keys) { + const wanted = new Set(keys || []); + for (let index = queue.length - 1; index >= 0; index -= 1) { + const entry = queue[index]; + if (wanted.has(entry.key)) continue; + queue.splice(index, 1); + supersededQueued += 1; + if (entry.status === 'unknown') entries.delete(entry.key); + } + for (const entry of [...entries.values()]) { + if (!entry.loading || wanted.has(entry.key)) continue; + entry.controller?.abort(); + supersededInFlight += 1; + if (entry.status === 'unknown') entries.delete(entry.key); + } }, /** @@ -259,6 +291,13 @@ export function createThumbnailLoader({ return () => listeners.delete(listener); }, + refinementStats() { + return { + supersededQueued, + supersededInFlight, + }; + }, + stats() { return { inFlight, From 60bf311f90c6de6ee5d8841ecb8c377fca806606 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:38:36 -0500 Subject: [PATCH 02/22] perf: retain only current imagery thumbnail intent --- src/layers/recentImagery/index.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/layers/recentImagery/index.js b/src/layers/recentImagery/index.js index 23b12f44c1..8187872c21 100644 --- a/src/layers/recentImagery/index.js +++ b/src/layers/recentImagery/index.js @@ -568,12 +568,14 @@ export function createRecentImageryLayer({ const list = stripList(); if (!list.length) return; reconcileFocus(); - thumbnails.requestOrdered(list, _box, { - focusIndex: Math.max(0, focusIndexIn(list)), - firstVisible: _visible.first, - lastVisible: _visible.last, - extra: 2, - }); + const wanted = new Set( + thumbnails.requestOrdered(list, _box, { + focusIndex: Math.max(0, focusIndexIn(list)), + firstVisible: _visible.first, + lastVisible: _visible.last, + extra: 2, + }) || [], + ); for (const key of new Set([ _assigned.a, _assigned.b, @@ -581,8 +583,11 @@ export function createRecentImageryLayer({ _followKey, ])) { const candidate = candidateFor(key); - if (sourceOn(candidate)) thumbnails.request(candidate, _box, 0); + if (!sourceOn(candidate)) continue; + thumbnails.request(candidate, _box, 0); + wanted.add(candidate.key); } + thumbnails.retain?.(wanted); } function resetCatalog() { From ee8848e81f09fed30d7e89de9a618d88ea4d9099 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:38:39 -0500 Subject: [PATCH 03/22] test: track retained imagery thumbnail intent --- src/layers/recentImagery/testDoubles.mjs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/layers/recentImagery/testDoubles.mjs b/src/layers/recentImagery/testDoubles.mjs index 2b00e5b019..e6932a166a 100644 --- a/src/layers/recentImagery/testDoubles.mjs +++ b/src/layers/recentImagery/testDoubles.mjs @@ -275,6 +275,7 @@ export function fakeThumbnails() { const requested = []; /** Direct `request` calls: `[key, priority]`. */ const requests = []; + const retained = []; const ask = (key) => { if (!requested.includes(key)) requested.push(key); }; @@ -282,6 +283,7 @@ export function fakeThumbnails() { calls, requested, requests, + retained, requestOrdered(candidates, box, window) { calls.push(['ordered', candidates.map((c) => c.key), window]); const { focusIndex, firstVisible, lastVisible, extra } = window; @@ -291,12 +293,18 @@ export function fakeThumbnails() { lastVisible, candidates.length, extra, - ).forEach((index) => ask(candidates[index].key)); + ); + const keys = order.map((index) => candidates[index].key); + keys.forEach(ask); + return keys; }, request(candidate, box, priority) { ask(candidate.key); requests.push([candidate.key, priority]); }, + retain(keys) { + retained.push([...keys]); + }, /** Settle every requested key still unknown, as the loader would. */ probeRequested(status = 'present') { for (const key of requested) From c3fd6eaf24a302628baca6d571cbd1c3f8683960 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:38:43 -0500 Subject: [PATCH 04/22] test: cover stale thumbnail cancellation --- src/layers/recentImagery/thumbnails.test.mjs | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/layers/recentImagery/thumbnails.test.mjs b/src/layers/recentImagery/thumbnails.test.mjs index 891b2e8dd2..f88b05c5f7 100644 --- a/src/layers/recentImagery/thumbnails.test.mjs +++ b/src/layers/recentImagery/thumbnails.test.mjs @@ -315,3 +315,27 @@ test('a request queued behind an aborted fetch still starts once the abort settl tracked: 1, }); }); + + +test('retain aborts stale acquisition while allowing the current intent to start', async () => { + const { loader, fetch } = fixture({ maxInFlight: 1 }); + const stale = candidate('S30', '2026-09-10'); + const current = candidate('S30', '2026-09-11'); + + loader.request(stale, BOX, 0); + loader.request(current, BOX, 1); + assert.equal(fetch.calls.length, 1); + assert.match(fetch.calls[0].url, /TIME=2026-09-10/); + + loader.retain([current.key]); + assert.equal(fetch.calls[0].signal.aborted, true); + await settle(); + + assert.equal(fetch.calls.length, 2, 'current intent starts after stale abort'); + assert.match(fetch.calls[1].url, /TIME=2026-09-11/); + assert.deepEqual(loader.refinementStats(), { + supersededQueued: 0, + supersededInFlight: 1, + }); + assert.equal(loader.get(stale.key).status, 'unknown'); +}); From ab0754623e51c5134ff277ae46361f7e86adeeac Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:38:46 -0500 Subject: [PATCH 05/22] test: prove imagery layer retains current thumbnail intent --- src/layers/recentImagery/index.test.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/layers/recentImagery/index.test.mjs b/src/layers/recentImagery/index.test.mjs index 7675d0f3a9..ce90f7ad57 100644 --- a/src/layers/recentImagery/index.test.mjs +++ b/src/layers/recentImagery/index.test.mjs @@ -1061,6 +1061,10 @@ test('alpha, split and visible range notify without re-rendering the row', async f.layer.setSplit(0.25); f.layer.setVisibleRange(1, 3); assert.equal(f.thumbnails.calls.at(-1)[2].firstVisible, 1); + assert.ok( + f.thumbnails.retained.at(-1).includes(f.snap().focus.key), + 'the current focus remains in the retained refinement intent', + ); assert.equal(rowRenders, rows); assert.deepEqual(f.reasons.slice(-2), ['alpha', 'split']); f.layer.setAlpha('bad'); From 61d65aa2d872d15fdcea37ff83ea8c808daf973f Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:38:49 -0500 Subject: [PATCH 06/22] docs: record stale imagery thumbnail cancellation --- docs/CURRENT-STATE.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 22ce1eb3b2..4808b64197 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -1,3 +1,12 @@ +## Generation-style stale thumbnail cancellation — September 29, 2026 + +Recent Imagery thumbnail acquisition now retains only the current refinement +intent. When focus, visible strip range, pins or preview intent changes, queued +thumbnail work for no-longer-wanted days is removed and in-flight acquisition is +aborted. Already-probed/decoded entries may remain warm under the existing LRU +residency policy, and cancelling a re-fetch never forgets proven availability or +acquisition metadata. Diagnostics count superseded queued and in-flight work. + # God's Eye View Current State ## Cyber HUD — September 23, 2026 From 5e28b5a72c3ba4b42271aff29e09ae606aa405f0 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:38:54 -0500 Subject: [PATCH 07/22] docs: note stale imagery thumbnail cancellation --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58103d04da..1ffa66d1db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +- Cancel Recent Imagery thumbnail acquisition that no longer belongs to the current focus/visible/pin/preview intent. Stale queued work is removed and stale in-flight fetches are aborted while known-good decoded/probed entries may remain warm under the existing cache policy; cancellation counters are exposed for diagnostics. + - Public Overpass instances are no longer used by default. Street Traffic roads come from TomTom flow tiles, OpenFreeMap vector tiles, or both, chosen on the layer row (TomTom / OSM / Hybrid) or with `?trafficRoads=`. With a From 455d36fe9233cfbfe2fff527689b6fe9f389a12b Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:39:27 -0500 Subject: [PATCH 08/22] test: fix retained thumbnail order fake --- src/layers/recentImagery/testDoubles.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layers/recentImagery/testDoubles.mjs b/src/layers/recentImagery/testDoubles.mjs index e6932a166a..d96acada0e 100644 --- a/src/layers/recentImagery/testDoubles.mjs +++ b/src/layers/recentImagery/testDoubles.mjs @@ -287,7 +287,7 @@ export function fakeThumbnails() { requestOrdered(candidates, box, window) { calls.push(['ordered', candidates.map((c) => c.key), window]); const { focusIndex, firstVisible, lastVisible, extra } = window; - thumbnailOrder( + const order = thumbnailOrder( focusIndex, firstVisible, lastVisible, From 8b4952415e9396b13e5424244d3f6708d7fec883 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:39:31 -0500 Subject: [PATCH 09/22] test: format stale thumbnail cancellation proof --- src/layers/recentImagery/thumbnails.test.mjs | 46 +++++++++++--------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/layers/recentImagery/thumbnails.test.mjs b/src/layers/recentImagery/thumbnails.test.mjs index f88b05c5f7..d57d764726 100644 --- a/src/layers/recentImagery/thumbnails.test.mjs +++ b/src/layers/recentImagery/thumbnails.test.mjs @@ -316,26 +316,32 @@ test('a request queued behind an aborted fetch still starts once the abort settl }); }); +test( + 'retain aborts stale acquisition while allowing the current intent to start', + async () => { + const { loader, fetch } = fixture({ maxInFlight: 1 }); + const stale = candidate('S30', '2026-09-10'); + const current = candidate('S30', '2026-09-11'); -test('retain aborts stale acquisition while allowing the current intent to start', async () => { - const { loader, fetch } = fixture({ maxInFlight: 1 }); - const stale = candidate('S30', '2026-09-10'); - const current = candidate('S30', '2026-09-11'); + loader.request(stale, BOX, 0); + loader.request(current, BOX, 1); + assert.equal(fetch.calls.length, 1); + assert.match(fetch.calls[0].url, /TIME=2026-09-10/); - loader.request(stale, BOX, 0); - loader.request(current, BOX, 1); - assert.equal(fetch.calls.length, 1); - assert.match(fetch.calls[0].url, /TIME=2026-09-10/); + loader.retain([current.key]); + assert.equal(fetch.calls[0].signal.aborted, true); + await settle(); - loader.retain([current.key]); - assert.equal(fetch.calls[0].signal.aborted, true); - await settle(); - - assert.equal(fetch.calls.length, 2, 'current intent starts after stale abort'); - assert.match(fetch.calls[1].url, /TIME=2026-09-11/); - assert.deepEqual(loader.refinementStats(), { - supersededQueued: 0, - supersededInFlight: 1, - }); - assert.equal(loader.get(stale.key).status, 'unknown'); -}); + assert.equal( + fetch.calls.length, + 2, + 'current intent starts after stale abort', + ); + assert.match(fetch.calls[1].url, /TIME=2026-09-11/); + assert.deepEqual(loader.refinementStats(), { + supersededQueued: 0, + supersededInFlight: 1, + }); + assert.equal(loader.get(stale.key).status, 'unknown'); + }, +); From d38303fcd4af0938e2c48f784a8b0778b1cfcf8b Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Wed, 30 Sep 2026 20:51:50 -0500 Subject: [PATCH 10/22] chore: add one-shot branch formatter --- .github/workflows/tmp-format-fix.yml | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/tmp-format-fix.yml diff --git a/.github/workflows/tmp-format-fix.yml b/.github/workflows/tmp-format-fix.yml new file mode 100644 index 0000000000..40dce117ed --- /dev/null +++ b/.github/workflows/tmp-format-fix.yml @@ -0,0 +1,37 @@ +name: Temporary branch formatter + +on: + push: + branches: + - perf/imagery-stale-thumbnail-cancellation-20260929 + +permissions: + contents: write + +jobs: + format: + if: github.actor != 'github-actions[bot]' + runs-on: ubuntu-latest + env: + PUPPETEER_SKIP_DOWNLOAD: 1 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + ref: perf/imagery-stale-thumbnail-cancellation-20260929 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version: 24.14.0 + cache: npm + - run: npm ci + - run: npm run format + - name: Commit formatting + shell: bash + run: | + if git diff --quiet; then + exit 0 + fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -u + git commit -m "style: apply adopted formatting" + git push origin HEAD:perf/imagery-stale-thumbnail-cancellation-20260929 From 0de14670ed3559198627354a7f3f84c69629a4df Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 01:52:24 +0000 Subject: [PATCH 11/22] style: apply adopted formatting --- src/layers/recentImagery/thumbnails.test.mjs | 49 +++++++++----------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/src/layers/recentImagery/thumbnails.test.mjs b/src/layers/recentImagery/thumbnails.test.mjs index d57d764726..087430cf33 100644 --- a/src/layers/recentImagery/thumbnails.test.mjs +++ b/src/layers/recentImagery/thumbnails.test.mjs @@ -316,32 +316,29 @@ test('a request queued behind an aborted fetch still starts once the abort settl }); }); -test( - 'retain aborts stale acquisition while allowing the current intent to start', - async () => { - const { loader, fetch } = fixture({ maxInFlight: 1 }); - const stale = candidate('S30', '2026-09-10'); - const current = candidate('S30', '2026-09-11'); +test('retain aborts stale acquisition while allowing the current intent to start', async () => { + const { loader, fetch } = fixture({ maxInFlight: 1 }); + const stale = candidate('S30', '2026-09-10'); + const current = candidate('S30', '2026-09-11'); - loader.request(stale, BOX, 0); - loader.request(current, BOX, 1); - assert.equal(fetch.calls.length, 1); - assert.match(fetch.calls[0].url, /TIME=2026-09-10/); + loader.request(stale, BOX, 0); + loader.request(current, BOX, 1); + assert.equal(fetch.calls.length, 1); + assert.match(fetch.calls[0].url, /TIME=2026-09-10/); - loader.retain([current.key]); - assert.equal(fetch.calls[0].signal.aborted, true); - await settle(); + loader.retain([current.key]); + assert.equal(fetch.calls[0].signal.aborted, true); + await settle(); - assert.equal( - fetch.calls.length, - 2, - 'current intent starts after stale abort', - ); - assert.match(fetch.calls[1].url, /TIME=2026-09-11/); - assert.deepEqual(loader.refinementStats(), { - supersededQueued: 0, - supersededInFlight: 1, - }); - assert.equal(loader.get(stale.key).status, 'unknown'); - }, -); + assert.equal( + fetch.calls.length, + 2, + 'current intent starts after stale abort', + ); + assert.match(fetch.calls[1].url, /TIME=2026-09-11/); + assert.deepEqual(loader.refinementStats(), { + supersededQueued: 0, + supersededInFlight: 1, + }); + assert.equal(loader.get(stale.key).status, 'unknown'); +}); From 683fbe32eff70aa93566e3e8c3da521636f8d4dc Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Wed, 30 Sep 2026 20:52:56 -0500 Subject: [PATCH 12/22] chore: remove one-shot branch formatter --- .github/workflows/tmp-format-fix.yml | 37 ---------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/tmp-format-fix.yml diff --git a/.github/workflows/tmp-format-fix.yml b/.github/workflows/tmp-format-fix.yml deleted file mode 100644 index 40dce117ed..0000000000 --- a/.github/workflows/tmp-format-fix.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Temporary branch formatter - -on: - push: - branches: - - perf/imagery-stale-thumbnail-cancellation-20260929 - -permissions: - contents: write - -jobs: - format: - if: github.actor != 'github-actions[bot]' - runs-on: ubuntu-latest - env: - PUPPETEER_SKIP_DOWNLOAD: 1 - steps: - - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 - with: - ref: perf/imagery-stale-thumbnail-cancellation-20260929 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 - with: - node-version: 24.14.0 - cache: npm - - run: npm ci - - run: npm run format - - name: Commit formatting - shell: bash - run: | - if git diff --quiet; then - exit 0 - fi - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -u - git commit -m "style: apply adopted formatting" - git push origin HEAD:perf/imagery-stale-thumbnail-cancellation-20260929 From 82f7355837e9dae5f72003224448427f05934ec4 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Thu, 1 Oct 2026 00:52:10 -0500 Subject: [PATCH 13/22] chore: add one-shot downstream format fixer --- .github/workflows/downstream-format-fix.yml | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/downstream-format-fix.yml diff --git a/.github/workflows/downstream-format-fix.yml b/.github/workflows/downstream-format-fix.yml new file mode 100644 index 0000000000..38b856350e --- /dev/null +++ b/.github/workflows/downstream-format-fix.yml @@ -0,0 +1,37 @@ +name: Downstream format fix + +on: + push: + branches: + - perf/imagery-stale-thumbnail-cancellation-20260929 + +permissions: + contents: write + +jobs: + format: + if: ${{ github.actor != 'github-actions[bot]' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + ref: perf/imagery-stale-thumbnail-cancellation-20260929 + - uses: actions/setup-node@v5 + with: + node-version: 24.14.0 + cache: npm + - run: npm ci + env: + PUPPETEER_SKIP_DOWNLOAD: 1 + - run: npm run format + - name: Commit formatting if needed + shell: bash + run: | + if git diff --quiet; then + exit 0 + fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "chore: apply adopted formatting" + git push From 85227cca9dc0fa74055c5f4e9490fea932f86875 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Thu, 1 Oct 2026 00:52:52 -0500 Subject: [PATCH 14/22] chore: remove one-shot downstream format fixer --- .github/workflows/downstream-format-fix.yml | 37 --------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/downstream-format-fix.yml diff --git a/.github/workflows/downstream-format-fix.yml b/.github/workflows/downstream-format-fix.yml deleted file mode 100644 index 38b856350e..0000000000 --- a/.github/workflows/downstream-format-fix.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Downstream format fix - -on: - push: - branches: - - perf/imagery-stale-thumbnail-cancellation-20260929 - -permissions: - contents: write - -jobs: - format: - if: ${{ github.actor != 'github-actions[bot]' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - with: - ref: perf/imagery-stale-thumbnail-cancellation-20260929 - - uses: actions/setup-node@v5 - with: - node-version: 24.14.0 - cache: npm - - run: npm ci - env: - PUPPETEER_SKIP_DOWNLOAD: 1 - - run: npm run format - - name: Commit formatting if needed - shell: bash - run: | - if git diff --quiet; then - exit 0 - fi - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - git commit -m "chore: apply adopted formatting" - git push From dddd1fa03fe54481fbe5822f7d73cdd4435fda2f Mon Sep 17 00:00:00 2001 From: daikaginza Date: Sat, 17 Oct 2026 07:28:26 +0700 Subject: [PATCH 15/22] fix(i18n): translate mapped-site feedback by its shape where it is shown Add the Mapped Installations feedback shapes (site counts in view or around the contact, and the Overpass retry lines) to statusText.js, and show statusMessage through translateStatusPiece in the Layers panel, the nearby-search toast and the awareness panel. The voice card's analyst notes already fall back to translateStatusLine, so they pick the shapes up too. --- scripts/package-boundaries.json | 7 ++-- src/layers/awareness/panel.js | 5 +-- src/ui/contextBindings.js | 3 +- src/ui/layerPanel.js | 14 ++++---- src/ui/statusText.js | 52 +++++++++++++++++++++++++++- src/voice/analystEmptyNotes.test.mjs | 21 +++++++++++ 6 files changed, 88 insertions(+), 14 deletions(-) diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index 43bc3d4de9..190e377e98 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -566,7 +566,8 @@ "src/i18n/locale.js", "src/i18n/locales/es.json", "src/i18n/locales/ru.json", - "src/ui/layerNames.js" + "src/ui/layerNames.js", + "src/ui/statusText.js" ], "external": [] }, @@ -1242,7 +1243,9 @@ "src/i18n/locale.js", "src/i18n/locales/es.json", "src/i18n/locales/ru.json", - "src/ui/unitLabels.js" + "src/ui/unitLabels.js", + "src/ui/layerNames.js", + "src/ui/statusText.js" ], "external": ["cesium"] }, diff --git a/src/layers/awareness/panel.js b/src/layers/awareness/panel.js index 5fe2a0ac8a..f8f3d55eb9 100644 --- a/src/layers/awareness/panel.js +++ b/src/layers/awareness/panel.js @@ -2,7 +2,8 @@ import { formatAwarenessLabel, AWARENESS_RADIUS_M, } from '../../data/militaryAwarenessEngine.js'; -import { formatNumber, t, translateKnown } from '../../i18n/index.js'; +import { formatNumber, t } from '../../i18n/index.js'; +import { translateStatusPiece } from '../../ui/statusText.js'; import { formatQuantity } from '../../ui/unitLabels.js'; import { AWARENESS_PAGE_SIZE, AWARENESS_PAGE_ROTATE_MS } from './policy.js'; @@ -39,7 +40,7 @@ function presentAwarenessDistance(meters) { function presentAwarenessReason(summary = {}) { return summary.reasonTemplate ? t(summary.reasonTemplate, summary.reasonValues) - : translateKnown(summary.reason || ''); + : translateStatusPiece(summary.reason || ''); } export function createPanel({ state: layerState, services, parts, source }) { diff --git a/src/ui/contextBindings.js b/src/ui/contextBindings.js index 16a21df4f4..ef663eb702 100644 --- a/src/ui/contextBindings.js +++ b/src/ui/contextBindings.js @@ -1,4 +1,5 @@ import { t } from '../i18n/index.js'; +import { translateStatusPiece } from './statusText.js'; import { shouldExpandGlobalContextPanel } from '../rightRailPolicy.js'; export function _initGlobalContextPanel() { @@ -109,7 +110,7 @@ export function _initGlobalContextPanel() { if (this.destroyed || searched === false) return false; const stats = this.installations.getStats?.(); this.showToast( - stats?.statusMessage || + (stats?.statusMessage && translateStatusPiece(stats.statusMessage)) || (stats?.status === 'zoom-in' ? t('Zoom in to search mapped installations') : t('Nearby installations refreshed')), diff --git a/src/ui/layerPanel.js b/src/ui/layerPanel.js index 109d96c60a..7a69f74281 100644 --- a/src/ui/layerPanel.js +++ b/src/ui/layerPanel.js @@ -11,14 +11,12 @@ import { } from './layerNames.js'; export { localizeLayerName } from './layerNames.js'; import { createWeatherPanel } from './weatherPanel.js'; -import { translateFeedError, translateStatusLine } from './statusText.js'; import { - formatNumber, - getLocale, - msg, - t, - translateKnown, -} from '../i18n/index.js'; + translateFeedError, + translateStatusLine, + translateStatusPiece, +} from './statusText.js'; +import { formatNumber, getLocale, msg, t } from '../i18n/index.js'; // Feed-state values are machine ids (QA hooks, CSS feed-* classes); only the // label translates. @@ -672,7 +670,7 @@ export class LayerPanel { typeof stats.statusMessage === 'string' && stats.statusMessage.trim() ) { - return `${source} · ${translateKnown(stats.statusMessage.trim())}`; + return `${source} · ${translateStatusPiece(stats.statusMessage.trim())}`; } const ago = stats.lastUpdate ? this._timeAgo(stats.lastUpdate) : t('never'); if (stats.loading) { diff --git a/src/ui/statusText.js b/src/ui/statusText.js index b0899d55e1..b241abdbff 100644 --- a/src/ui/statusText.js +++ b/src/ui/statusText.js @@ -208,9 +208,59 @@ const STATUS_PIECE_PATTERNS = [ ], ]; +// Mapped Installations feedback (installationFeedback in +// data/installationFeedback.js): getStats().statusMessage is English data, and +// the Layers panel, the toast, the awareness panel and the voice card's analyst +// note show it through here. Keep these in step with that helper. +const MAPPED_SITE_PATTERNS = [ + [ + /^(.+) — retrying in (\d+)s$/, + ([, reason, seconds]) => + t('{reason} — retrying in {seconds}s', { + reason: translateKnown(reason), + seconds, + }), + ], + [ + /^(.+) — retry pending$/, + ([, reason]) => + t('{reason} — retry pending', { reason: translateKnown(reason) }), + ], + [/^No mapped sites in view$/, () => t('No mapped sites in view')], + [ + /^(\d+) mapped sites? in view$/, + ([, count]) => + tn( + Number(count), + '{count} mapped site in view', + '{count} mapped sites in view', + ), + ], + [ + /^No mapped sites within (\d+) km of the contact$/, + ([, km]) => + t('No mapped sites within {km} km of the contact', { + km: formatNumber(Number(km)), + }), + ], + [ + /^(\d+) mapped sites? within (\d+) km of the contact$/, + ([, count, km]) => + tn( + Number(count), + '{count} mapped site within {km} km of the contact', + '{count} mapped sites within {km} km of the contact', + { km: formatNumber(Number(km)) }, + ), + ], +]; + /** A status piece by its shape in the UI language, or null. */ function statusPatternText(piece) { - for (const [pattern, format] of STATUS_PIECE_PATTERNS) { + for (const [pattern, format] of [ + ...STATUS_PIECE_PATTERNS, + ...MAPPED_SITE_PATTERNS, + ]) { const match = pattern.exec(piece); if (match) return format(match); } diff --git a/src/voice/analystEmptyNotes.test.mjs b/src/voice/analystEmptyNotes.test.mjs index b0de16ebd5..101fe06179 100644 --- a/src/voice/analystEmptyNotes.test.mjs +++ b/src/voice/analystEmptyNotes.test.mjs @@ -74,6 +74,14 @@ const transitCoverage = [ 'transit: No feed here yet · 12 regions available', ]; +// Mapped Installations' statusMessage (data/installationFeedback.js). +const installationNotes = [ + 'military-installations: No mapped sites in view', + 'military-installations: No mapped sites within 25 km of the contact', + 'military-installations: Overpass timed out — retrying in 30s', + 'military-installations: Zoom in to search mapped installations', +]; + for (const locale of ['es', 'ru']) { for (const [layerKey, caveat] of cases) { test(`${locale}: analyst note "${caveat}" is translated`, () => { @@ -85,6 +93,19 @@ for (const locale of ['es', 'ru']) { }); } + test(`${locale}: Mapped Installations' empty note is translated on the analyst card`, () => { + inLocale(locale, () => { + for (const caveat of installationNotes) { + const notes = notesFor('military-installations', caveat); + assert.ok(notes.length > 0, 'the note is shown'); + assert.doesNotMatch( + notes.join(' | '), + /mapped sites|retrying|Overpass timed out|Zoom in/, + ); + } + }); + }); + test(`${locale}: Transit's empty note is translated on the analyst card`, () => { inLocale(locale, () => { for (const caveat of transitCoverage) { From 4515c5146aa09b01cc81d7e9bad0cfaa05b58600 Mon Sep 17 00:00:00 2001 From: daikaginza Date: Sat, 17 Oct 2026 07:28:26 +0700 Subject: [PATCH 16/22] fix(analyst): keep the Mapped Installations empty note English getStats().statusMessage was translated inside the layer, and the analyst uses it as the empty note it returns to the model, so an empty military-installations query carried Spanish or Russian text in an English tool result. Report installationFeedback() as English again; the displays translate it by its shape. --- src/data/installationFeedback.js | 2 +- src/layers/installations/controls.js | 44 +---- .../installationFeedbackLocale.test.mjs | 160 ++++++++++++------ 3 files changed, 116 insertions(+), 90 deletions(-) diff --git a/src/data/installationFeedback.js b/src/data/installationFeedback.js index 13e92c8b99..4dc1858ddf 100644 --- a/src/data/installationFeedback.js +++ b/src/data/installationFeedback.js @@ -1,6 +1,6 @@ import { msg } from '../i18n/marker.js'; -// layers/installations/controls.js translates describeInstallationFeedback(). +// installationFeedback() is English data; ui/statusText.js shows it translated. const REASONS = Object.freeze({ rate_limited: msg('Overpass rate-limited'), timeout: msg('Overpass timed out'), diff --git a/src/layers/installations/controls.js b/src/layers/installations/controls.js index 2fa31e59ef..608d6efbfc 100644 --- a/src/layers/installations/controls.js +++ b/src/layers/installations/controls.js @@ -1,37 +1,11 @@ import * as Cesium from 'cesium'; -import { describeInstallationFeedback } from '../../data/installationFeedback.js'; +import { installationFeedback } from '../../data/installationFeedback.js'; import { LAYER_ID, DISTANCE_PREFILTER_MARGIN_M, ANCHOR_REFRESH_M, } from './policy.js'; -import { formatNumber, t, tn } from '../../i18n/index.js'; - -// installationFeedback.js is shared with the HUD (src/loadingFeedback.js) and -// hands back msg()-marked English plus values; getStats translates them here. -function localizeInstallationFeedback(feedback) { - if (feedback.text !== undefined) { - const values = {}; - if (feedback.reason !== undefined) values.reason = t(feedback.reason); - if (feedback.seconds !== undefined) values.seconds = feedback.seconds; - return t(feedback.text, values); - } - const { count, km } = feedback; - if (km) { - const kmText = formatNumber(km); - return count === 0 - ? t('No mapped sites within {km} km of the contact', { km: kmText }) - : tn( - count, - '{count} mapped site within {km} km of the contact', - '{count} mapped sites within {km} km of the contact', - { km: kmText }, - ); - } - return count === 0 - ? t('No mapped sites in view') - : tn(count, '{count} mapped site in view', '{count} mapped sites in view'); -} +import { t } from '../../i18n/index.js'; export function createControls({ state: layerState, services, parts, source }) { const methods = { @@ -252,13 +226,13 @@ export function createControls({ state: layerState, services, parts, source }) { retryAt: layerState.retryAt, retrying: layerState.loading && Boolean(layerState.failureReason), failureReason: layerState.failureReason, - statusMessage: localizeInstallationFeedback( - describeInstallationFeedback({ - ...layerState, - count: layerState.lastUpdate ? mappedCount : undefined, - retrying: layerState.loading && Boolean(layerState.failureReason), - }), - ), + // English data: it is also the analyst's empty note to the model. + // Displays translate it by its shape (ui/statusText.js). + statusMessage: installationFeedback({ + ...layerState, + count: layerState.lastUpdate ? mappedCount : undefined, + retrying: layerState.loading && Boolean(layerState.failureReason), + }), loadingLabel: layerState.loading ? t('loading mapped installation context') : '', diff --git a/src/layers/installations/installationFeedbackLocale.test.mjs b/src/layers/installations/installationFeedbackLocale.test.mjs index cf4e758a33..7dac443510 100644 --- a/src/layers/installations/installationFeedbackLocale.test.mjs +++ b/src/layers/installations/installationFeedbackLocale.test.mjs @@ -1,6 +1,10 @@ +// getStats().statusMessage is English data (it is also the analyst's empty +// note to the model); the displays show it in the UI language through +// translateStatusPiece (ui/statusText.js). import test from 'node:test'; import assert from 'node:assert/strict'; -import { setLocale, translateKnown } from '../../i18n/index.js'; +import { setLocale, t, tn, translateKnown } from '../../i18n/index.js'; +import { translateStatusPiece } from '../../ui/statusText.js'; import { createControls } from './controls.js'; function stats(state) { @@ -13,67 +17,115 @@ function stats(state) { }).methods.getStats(); } -for (const locale of ['es', 'ru']) { - test(`${locale}: installation feedback is in the UI language`, () => { - setLocale(locale); - const empty = stats({ status: 'empty', lastUpdate: 1 }).statusMessage; - assert.notEqual(empty, 'No mapped sites in view'); - const found = stats({ +function inLocale(locale, run) { + setLocale(locale); + try { + run(); + } finally { + setLocale('en'); + } +} + +// Each layer state, the English statusMessage it reports, and how the UI +// shows it. A retry a minute out reads "60s" (rounded up). +const cases = [ + [ + { status: 'empty', lastUpdate: 1 }, + 'No mapped sites in view', + () => t('No mapped sites in view'), + ], + [ + { status: 'ready', lastUpdate: 1, records: [{ kind: 'installation' }, { kind: 'installation' }], - }).statusMessage; - assert.notEqual(found, '2 mapped sites in view'); - const tiles = stats({ - status: 'unavailable', - failureReason: 'tiles_unavailable', - }).statusMessage; - assert.notEqual(tiles, 'Map tiles temporarily unavailable'); - const retry = stats({ + }, + '2 mapped sites in view', + () => tn(2, '{count} mapped site in view', '{count} mapped sites in view'), + ], + [ + { + status: 'empty', + lastUpdate: 1, + wide: true, + coverage: { kind: 'subject', radiusM: 25000 }, + }, + 'No mapped sites within 25 km of the contact', + () => t('No mapped sites within {km} km of the contact', { km: '25' }), + ], + [ + { + status: 'ready', + lastUpdate: 1, + wide: true, + coverage: { kind: 'subject', radiusM: 25000 }, + records: [{ kind: 'installation' }], + }, + '1 mapped site within 25 km of the contact', + () => + tn( + 1, + '{count} mapped site within {km} km of the contact', + '{count} mapped sites within {km} km of the contact', + { km: '25' }, + ), + ], + [ + { status: 'unavailable', failureReason: 'tiles_unavailable' }, + 'Map tiles temporarily unavailable', + () => t('Map tiles temporarily unavailable'), + ], + [ + { status: 'unavailable', failureReason: 'names_unavailable', - retryAt: Date.now() + 5000, - }).statusMessage; - assert.doesNotMatch(retry, /^Mapped names temporarily unavailable/); - for (const text of [ - 'Too many mapped sites in view to list them all', - 'Installation context unavailable', - ]) { - assert.notEqual(translateKnown(text), text); - } + get retryAt() { + return Date.now() + 60_000; + }, + }, + 'Mapped names temporarily unavailable — retrying in 60s', + () => + t('{reason} — retrying in {seconds}s', { + reason: t('Mapped names temporarily unavailable'), + seconds: 60, + }), + ], + [ + { status: 'zoom-in' }, + 'Zoom in to search mapped installations', + () => t('Zoom in to search mapped installations'), + ], +]; + +for (const locale of ['es', 'ru']) { + test(`${locale}: installation statusMessage stays English data`, () => { + inLocale(locale, () => { + for (const [state, english] of cases) + assert.equal(stats(state).statusMessage, english); + }); + }); + + test(`${locale}: installation statusMessage is shown in the UI language`, () => { + inLocale(locale, () => { + for (const [state, english, shown] of cases) { + const shownText = translateStatusPiece(stats(state).statusMessage); + assert.notEqual(shownText, english); + assert.equal(shownText, shown()); + } + for (const text of [ + 'Too many mapped sites in view to list them all', + 'Installation context unavailable', + ]) { + assert.notEqual(translateKnown(text), text); + } + }); }); } test('en: installation feedback keeps its English wording', () => { setLocale('en'); - assert.equal( - stats({ status: 'empty', lastUpdate: 1 }).statusMessage, - 'No mapped sites in view', - ); - assert.equal( - stats({ - status: 'ready', - lastUpdate: 1, - records: [{ kind: 'installation' }], - }).statusMessage, - '1 mapped site in view', - ); - assert.equal( - stats({ - status: 'ready', - lastUpdate: 1, - wide: true, - coverage: { kind: 'subject', radiusM: 25000 }, - records: [{ kind: 'installation' }, { kind: 'installation' }], - }).statusMessage, - '2 mapped sites within 25 km of the contact', - ); - assert.equal( - stats({ - status: 'unavailable', - failureReason: 'names_unavailable', - retryAt: Date.now() + 5000, - }).statusMessage, - 'Mapped names temporarily unavailable — retrying in 5s', - ); + for (const [state, english] of cases) { + assert.equal(stats(state).statusMessage, english); + assert.equal(translateStatusPiece(english), english); + } }); From e2651bb0942f96b678faca19a577b01dedf86d76 Mon Sep 17 00:00:00 2001 From: daikaginza Date: Sat, 17 Oct 2026 07:58:56 +0700 Subject: [PATCH 17/22] fix(i18n): build the status piece shapes once and cover one site in view statusPatternText runs on every row render; join the shape lists at module scope instead of on each call. Restore the singular in-view case to the installation feedback locale test. --- .../installations/installationFeedbackLocale.test.mjs | 5 +++++ src/ui/statusText.js | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/layers/installations/installationFeedbackLocale.test.mjs b/src/layers/installations/installationFeedbackLocale.test.mjs index 7dac443510..f85a0b3ae5 100644 --- a/src/layers/installations/installationFeedbackLocale.test.mjs +++ b/src/layers/installations/installationFeedbackLocale.test.mjs @@ -34,6 +34,11 @@ const cases = [ 'No mapped sites in view', () => t('No mapped sites in view'), ], + [ + { status: 'ready', lastUpdate: 1, records: [{ kind: 'installation' }] }, + '1 mapped site in view', + () => tn(1, '{count} mapped site in view', '{count} mapped sites in view'), + ], [ { status: 'ready', diff --git a/src/ui/statusText.js b/src/ui/statusText.js index b241abdbff..12d2025cc6 100644 --- a/src/ui/statusText.js +++ b/src/ui/statusText.js @@ -255,12 +255,12 @@ const MAPPED_SITE_PATTERNS = [ ], ]; +// Every status piece shape, in matching order. +const STATUS_SHAPES = [...STATUS_PIECE_PATTERNS, ...MAPPED_SITE_PATTERNS]; + /** A status piece by its shape in the UI language, or null. */ function statusPatternText(piece) { - for (const [pattern, format] of [ - ...STATUS_PIECE_PATTERNS, - ...MAPPED_SITE_PATTERNS, - ]) { + for (const [pattern, format] of STATUS_SHAPES) { const match = pattern.exec(piece); if (match) return format(match); } From 7d8ad93126589af6c93699547ea2d8a2de188ef1 Mon Sep 17 00:00:00 2001 From: daikaginza Date: Sun, 18 Oct 2026 14:35:07 +0700 Subject: [PATCH 18/22] docs(changelog): add the #1210 entry --- changelog.d/1210-installations-note-english.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/1210-installations-note-english.md diff --git a/changelog.d/1210-installations-note-english.md b/changelog.d/1210-installations-note-english.md new file mode 100644 index 0000000000..e8fccd4add --- /dev/null +++ b/changelog.d/1210-installations-note-english.md @@ -0,0 +1,3 @@ +- Return the Mapped Installations status (site counts, Overpass retries) to the + voice analyst in English; the Layers panel, the nearby-search toast and the + awareness panel translate it where they show it (daikaginza, #1210). From a0db300d5473d812690aafda52b85bb9a0fa54d6 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 16:39:56 +0400 Subject: [PATCH 19/22] docs(imagery): tighten cancellation notes and match them to the code --- changelog.d/881-imagery-cancellation.md | 6 +++++- docs/CURRENT-STATE.md | 2 +- src/layers/recentImagery/index.js | 3 +-- src/layers/recentImagery/thumbnails.js | 13 +++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/changelog.d/881-imagery-cancellation.md b/changelog.d/881-imagery-cancellation.md index 4c17c854f6..dd67a9ba48 100644 --- a/changelog.d/881-imagery-cancellation.md +++ b/changelog.d/881-imagery-cancellation.md @@ -1 +1,5 @@ -- Cancel superseded Recent Imagery thumbnail fetches when focus, visible range, pins or preview change; retain known-good availability metadata and count each aborted in-flight request once. When the followed automatic day resolves empty, re-request its successor even if scrolling previously cancelled that probe (kvnloo, #881; independent reviews: quanticsoul4772, gekh). +- Cancel Recent Imagery thumbnail fetches that are no longer wanted when focus, + the visible strip, pins or sources change; a day already known to have + imagery stays known. When the automatic day turns out empty, fetch the next + day again even if scrolling had cancelled it (kvnloo, #881; reviews: + quanticsoul4772, gekh). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 9f7bdf68c6..e03f5fd243 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -8062,7 +8062,7 @@ pins and share links already supply complete boxes. - DATA ▸ **Recent Imagery** (`recent-imagery`, `src/layers/recentImagery/`) lists the last 30 UTC days of imagery for a selected box and drapes the days you pick: HLS S30 (Sentinel-2) and L30 (Landsat 8/9) at 30 m, and the VIIRS NOAA-21 daily overview at 250 m. Keyless and browser-direct: NASA CMR for which days have HLS granules in the box (`catalog.js`, both collections concurrently, paged with `CMR-Search-After` up to 2,000 records each, `truncated` against CMR `hits`), GIBS WMTS for tiles, Worldview Snapshots for thumbnails and exports. Worldview's `Data-Present` header is the only availability signal: GIBS answers an empty tile with HTTP 200, and the JPEG overview would drape black, so a day confirmed empty never drapes. - **Box.** SELECT BOX (`src/ui/imageryBoxTool.js`) claims the pointer like Draw, borrows the stock click actions and freezes the camera only mid-drag; USE VIEW takes the camera rectangle; `boxFromPinAt` grows a 10 km box. Boxes must be ≤ 1,000 km a side, on one side of the dateline and inside the Web-Mercator limit (`validateBox`). A refusal (`boxError`, including the tool's own via `reportBoxRefusal`) stays at the top of the panel until a box succeeds; a view over the cap is refused with its size, never shrunk. An oversized box or view (`Box is … km wide · limit 1,000 km`, `View is … wide · …`) sets the hint to `Zoom in or draw a smaller box` and enables ZOOM IN: `zoomToFit()` flies top-down (1.2 s) to the refused box's centre, or the ground under the canvas centre for a view, at the height whose view is about 400 km wide for the canvas aspect and the camera's vertical FOV (`fitViewHeightM`, clamped 5–400 km), and returns that height. - **Modes, pins and the preview.** The mode is explicit: `image` (one pinned day, slot `a`), `basemap` (that day on the left of a swipe, the basemap on the right: slot `a` splits LEFT and there is no second layer) and `ab` (day `a` left, day `b` right). `setAssignment(slot, key | null)` / `toggleAssignment(slot, key)` pin and unpin; a day is in one slot at most (pinning it in the other slot moves it) and an empty day cannot be pinned. `setMode()` keeps both pins; `b` only drapes in `ab`. While the mode's first empty slot exists the focused day previews in it: a click at once, arrow keys after 250 ms of quiet (`FOCUS_DEBOUNCE_MS`, one timer, last day wins); an unprobed day is followed and previews when its probe says present, an empty or unknown day never drapes and the previous preview stays. A pin change drops the preview until focus moves again, and unpinning takes that layer off at once. `rankLatest` picks START HERE coverage first (a present HLS day whose footprints cover the box, or have none, beats a newer sliver), then newest with all granules ≤ 20% known cloud, then newest; slivers only as `partial`; else the newest non-empty VIIRS day; it is focused and previewed after each search when nothing is pinned. Escape clears the preview (`clearPreview()`), then cancels the box tool, then blurs — with SELECT BOX armed too, through the tool's `onEscape` interceptor wired in `createApplicationTools`. Pins, mode, box and split changes made in the panel are published with `adoptLayerParams`, never while a share link is being applied. -- **Rendering.** `rendering.js` owns at most two GIBS layers on the host `src/maps/imageryHost.js` resolves: the globe port's imagery while the globe shows, the shown photoreal tileset while it is hidden, or none (the panel says so). Layers are rebuilt on a new host, never re-parented. `MapSourceController.subscribe()` fires after every settled stack switch (silent switches and fallbacks included) and the layer rebinds on it. Tile requests pass a six-slot semaphore of our own (Cesium's global limits are untouched). Under `requestRenderMode` a deferred tile needs a later frame, but a deferral must never request one itself or a stalled tile keeps the scene rendering every frame: a request that finds the semaphore full asks for nothing (the settling request asks for one frame), and a tile Cesium itself deferred goes through one coalesced 250 ms retry. Thumbnails: three fetches at once, sixteen decoded images, least-recently-used where a `get` read is never a use; eviction keeps the probe result. The strip's visible window is probed around the focused card; the pinned and previewed days are probed wherever they sit, at the focused card's priority, so a pin restored or assigned off-screen still drapes. Superseded thumbnail work is cancelled when focus, visible range, pins or preview change; known-good availability metadata remains cached, and each aborted in-flight request is counted once. If the followed automatic day proves empty, the next ranked day's probe is re-requested even if an earlier request was cancelled. +- **Rendering.** `rendering.js` owns at most two GIBS layers on the host `src/maps/imageryHost.js` resolves: the globe port's imagery while the globe shows, the shown photoreal tileset while it is hidden, or none (the panel says so). Layers are rebuilt on a new host, never re-parented. `MapSourceController.subscribe()` fires after every settled stack switch (silent switches and fallbacks included) and the layer rebinds on it. Tile requests pass a six-slot semaphore of our own (Cesium's global limits are untouched). Under `requestRenderMode` a deferred tile needs a later frame, but a deferral must never request one itself or a stalled tile keeps the scene rendering every frame: a request that finds the semaphore full asks for nothing (the settling request asks for one frame), and a tile Cesium itself deferred goes through one coalesced 250 ms retry. Thumbnails: three fetches at once, sixteen decoded images, least-recently-used where a `get` read is never a use; eviction keeps the probe result. The strip's visible window is probed around the focused card; the pinned and previewed days are probed wherever they sit, at the focused card's priority, so a pin restored or assigned off-screen still drapes. A thumbnail request pass over a non-empty strip ends with `retain()`, which cancels queued and in-flight work for days it no longer wants (focus, visible range, pins, sources, the empty-day filter, a share link); a cancelled day already probed present keeps its status. When an automatic day probes empty, its successor is requested again, since scrolling may have cancelled that probe. - **Esri surface and the swipe.** While any image is on the map (a preview included) the layer holds the map lease (`acquireImageryComparison`, owner `recent-imagery`, `esri-if-photoreal`): on Google 3D the map switches to Esri, because 30 m pixels over 3D buildings do not read, and Cesium's split only works on the globe. The lease is handed back, and Google 3D restored unless the operator changed maps meanwhile, when the last image leaves the map or the layer is disabled; the notice line says so while it holds. While a day is shown the imagery keeps Esri: a manual switch that lands on Google 3D is answered at once with a new lease under the same policy (`keepEsri`), the notice reads `Imagery stays on Esri · CLEAR to use Google 3D`, and the divider never suspends because of a map switch. It re-leases once per switch generation and only for a manual one (`MapSourceController#getSwitchOrigin()` is `manual` for an outside `setStack`, `automatic` for the controller's own fallback or recovery), never for the lease's own switch and never while releasing, so CLEAR and disable still return to Google 3D; a lease another owner holds stays refused. When Esri fails and the controller falls back to Google 3D on its own, the layer lets the lease go without restoring anything, both days drape on the tileset without a swipe and the guidance reads `Esri map unavailable · no swipe`; only the next manual switch to Google 3D takes Esri again, so a failing Esri map is never retried in a loop. Switching between globe stacks (Esri, OSM, Bing) only rebinds. On a tileset host both images drape without a swipe. The split control (`createImagerySplit`, labels A / B, or IMAGE / BASEMAP) exists only while a swipe is live, recentres on every new comparison (not while scrubbing the second day), except once for a split restored from a link. There is no keyboard shortcut (Space is the app's push-to-talk): SWAP (`#ri-swap`, in the controls row, its slot reserved and the button disabled while no swipe is live) trades the two sides, A to the right and B to the left, or the image to the right of the basemap, and a second click restores; the hint reads `Drag the divider · SWAP trades sides`. The swap is not in the share link, and every new comparison starts unswapped. One opacity applies to both drapes. Another owner holding the lease is reported and the images still drape. - **Panel.** `#recent-imagery-panel` is rail markup in the Context view (`src/ui/views/ContextView.vue`) beside `#weather-panel`, registered in `PanelLayoutController`, `PanelChrome` and the share panel state (`ui` token `i`), hidden while the layer is off and opened on first appearance unless a stored or shared collapse choice exists (`dataset.collapsedPreference`). `LayerPanel.attachRecentImagery(factory)` mounts the readout (`createRecentImageryPanel` in `src/ui/recentImagery.js`) into its `data-rail-scroller` body, as the weather readout is mounted. The body is a fixed stack in which no block changes height and no control moves in any state: `#ri-actions` (SELECT BOX · USE VIEW · CLEAR, rail-card actions), `#ri-notice` (one line: `#ri-notice-text` with the refusal, error, CLEAR notice or the Esri note, and `#ri-zoom-in` in a fixed slot at its right end, reserved unless an oversized box or view can be fitted), `#ri-strip` (day cards newest first: thumbnail, date, sensor, cloud, START HERE, PREVIEW, and a SHOW chip or A and B chips; ← → Home End move, S / A / B pin, Enter previews), `#ri-hint` (one line: the next step), `#ri-selection` (`#ri-mode` IMAGE · VS BASEMAP · A / B, then `#ri-slot-a` and `#ri-slot-b` with `#ri-unpin-a` / `#ri-unpin-b` kept in place when empty), `#ri-controls` (`#ri-opacity`, EXPORT / EXPORT A and EXPORT B) and `#ri-details`, a collapsed rail card holding the focused day's acquisition, coverage and granules, catalog notes, the empty-days toggle and the imagery credit. Absent controls are reserved (invisible), never removed. Every render preserves the body's `scrollTop`; opening DETAILS then scrolls its card into view once. - **Share links.** Layer options (token `1`): box edges as integers at degrees × 100000, pins `a` and `b` as compact days (`S20260918`), `m` mode (0 image, 1 basemap, 2 A / B), `p` split percent (share-link only: never stored locally) and `v` for the daily overview. Row chips: `MORE DETAIL · 30 m` (on) and `DAILY OVERVIEW · 250 m` (off). diff --git a/src/layers/recentImagery/index.js b/src/layers/recentImagery/index.js index 6ed8f036d8..6cd41f19f3 100644 --- a/src/layers/recentImagery/index.js +++ b/src/layers/recentImagery/index.js @@ -833,8 +833,7 @@ export function createRecentImageryLayer({ pruned && (_followKey !== previousFollow || _previewKey !== previousPreview) ) { - // A new automatic day can have had its probe cancelled while offscreen. - // Re-request it even when the visible window has not moved. + // The new automatic day's probe may have been cancelled off-screen. requestThumbnails(); } if (pruned) syncRender(); diff --git a/src/layers/recentImagery/thumbnails.js b/src/layers/recentImagery/thumbnails.js index 48d20a6c0a..47e0f1491f 100644 --- a/src/layers/recentImagery/thumbnails.js +++ b/src/layers/recentImagery/thumbnails.js @@ -169,9 +169,8 @@ export function createThumbnailLoader({ if (existing) { touch(existing); if (existing.loading && existing.controller?.signal.aborted) { - // A known-present re-fetch keeps its metadata when cancelled. If - // that day is wanted again before cancellation settles, give the - // new request its own entry so the old run cannot discard it. + // Wanted again before the abort settles: a fresh entry, so the old + // run cannot discard it. const renewed = { ...existing, priority, @@ -237,11 +236,9 @@ export function createThumbnailLoader({ }, /** - * Keep only refinement work still wanted by the current UI intent. - * - * Known decoded/probed entries may remain warm under the LRU residency - * policy, but queued or in-flight acquisition for no-longer-wanted keys is - * cancelled. A cancelled known-present re-fetch keeps its proven metadata. + * Cancel queued and in-flight work for every key not in `keys`. Settled + * entries stay under the LRU; a cancelled re-fetch of a present day keeps + * its status. * @param {Iterable} keys */ retain(keys) { From bd84fab552b9bc5794d321c070f42a1b30a67bae Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 16:41:04 +0400 Subject: [PATCH 20/22] refactor(imagery): drop unused cancellation counters and impossible-case guards --- src/layers/recentImagery/index.js | 4 +-- src/layers/recentImagery/thumbnails.js | 26 ++++---------------- src/layers/recentImagery/thumbnails.test.mjs | 11 +-------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/layers/recentImagery/index.js b/src/layers/recentImagery/index.js index 6cd41f19f3..ce3c97610d 100644 --- a/src/layers/recentImagery/index.js +++ b/src/layers/recentImagery/index.js @@ -580,7 +580,7 @@ export function createRecentImageryLayer({ firstVisible: _visible.first, lastVisible: _visible.last, extra: 2, - }) || [], + }), ); for (const key of new Set([ _assigned.a, @@ -593,7 +593,7 @@ export function createRecentImageryLayer({ thumbnails.request(candidate, _box, 0); wanted.add(candidate.key); } - thumbnails.retain?.(wanted); + thumbnails.retain(wanted); } function resetCatalog() { diff --git a/src/layers/recentImagery/thumbnails.js b/src/layers/recentImagery/thumbnails.js index 47e0f1491f..190836fefd 100644 --- a/src/layers/recentImagery/thumbnails.js +++ b/src/layers/recentImagery/thumbnails.js @@ -37,8 +37,6 @@ export function createThumbnailLoader({ const queue = []; let inFlight = 0; let touchCounter = 0; - let supersededQueued = 0; - let supersededInFlight = 0; let destroyed = false; function notify(key) { @@ -225,14 +223,10 @@ export function createThumbnailLoader({ candidates.length, extra, ); - const keys = []; - order.forEach((index, priority) => { - const candidate = candidates[index]; - if (!candidate?.key) return; - keys.push(candidate.key); - this.request(candidate, box, priority); + return order.map((index, priority) => { + this.request(candidates[index], box, priority); + return candidates[index].key; }); - return keys; }, /** @@ -242,19 +236,16 @@ export function createThumbnailLoader({ * @param {Iterable} keys */ retain(keys) { - const wanted = new Set(keys || []); + const wanted = new Set(keys); for (let index = queue.length - 1; index >= 0; index -= 1) { const entry = queue[index]; if (wanted.has(entry.key)) continue; queue.splice(index, 1); - supersededQueued += 1; if (entry.status === 'unknown') entries.delete(entry.key); } for (const entry of [...entries.values()]) { if (!entry.loading || wanted.has(entry.key)) continue; - if (!entry.controller || entry.controller.signal.aborted) continue; - entry.controller.abort(); - supersededInFlight += 1; + entry.controller?.abort(); if (entry.status === 'unknown') entries.delete(entry.key); } }, @@ -301,13 +292,6 @@ export function createThumbnailLoader({ return () => listeners.delete(listener); }, - refinementStats() { - return { - supersededQueued, - supersededInFlight, - }; - }, - stats() { return { inFlight, diff --git a/src/layers/recentImagery/thumbnails.test.mjs b/src/layers/recentImagery/thumbnails.test.mjs index b7b0fe4403..a9df5e0861 100644 --- a/src/layers/recentImagery/thumbnails.test.mjs +++ b/src/layers/recentImagery/thumbnails.test.mjs @@ -357,14 +357,10 @@ test('retain aborts stale acquisition while allowing the current intent to start 'current intent starts after stale abort', ); assert.match(fetch.calls[1].url, /TIME=2026-09-11/); - assert.deepEqual(loader.refinementStats(), { - supersededQueued: 0, - supersededInFlight: 1, - }); assert.equal(loader.get(stale.key).status, 'unknown'); }); -test('repeat retain counts an aborted known-present re-fetch once', async () => { +test('a cancelled re-fetch of a known-present day keeps its status and is retryable', async () => { const { loader, fetch } = fixture({ maxInFlight: 1, maxDecoded: 1 }); const stale = candidate('S30', '2026-09-10'); const newer = candidate('S30', '2026-09-11'); @@ -383,12 +379,7 @@ test('repeat retain counts an aborted known-present re-fetch once', async () => loader.request(stale, BOX, 0); assert.equal(fetch.calls.length, 3, 'an evicted known day re-fetches'); loader.retain([]); - loader.retain([]); assert.equal(fetch.calls[2].signal.aborted, true); - assert.deepEqual(loader.refinementStats(), { - supersededQueued: 0, - supersededInFlight: 1, - }); await settle(); assert.equal(loader.get(stale.key).status, 'present'); From dc13be07c0ae83cd99c1ee0a11dfaa227c723afe Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 16:48:59 +0400 Subject: [PATCH 21/22] docs(i18n): tighten the Mapped Installations status comments --- src/data/installationFeedback.js | 3 ++- src/layers/installations/controls.js | 3 +-- .../installations/installationFeedbackLocale.test.mjs | 7 ++----- src/ui/statusText.js | 8 +++----- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/data/installationFeedback.js b/src/data/installationFeedback.js index 4dc1858ddf..cfc1ae6199 100644 --- a/src/data/installationFeedback.js +++ b/src/data/installationFeedback.js @@ -1,6 +1,7 @@ import { msg } from '../i18n/marker.js'; -// installationFeedback() is English data; ui/statusText.js shows it translated. +// installationFeedback() stays English for the analyst. ui/statusText.js and +// ui/shellFeedback.js (HUD) translate it: keep both in step with this wording. const REASONS = Object.freeze({ rate_limited: msg('Overpass rate-limited'), timeout: msg('Overpass timed out'), diff --git a/src/layers/installations/controls.js b/src/layers/installations/controls.js index fe03542055..8c8d729cbe 100644 --- a/src/layers/installations/controls.js +++ b/src/layers/installations/controls.js @@ -259,8 +259,7 @@ export function createControls({ state: layerState, services, parts, source }) { retryAt: layerState.retryAt, retrying: layerState.loading && Boolean(layerState.failureReason), failureReason: layerState.failureReason, - // English data: it is also the analyst's empty note to the model. - // Displays translate it by its shape (ui/statusText.js). + // English: the analyst reads it as is; displays translate it. statusMessage: installationFeedback({ ...layerState, count: layerState.lastUpdate ? mappedCount : undefined, diff --git a/src/layers/installations/installationFeedbackLocale.test.mjs b/src/layers/installations/installationFeedbackLocale.test.mjs index f85a0b3ae5..0591a74eee 100644 --- a/src/layers/installations/installationFeedbackLocale.test.mjs +++ b/src/layers/installations/installationFeedbackLocale.test.mjs @@ -1,6 +1,4 @@ -// getStats().statusMessage is English data (it is also the analyst's empty -// note to the model); the displays show it in the UI language through -// translateStatusPiece (ui/statusText.js). +// statusMessage stays English (the analyst's empty note); displays translate it. import test from 'node:test'; import assert from 'node:assert/strict'; import { setLocale, t, tn, translateKnown } from '../../i18n/index.js'; @@ -26,8 +24,7 @@ function inLocale(locale, run) { } } -// Each layer state, the English statusMessage it reports, and how the UI -// shows it. A retry a minute out reads "60s" (rounded up). +// A retry a minute out reads "60s" (rounded up). const cases = [ [ { status: 'empty', lastUpdate: 1 }, diff --git a/src/ui/statusText.js b/src/ui/statusText.js index 5f4bbf4f2f..8d43ccfbc1 100644 --- a/src/ui/statusText.js +++ b/src/ui/statusText.js @@ -242,10 +242,8 @@ const STATUS_PIECE_PATTERNS = [ ], ]; -// Mapped Installations feedback (installationFeedback in -// data/installationFeedback.js): getStats().statusMessage is English data, and -// the Layers panel, the toast, the awareness panel and the voice card's analyst -// note show it through here. Keep these in step with that helper. +// Shapes of installationFeedback() (data/installationFeedback.js), which stays +// English for the analyst. Keep them in step with its wording. const MAPPED_SITE_PATTERNS = [ [ /^(.+) — retrying in (\d+)s$/, @@ -289,7 +287,7 @@ const MAPPED_SITE_PATTERNS = [ ], ]; -// Every status piece shape, in matching order. +// First match wins. const STATUS_SHAPES = [...STATUS_PIECE_PATTERNS, ...MAPPED_SITE_PATTERNS]; /** A status piece by its shape in the UI language, or null. */ From e4e7b3228944d115f48c0409bdacd4faebd15ce3 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 16:52:52 +0400 Subject: [PATCH 22/22] refactor(i18n): show the installations status through translateStatusMessage --- src/data/installationFeedback.js | 2 +- src/layers/awareness/panel.js | 11 +++-------- .../installationFeedbackLocale.test.mjs | 14 ++++---------- src/ui/contextBindings.js | 4 ++-- src/ui/statusText.js | 2 +- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/data/installationFeedback.js b/src/data/installationFeedback.js index cfc1ae6199..7209ded520 100644 --- a/src/data/installationFeedback.js +++ b/src/data/installationFeedback.js @@ -20,7 +20,7 @@ const FALLBACK_REASON = msg('Overpass temporarily unavailable'); * @param {number} [now] * @returns {{text: string, reason?: string, seconds?: number}|{count: number, km: ?number}} */ -export function describeInstallationFeedback(stats = {}, now = Date.now()) { +function describeInstallationFeedback(stats = {}, now = Date.now()) { const reason = REASONS[stats.failureReason] || FALLBACK_REASON; if (stats.loading) return { diff --git a/src/layers/awareness/panel.js b/src/layers/awareness/panel.js index bf14e86b2e..33f206e225 100644 --- a/src/layers/awareness/panel.js +++ b/src/layers/awareness/panel.js @@ -2,14 +2,9 @@ import { formatAwarenessLabel, AWARENESS_RADIUS_M, } from '../../data/militaryAwarenessEngine.js'; -import { - formatNumber, - onLocaleChange, - t, - translateKnown, -} from '../../i18n/index.js'; +import { formatNumber, onLocaleChange, t } from '../../i18n/index.js'; import { sourceStatusLabel } from '../../ui/layerNames.js'; -import { translateStatusPiece } from '../../ui/statusText.js'; +import { translateStatusMessage } from '../../ui/statusText.js'; import { formatQuantity } from '../../ui/unitLabels.js'; import { AWARENESS_PAGE_SIZE, AWARENESS_PAGE_ROTATE_MS } from './policy.js'; import { distanceParts } from '../../data/distanceFormat.js'; @@ -46,7 +41,7 @@ export function presentAwarenessDistance(meters) { function presentAwarenessReason(summary = {}) { return summary.reasonTemplate ? t(summary.reasonTemplate, summary.reasonValues) - : translateStatusPiece(summary.reason || ''); + : translateStatusMessage(summary.reason || ''); } /** diff --git a/src/layers/installations/installationFeedbackLocale.test.mjs b/src/layers/installations/installationFeedbackLocale.test.mjs index 0591a74eee..c74c0ee477 100644 --- a/src/layers/installations/installationFeedbackLocale.test.mjs +++ b/src/layers/installations/installationFeedbackLocale.test.mjs @@ -1,8 +1,8 @@ // statusMessage stays English (the analyst's empty note); displays translate it. import test from 'node:test'; import assert from 'node:assert/strict'; -import { setLocale, t, tn, translateKnown } from '../../i18n/index.js'; -import { translateStatusPiece } from '../../ui/statusText.js'; +import { setLocale, t, tn } from '../../i18n/index.js'; +import { translateStatusMessage } from '../../ui/statusText.js'; import { createControls } from './controls.js'; function stats(state) { @@ -110,16 +110,10 @@ for (const locale of ['es', 'ru']) { test(`${locale}: installation statusMessage is shown in the UI language`, () => { inLocale(locale, () => { for (const [state, english, shown] of cases) { - const shownText = translateStatusPiece(stats(state).statusMessage); + const shownText = translateStatusMessage(stats(state).statusMessage); assert.notEqual(shownText, english); assert.equal(shownText, shown()); } - for (const text of [ - 'Too many mapped sites in view to list them all', - 'Installation context unavailable', - ]) { - assert.notEqual(translateKnown(text), text); - } }); }); } @@ -128,6 +122,6 @@ test('en: installation feedback keeps its English wording', () => { setLocale('en'); for (const [state, english] of cases) { assert.equal(stats(state).statusMessage, english); - assert.equal(translateStatusPiece(english), english); + assert.equal(translateStatusMessage(english), english); } }); diff --git a/src/ui/contextBindings.js b/src/ui/contextBindings.js index e786a8e3c6..c4e3a46155 100644 --- a/src/ui/contextBindings.js +++ b/src/ui/contextBindings.js @@ -1,6 +1,6 @@ import { t } from '../i18n/index.js'; import { spaceMissionsIndexFailure } from './contextActions.js'; -import { translateStatusPiece } from './statusText.js'; +import { translateStatusMessage } from './statusText.js'; import { shouldExpandGlobalContextPanel } from '../rightRailPolicy.js'; export function _initGlobalContextPanel() { @@ -113,7 +113,7 @@ export function _initGlobalContextPanel() { if (this.destroyed || searched === false) return false; const stats = this.installations.getStats?.(); this.showToast( - (stats?.statusMessage && translateStatusPiece(stats.statusMessage)) || + (stats?.statusMessage && translateStatusMessage(stats.statusMessage)) || (stats?.status === 'zoom-in' ? t('Zoom in to search mapped installations') : t('Nearby installations refreshed')), diff --git a/src/ui/statusText.js b/src/ui/statusText.js index 8d43ccfbc1..7d1c5cf988 100644 --- a/src/ui/statusText.js +++ b/src/ui/statusText.js @@ -300,7 +300,7 @@ function statusPatternText(piece) { } /** One piece of a status line in the UI language, or as it came. */ -export function translateStatusPiece(piece) { +function translateStatusPiece(piece) { const known = translateKnown(piece); if (known !== piece) return known; return statusPatternText(piece) ?? piece;