feat(3-1): stale state detection and dimmed display

When fetch times out or returns empty after prior data, retain last aircraft
with is_stale=True and render them as black outlines so the display stays
informative rather than blank or crashing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Edholm
2026-04-22 23:47:04 -04:00
parent 316e7aa9a8
commit 833a7f0917
6 changed files with 131 additions and 28 deletions
+2 -2
View File
@@ -31,7 +31,7 @@ def test_run_one_cycle_calls_display_show(renderer: Renderer) -> None:
fetcher = FileFixtureFetcher(FIXTURE_DIR / "aircraft_sample.json")
display = NullDisplay()
display_mock = MagicMock(wraps=display)
_run_one_cycle(renderer, fetcher, display_mock)
_run_one_cycle(renderer, fetcher, display_mock, [])
display_mock.show.assert_called_once()
@@ -43,7 +43,7 @@ def test_run_one_cycle_logs_warning_when_slow(
# Simulate 43s total: t0=0, t1=1, t2=2, t3=43
with patch("planemapper.main.time.monotonic", side_effect=[0.0, 1.0, 2.0, 43.0]):
with caplog.at_level(logging.WARNING, logger="planemapper.main"):
_run_one_cycle(renderer, fetcher, display)
_run_one_cycle(renderer, fetcher, display, [])
assert any("render slow" in r.message for r in caplog.records)