fix: improve mapped installations and map-source guidance (#183)

Improve mapped installation recovery, deselection, retry feedback, and visual-style and map-source guidance.
This commit is contained in:
Bilawal Sidhu authored and GitHub committed 2026-09-05 03:30:55 -05:00
1 parent 3b6b3f1007
commit 759652207f
25 files changed
+479 -41

No files matched your search

+36
View File
@@ -1,6 +1,42 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const retrySite = (stats = {}) => ({ id: 'military-installations', name: 'Mapped Installations', enabled: true,
stats: { status: 'unavailable', error: 'Unavailable', retryAt: Date.now() + 30000, ...stats } });
test('installation retry remains visible after failure dwell without a false spinner', () => {
const summary = aggregateLayerLoading([retrySite()]);
const view = presentLoadingFeedback(createLoadingFeedbackState(), summary, 100);
assert.equal(view.state, 'retry');
assert.equal(view.label, 'OVERPASS TEMPORARILY UNAVAILABLE');
assert.match(view.detail, /retrying in 30s/);
assert.equal(presentLoadingFeedback(createLoadingFeedbackState(), aggregateLayerLoading([{ ...retrySite(), enabled: false }]), 100), null);
});
test('an installation retry never conceals another participant failure', () => {
const state = { visible: true, phase: 'terminal', terminal: 'error', activeIds: ['military-installations', 'flights'] };
const summary = aggregateLayerLoading([retrySite(), { id: 'flights', enabled: true, stats: { error: 'Failed' } }]);
assert.equal(presentLoadingFeedback(state, summary, 100).label, 'LOAD FAILED');
const healthyNow = aggregateLayerLoading([retrySite()]);
assert.equal(presentLoadingFeedback({ ...state, failedEventIds: ['flights'] }, healthyNow, 100).label, 'LOAD FAILED');
});
test('a fresh installation retry can finish successfully without inheriting the old error', () => {
let state = { ...createLoadingFeedbackState(), phase: 'terminal', terminal: 'error', visible: true, activeIds: ['military-installations'] };
const loading = aggregateLayerLoading([retrySite({ status: 'loading', error: null, loading: true, retryAt: 0, retrying: true })]);
state = reduceLoadingFeedback(state, loading, 1000);
state = reduceLoadingFeedback(state, loading, 1200);
assert.equal(presentLoadingFeedback(state, loading, 1200).label, 'RETRYING MAPPED SITES');
const done = aggregateLayerLoading([retrySite({ status: 'ready', error: null, loading: false, retryAt: 0, retrying: false, count: 3 })]);
state = reduceLoadingFeedback(state, done, 1500);
assert.equal(presentLoadingFeedback(state, done, 1500).label, 'MAPPED SITES LOADED');
});
test('turning off a retrying installation layer does not report the old fetch failure as a disable failure', () => {
const stopping = aggregateLayerLoading([{ ...retrySite(), lifecycleState: 'disabling' }]);
let state = reduceLoadingFeedback(createLoadingFeedbackState(), stopping, 1000);
state = reduceLoadingFeedback(state, stopping, 1200);
const off = aggregateLayerLoading([{ ...retrySite({ status: 'idle', error: null, retryAt: 0 }), enabled: false }]);
state = reduceLoadingFeedback(state, off, 1400);
assert.equal(presentLoadingFeedback(state, off, 1400).label, 'LIVE DATA OFF');
});
import {
aggregateLayerLoading,
canPresentDeferredStatusNotice,