Skip to content

Draw trace usage as weather over Fleet City (RFC 0032) - #253

Merged
dmccoystephenson merged 2 commits into
mainfrom
feat/fleet-city-weather
Nov 12, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feat/fleet-city-weather

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Weather over Fleet City (Stephenson-Software RFC 0032): trace usage per building as rain, floods as storms. Off by default.

  • gardener/fleetweather.py (the RFC's spike, hardened): reads the trace service's GET /api/metrics/window with a reader credential (good for that path only), at most once a minute however many pages are open; maps programs to repositories from programs.json in the hub's data directory; classifies cells; draws them on the still. Only per-program counts are read: no install id, server or tag.
  • /api/city gains weather (status, window_seconds, sky, cells: [[id, kind, intensity, lightning, per_minute]]) when GARDENER_HUB_WEATHER=1. Trace down, a refused credential or no programs.json gives a clear sky and a reason, never a 500.
  • Live page: new export fc_set_weather in fleetcity/main.cpp. Rain and storm clouds are two translucent meshes for any fleet size. Rain and lightning are drawn per frame. Rain drops out at quality tier 0 and stands still with reduced motion. fc_pick looks through clouds. Also adds a legend row, a card line and a summary count. Weather shows only while the page is Live. city.{js,wasm} was rebuilt with emsdk 6.0.11.
  • gardener hub city-still draws the same weather, or draws a --weather-sample FILE instead of reading trace (CI's city-still job now renders the flood fixture too).
  • Docs: hub docs "Weather", USAGE.md.

page

Defaults chosen (RFC 0032 open questions)

  1. Read path: a new windowed aggregate endpoint in the trace service, read with a dedicated read-only key. It is a separate trace PR and must be deployed first.
  2. Window and thresholds: 5 minutes. Drizzle is under 1 a minute, rain is from 1, and a storm is from 60 a minute (FloodGuard's threshold) or any flood event. Full intensity is 600 a minute. The rate uses uses (coalesced reports count as their repeats).
  3. Lightning: left unwired. trace has no error events. The errors hook is drawn when a sample carries it and is always 0 from trace.
  4. Excluded installs: every server counts. trace keeps no stored mute list.
  5. Live page and still: both in v1.
  6. Where the map lives: programs.json in the hub's data directory, beside city.json. It is never committed, because it names private repositories.

Tests

  • tests/test_fleetweather.py (new): weather rules, program-map and trace-answer parsing, the read with a stub opener (credential sent, failures are short reasons without it), the once-a-minute cache, /api/city on, off, down and without a map, --weather-sample validation, and the still rendering the flood as one storm (when Strata is available).
  • Local: PYTHONPATH=. python3.11 -m unittest discover -s tests ran 1377 tests with Strata's binding set. The run found one failure (USAGE.md was missing the new flag), which was fixed and test_cli re-run (335 tests, OK).
  • /city was rendered headless (SwiftShader) against a local hub and a stub trace: 1 storm, 19 rain and 10 drizzle drawn. Picking returned the right building for 26/30 weather cells, including the storm; the 4 misses were occluded by taller buildings in front.

Enabling (owner)

  1. Deploy the trace window endpoint and set a reader digest there.
  2. Put programs.json in the hub's data directory.
  3. Set GARDENER_HUB_WEATHER=1, GARDENER_HUB_TRACE_URL, and GARDENER_HUB_TRACE_READER in the hub's env.

None of that is in this PR.

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

https://claude.ai/code/session_01LYNeuo7EcTsfm3BxWEeYgi

dmccoystephenson and others added 2 commits November 10, 2026 22:13
Each building whose program reported to trace in the last five minutes
gets a weather cell: drizzle under 1 a minute, rain from 1, a storm from
60 a minute (FloodGuard's threshold) or any flood-tagged event. Lightning
is drawn when a sample carries errors; nothing fills that yet.

- gardener/fleetweather.py: reads trace's GET /api/metrics/window with a
  reader credential (at most once a minute), maps programs to repositories
  from programs.json in the hub's data directory, classifies cells and
  draws them on the still.
- /api/city gains `weather` (status, sky, one row per cell) when
  GARDENER_HUB_WEATHER is on; every failure is a clear sky with a reason.
- The page: fc_set_weather in fleetcity/main.cpp (two translucent cloud
  meshes, rain and lightning per frame, picking looks through clouds),
  a legend row, the card's weather line and a summary count.
- city-still draws the same weather, or a --weather-sample file.

Off by default. Every name in tests and pictures is synthetic.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuo7EcTsfm3BxWEeYgi
Two stills drawn headless from the synthetic fleet and the flood-shaped
fixture (tests/weather_fixture.py) were added under docs/images/, with a
captioned README section and the command that redraws them.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuo7EcTsfm3BxWEeYgi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant