feat(simulation+ui): Atlas depth — regional-map design (D-226), climate overlay, quarter glyphs #185

Closed
jpmschweitzer wants to merge 0 commits from atlas-depth into main
Owner

Summary

The Atlas depth batch (D-226): the regional-map design record plus two new viewer overlays. After this merges, the Atlas shows climate (mean-temp) at region granularity and settlement quarter-footprint glyphs, and the jet-plane-altitude regional view is fully designed with its wiring ticketed (T-1137/T-1138).

T-1124 — D-226 amendment: windowed district-resolution regional map (design, Tyre + Araminta)

Five sections recorded and validated:

  1. Request: window_center/window_n as serde-default fields ON AtlasLayerRequest — absent = whole-body; a new inbound wire shape is forbidden (PR #184 five-shape ceiling).
  2. Response carrier (ruling): district_window: Option<DistrictWindowLayer> is a windowed viewport query keyed (body, center, n) with an echoed-center staleness guard — deliberately OUTSIDE the dense whole-body layer family; that family's growth ceiling is re-scoped (not busted) and still stands.
  3. Fields: six per-cell integers — morphology, elev_q, temp_dc (i16, region-sentinel), moisture_q, vegetation (Marine-exhaustive per T-1126), glaciation_grade (T-1127's deferred wire half, now accepted).
  4. Budget (binding): 7 bytes/cell; MAX_N=64 (~28 KiB, matches the T-1123 proven window), DEFAULT_N=32; pan-only re-request (zoom never refetches); client LRU cache valid forever per D-227 determinism; temp shares ONE colorizer with the region overlay across zoom levels (D-243 continuity).
  5. Screen (Araminta): zoom-threshold LOD swap in the existing AtlasViewer (no new screen); morphology base lightness-modulated by elev_q; gen_dw_* toggles; glaciation as always-on ice-tint modifier; Marine transparent; implant chrome discipline (map palettes stay out of ACCENT_ACTIVE gold).

Follow-ups filed: T-1137 (server wiring — carries the named TerrainAnalysis cache-vs-rederive decision: derive_district needs the ~2 MB transient analysis BodyWorldState deliberately drops), T-1138 (client screen, incl. the zoom-headroom note).

T-1119 — QuarterFootprintLayer (server: Dudley, client: Stig)

  • ZoningType gains Ord (T-994 mirror); build_quarter_footprint_layer — per-city aggregates (density floor-mean, dominant type/zoning by mode with declaration-order tie-break, landmark/corridor counts), None on empty quarters, async-lag placements SKIPPED not defaulted; sixth and final whole-body response field, growth-ceiling doc updated.
  • Tie-break bug caught by its own test: Iterator::max_by_key returns the LAST max on ties over a BTreeMap iterator — backwards from declaration-order-first; replaced with an explicit forward walk.
  • Client: gen_l4_quarters (QTR) — density-scaled glyph on the L3 settlement dot, shape = dominant district type, settlement-gold density ramp, zoom-gated; landmark/corridor never drawn (D-226(d) tooltip-only ceiling).
  • Known-inert field, documented: landmark_count computes 0 on real data until landmark placement lands (BlockSkeleton.landmark is hardcoded None today); fixtures exercise the logic with non-zero counts.

T-1118 — climate overlay (client, Stig)

gen_region_grid (TMP): mean-temp cold→hot ramp over −50..+50 °C at region granularity; the airless sentinel (REGION_TEMP_NONE_DC = i16::MIN) is skip-cell — undrawn, never an invented color. Populated RegionGridLayer wire fixture added (was nil in all three fixtures since PR #179) and the Tier-2 replay test asserts exact literals from the real server-generated fixture, including the sentinel.

Structural cleanups riding along

  • atlas_viewer.gd and protocol.gd were both over gdlint's 1000-line cap pre-batch; cleanly-separable responsibilities extracted on existing precedent: atlas_generation_state.gd, atlas_generation_proxy.gd, atlas_overlay_colors.gd, atlas_map_protocol.gd (the browse_protocol delegate pattern). Public APIs preserved exactly; both files now under cap.
  • Stale TODO(#957) removed (premise predated T-957 landing).
  • T-1139 filed (pre-existing msgpack Vec-as-generic-Array decode gap, found while wiring).

Verification

  • Full client suite 3094/3094 (incl. new pure-function suites for ramp + glyph and exact-literal replay); server atlas:: 549 green; both via the pre-push gate on push.
  • Live capture (tests/run-visual) against a running server: legend grows to 7 sections, TMP/QTR toggle cleanly, no errors; glyph pixel-truth is pinned by the exact-value fixture test (the capture body's async region/quarter stages hadn't populated within the tick budget — the fixture test is the stronger check).
  • pql decisions validate clean on the amendment.

Tickets: T-1124, T-1118, T-1119

## Summary The Atlas depth batch (D-226): the regional-map design record plus two new viewer overlays. After this merges, the Atlas shows climate (mean-temp) at region granularity and settlement quarter-footprint glyphs, and the jet-plane-altitude regional view is fully designed with its wiring ticketed (T-1137/T-1138). ### T-1124 — D-226 amendment: windowed district-resolution regional map (design, Tyre + Araminta) Five sections recorded and validated: 1. **Request**: `window_center`/`window_n` as serde-default fields ON `AtlasLayerRequest` — absent = whole-body; a new inbound wire shape is forbidden (PR #184 five-shape ceiling). 2. **Response carrier (ruling)**: `district_window: Option<DistrictWindowLayer>` is a *windowed viewport query* keyed `(body, center, n)` with an echoed-center staleness guard — deliberately OUTSIDE the dense whole-body layer family; that family's growth ceiling is re-scoped (not busted) and still stands. 3. **Fields**: six per-cell integers — morphology, elev_q, temp_dc (i16, region-sentinel), moisture_q, vegetation (Marine-exhaustive per T-1126), glaciation_grade (T-1127's deferred wire half, now accepted). 4. **Budget (binding)**: 7 bytes/cell; MAX_N=64 (~28 KiB, matches the T-1123 proven window), DEFAULT_N=32; pan-only re-request (zoom never refetches); client LRU cache valid forever per D-227 determinism; temp shares ONE colorizer with the region overlay across zoom levels (D-243 continuity). 5. **Screen (Araminta)**: zoom-threshold LOD swap in the existing AtlasViewer (no new screen); morphology base lightness-modulated by elev_q; `gen_dw_*` toggles; glaciation as always-on ice-tint modifier; Marine transparent; implant chrome discipline (map palettes stay out of ACCENT_ACTIVE gold). Follow-ups filed: T-1137 (server wiring — carries the named TerrainAnalysis cache-vs-rederive decision: `derive_district` needs the ~2 MB transient analysis BodyWorldState deliberately drops), T-1138 (client screen, incl. the zoom-headroom note). ### T-1119 — QuarterFootprintLayer (server: Dudley, client: Stig) - `ZoningType` gains Ord (T-994 mirror); `build_quarter_footprint_layer` — per-city aggregates (density floor-mean, dominant type/zoning by mode with declaration-order tie-break, landmark/corridor counts), None on empty quarters, async-lag placements SKIPPED not defaulted; sixth and final whole-body response field, growth-ceiling doc updated. - **Tie-break bug caught by its own test**: `Iterator::max_by_key` returns the LAST max on ties over a BTreeMap iterator — backwards from declaration-order-first; replaced with an explicit forward walk. - Client: `gen_l4_quarters` (QTR) — density-scaled glyph on the L3 settlement dot, shape = dominant district type, settlement-gold density ramp, zoom-gated; landmark/corridor never drawn (D-226(d) tooltip-only ceiling). - Known-inert field, documented: `landmark_count` computes 0 on real data until landmark placement lands (BlockSkeleton.landmark is hardcoded None today); fixtures exercise the logic with non-zero counts. ### T-1118 — climate overlay (client, Stig) `gen_region_grid` (TMP): mean-temp cold→hot ramp over −50..+50 °C at region granularity; the airless sentinel (`REGION_TEMP_NONE_DC` = i16::MIN) is skip-cell — undrawn, never an invented color. Populated RegionGridLayer wire fixture added (was nil in all three fixtures since PR #179) and the Tier-2 replay test asserts exact literals from the real server-generated fixture, including the sentinel. ### Structural cleanups riding along - `atlas_viewer.gd` and `protocol.gd` were both over gdlint's 1000-line cap pre-batch; cleanly-separable responsibilities extracted on existing precedent: `atlas_generation_state.gd`, `atlas_generation_proxy.gd`, `atlas_overlay_colors.gd`, `atlas_map_protocol.gd` (the browse_protocol delegate pattern). Public APIs preserved exactly; both files now under cap. - Stale `TODO(#957)` removed (premise predated T-957 landing). - T-1139 filed (pre-existing msgpack Vec<u8>-as-generic-Array decode gap, found while wiring). ### Verification - Full client suite 3094/3094 (incl. new pure-function suites for ramp + glyph and exact-literal replay); server `atlas::` 549 green; both via the pre-push gate on push. - Live capture (`tests/run-visual`) against a running server: legend grows to 7 sections, TMP/QTR toggle cleanly, no errors; glyph pixel-truth is pinned by the exact-value fixture test (the capture body's async region/quarter stages hadn't populated within the tick budget — the fixture test is the stronger check). - `pql decisions validate` clean on the amendment. Tickets: T-1124, T-1118, T-1119
jpmschweitzer added 3 commits 2026-07-18 12:30:00 +02:00
Five sections, Tyre data shape + Araminta screen/encoding (T-1112
pattern): (1) request = serde-default window_center/window_n ON
AtlasLayerRequest (five-shape demux cap honored); (2) response carrier
RULING — district_window is a windowed viewport query keyed
(body, center, n) with echoed-center staleness guard, deliberately
OUTSIDE the dense whole-body layer family whose growth ceiling is
re-scoped (not busted) to that family; (3) six per-cell fields incl.
glaciation_grade (T-1127 deferral accepted) and Marine-exhaustive
vegetation; (4) binding budget — 7 bytes/cell, MAX_N=64 (~28 KiB),
DEFAULT_N=32, temp shares the T-1118 region-ramp colorizer across zoom
levels (D-243 continuity), pan-only re-request (zoom never refetches),
D-227-determinism client cache; (5) screen — zoom-threshold LOD swap
in the existing AtlasViewer, morphology base with elev_q lightness,
gen_dw_* toggles, glaciation as always-on tint modifier, Marine
transparent, implant chrome discipline.

Validated via pql decisions validate. Implementation is follow-up
ticket scope (server wiring must resolve the named TerrainAnalysis
transience decision; client screen).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ZoningType gains PartialOrd/Ord (DistrictType T-994 mirror) for the
dominant_zoning declaration-order tie-break. layer_proxy:
QuarterFootprintEntry/QuarterFootprintLayer (BTreeMap keyed by
city_id; density_avg_pct floor-mean, dominant_* mode with
declaration-order tie-break, landmark/corridor counts) +
build_quarter_footprint_layer gated None on empty state.quarters;
sixth AtlasLayerResponse field wired into all construction sites;
growth-ceiling doc updated to say the whole-body budget is consumed
(what carries a seventh is T-1124's design, resolved in the same
branch's amendment). Placements whose derived Layer4Quarter id is not
yet in state.quarters are SKIPPED (skeleton gen is async Low-priority
— entries may be a proper subset; client decodes defensively). Stale
TODO(#957) removed (premise predates T-957 landing).

Tie-break bug caught by its own test: Iterator::max_by_key over a
BTreeMap returns the LAST max on ties — backwards from
declaration-order-first; replaced with an explicit forward walk that
replaces only on strictly-greater count.

gen_fixtures: populated RegionGridLayer (T-1118 replay coverage) +
QuarterFootprintLayer literals in the ready fixture; msgpack fixtures
regenerated via make fixtures. Note: landmark_count is inert on real
data today (BlockSkeleton.landmark hardcoded None until landmark
placement lands); fixtures use non-zero counts to exercise the logic.

5 new unit tests + populated round-trip; atlas:: 549 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
T-1118: gen_region_grid overlay (label TMP) — _draw_gen_region_grid
copies _draw_gen_district's self-contained mapping (dims from the
layer dict); mean-temp cold-to-hot ramp over -50..+50 C;
REGION_TEMP_NONE_DC airless sentinel = skip-cell (undrawn, never an
invented color); legend entry.

T-1119 (touch points 3-6): quarter_footprints protocol passthrough;
gen_l4_quarters overlay (label QTR) — density-scaled glyph anchored
on the L3 settlement dot joined by city_id, shape = dominant district
type (corner-tab/diamond marks for Commercial/Industrial/
Administrative), color = density ramp on the settlement-gold family,
zoom-gated at SETTLEMENT_LABEL_MIN_ZOOM; landmark/corridor counts
never drawn (D-226(d) tooltip-only ceiling); legend entry.

Structure: atlas_viewer.gd and protocol.gd were over gdlint's
1000-line cap before this batch; cleanly-separable responsibilities
extracted on existing precedent — atlas_generation_state.gd (per-layer
data + accessors), atlas_generation_proxy.gd (polling/retry/pending
machinery), atlas_overlay_colors.gd (pure ramp/shape lookups),
atlas_map_protocol.gd (atlas/starmap/citynames codec, the
browse_protocol.gd delegate pattern). Public APIs preserved exactly;
_gen_state stays a field default (RefCounted, pre-_ready safe) because
_ready()-construction breaks every bare AtlasViewer.new() test —
documented inline.

Tests: registration + round-trip for both overlays; pure-function
suites for the temp ramp (endpoints/midpoint/clamp/sentinel) and
quarter glyph (scaling, zoom gate, ramp, notch across all 9
DistrictTypes); Tier-2 replay asserts exact literals from the real
server-generated fixture incl. the airless sentinel. Color.lerp(a,b,
1.0) is not bit-exact to b — endpoint assertions use per-component
is_equal_approx. Full suite 3094/3094; gdlint zero warnings incl. the
two previously-over-cap files. Live capture: legend grows to 7
sections, TMP/QTR toggles clean against a live server.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jpmschweitzer added 1 commit 2026-07-18 12:45:39 +02:00
All five findings applied, none touching the option-(c) carrier choice:
(1) SS2 gains a binding windowed-family ceiling — exactly ONE
windowed-query field; a second windowed query is a dedicated response
message by rule (two concurrent windowed payloads would need the
per-field request-correlation that IS the tagged framing — that is the
trigger to build it); symmetric with the request side's five-hard cap.
(2) SS1 gains a binding serving model — window derives ride the same
Rayon queue + Pending pattern as whole-body cache misses, never inline
in the PreInput drain (which the codebase deliberately keeps expensive
work off); per-connection coalescing recommended; SS4's 7/29ms figures
reframed as worker latency, not tick-thread cost. (3) The
layer_proxy.rs growth-ceiling comment (comment-only diff) now records
the T-1124 ruling as RESOLVED — scoped to the dense whole-body family,
district_window outside it, second windowed field = dedicated-message
migration — instead of deferring to an open design question. (4) SS2
documents that body scoping rides the enclosing AtlasLayerResponse
envelope (cache key body_id+center+n; echo disambiguates within-body).
(5) SS5 entry clarified: zoom threshold alone triggers the swap
(works over open ocean), first window centers on the pan-center's
derived DistrictPos; downstream settlement-anchoring phrasing
reconciled.

pql decisions validate clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
Owner

Review: atlas-depth → main (type: code + governance) — round 2 (fix round)

Three reviewers: Tyre authored the D-226 T-1124 amendment in this diff, so he reviewed only the implementation; Troblum ran the adversarial pass on the amendment.

Hoshe (QA): APPROVE

Independently verified every claim: the mode_by_declaration_order tie-break fix is a correct forward-walk (confirmed via standalone compiled trace); fixture literals match byte-for-byte what the Tier-2 replay test asserts against the committed msgpack (44/44); the four extractions faithfully copy their precedents with no autoload class_name hazards and no broken external callers; both over-cap files genuinely under cap (1017→985, 996→916); renderers use the correct self-contained mapping and never draw landmark/corridor (D-226(d)); the legend gate test is real and enforced; the TODO(#957) removal verified as stale-comment hygiene, not regression cover. Non-blocking process note: branch changelog predates T-1137/38/39 on main — resolved by the merge keeping main's copy (branch never touched changelog files); store verified post-merge.

# File Issue
none

Tyre (Architecture, implementation only): APPROVE

The four extraction seams are clean and match their cited precedents; decode semantics traced byte-identical end to end. QuarterFootprintLayer BTreeMap keyed city_id (D-010), city_id→quarter_id re-derivation matches the dispatch path exactly, async-subset skip sound. Enum-serialization split between sibling layers cleared as principled idiom (dense positional arrays pack as-u8 for size; sparse keyed records self-describe as named variants). T-1118's ramp lives reusably in atlas_overlay_colors.region_temp_color() — the single colorizer the future district window requires per amendment §4.

# File Issue
none

Troblum (adversarial, amendment): APPROVE (round 1: REQUEST_CHANGES, 3 blocking + 2 doc findings — all fixed and confirmed)

Round-1 findings, all applied in c20c175af and re-verified against the diff + underlying code:

  1. Windowed-family ceiling missing → §2 now pins exactly ONE windowed-query field; a second windowed query is a dedicated response message by rule, with the trigger grounded (concurrent windowed payloads need per-field correlation, which IS the tagged framing). Symmetric with the request side's five-hard cap.
  2. Inline derive on the tick thread (highest severity) → binding serving model: window derives ride the same Rayon queue + Pending pattern as whole-body cache misses, never inline in the PreInput drain; per-connection coalescing as the server-side backstop; 7/29ms reframed as worker latency. Verified the cited drain-doc text is genuine pre-existing code, not fabricated authority.
  3. layer_proxy.rs ceiling comment contradicted the amendment → rewritten (comment-only, struct untouched): cap scoped to the dense whole-body family, T-1124 recorded as RESOLVED, windowed cap stated inline.
  4. Staleness echo → body scoping documented as riding the response envelope (verified against actual AtlasResponseBuffer routing); echo narrowed to within-body disambiguation.
  5. First-entry/centering → zoom-threshold-alone trigger (works over open ocean), first window centers on the pan-center's derived DistrictPos, downstream phrasing reconciled.

The option-(c) carrier choice itself survived the adversarial pass unchanged ("well-reasoned… real, not a rationalization").

# Section Issue Status
1 Amendment §2 Windowed family had no cap — governance gap FIXED (c20c175af)
2 Amendment §1/§4 Inline derive in PreInput drain — tick-stall hazard FIXED — queue-based serving, binding
3 layer_proxy.rs:77-83 Code comment contradicted the ruling FIXED — reconciled, comment-only
4 Amendment §2 Staleness echo under-documented on body scoping FIXED
5 Amendment §5 First-fetch centering/trigger under-specified FIXED

Verdict: APPROVED

Runtime verification: full cargo + gdUnit suites via the pre-push gate on every push (3094 client / full server). Live capture against a running server: legend grows to 7 sections, TMP/QTR toggle clean; glyph truth pinned by exact-literal fixture replay. pql decisions validate clean on the final amendment. T-1137 updated with the binding queue-serving model before any wiring work can pick it up.

## Review: atlas-depth → main (type: code + governance) — round 2 (fix round) Three reviewers: Tyre authored the D-226 T-1124 amendment in this diff, so he reviewed only the implementation; Troblum ran the adversarial pass on the amendment. ### Hoshe (QA): APPROVE Independently verified every claim: the `mode_by_declaration_order` tie-break fix is a correct forward-walk (confirmed via standalone compiled trace); fixture literals match byte-for-byte what the Tier-2 replay test asserts against the committed msgpack (44/44); the four extractions faithfully copy their precedents with no autoload class_name hazards and no broken external callers; both over-cap files genuinely under cap (1017→985, 996→916); renderers use the correct self-contained mapping and never draw landmark/corridor (D-226(d)); the legend gate test is real and enforced; the TODO(#957) removal verified as stale-comment hygiene, not regression cover. Non-blocking process note: branch changelog predates T-1137/38/39 on main — resolved by the merge keeping main's copy (branch never touched changelog files); store verified post-merge. | # | File | Issue | |---|------|-------| | — | — | none | ### Tyre (Architecture, implementation only): APPROVE The four extraction seams are clean and match their cited precedents; decode semantics traced byte-identical end to end. QuarterFootprintLayer BTreeMap keyed city_id (D-010), city_id→quarter_id re-derivation matches the dispatch path exactly, async-subset skip sound. Enum-serialization split between sibling layers cleared as principled idiom (dense positional arrays pack as-u8 for size; sparse keyed records self-describe as named variants). T-1118's ramp lives reusably in atlas_overlay_colors.region_temp_color() — the single colorizer the future district window requires per amendment §4. | # | File | Issue | |---|------|-------| | — | — | none | ### Troblum (adversarial, amendment): APPROVE (round 1: REQUEST_CHANGES, 3 blocking + 2 doc findings — all fixed and confirmed) Round-1 findings, all applied in c20c175af and re-verified against the diff + underlying code: 1. **Windowed-family ceiling missing** → §2 now pins exactly ONE windowed-query field; a second windowed query is a dedicated response message by rule, with the trigger grounded (concurrent windowed payloads need per-field correlation, which IS the tagged framing). Symmetric with the request side's five-hard cap. 2. **Inline derive on the tick thread** (highest severity) → binding serving model: window derives ride the same Rayon queue + Pending pattern as whole-body cache misses, never inline in the PreInput drain; per-connection coalescing as the server-side backstop; 7/29ms reframed as worker latency. Verified the cited drain-doc text is genuine pre-existing code, not fabricated authority. 3. **layer_proxy.rs ceiling comment contradicted the amendment** → rewritten (comment-only, struct untouched): cap scoped to the dense whole-body family, T-1124 recorded as RESOLVED, windowed cap stated inline. 4. Staleness echo → body scoping documented as riding the response envelope (verified against actual AtlasResponseBuffer routing); echo narrowed to within-body disambiguation. 5. First-entry/centering → zoom-threshold-alone trigger (works over open ocean), first window centers on the pan-center's derived DistrictPos, downstream phrasing reconciled. The option-(c) carrier choice itself survived the adversarial pass unchanged ("well-reasoned… real, not a rationalization"). | # | Section | Issue | Status | |---|---------|-------|--------| | 1 | Amendment §2 | Windowed family had no cap — governance gap | FIXED (c20c175af) | | 2 | Amendment §1/§4 | Inline derive in PreInput drain — tick-stall hazard | FIXED — queue-based serving, binding | | 3 | layer_proxy.rs:77-83 | Code comment contradicted the ruling | FIXED — reconciled, comment-only | | 4 | Amendment §2 | Staleness echo under-documented on body scoping | FIXED | | 5 | Amendment §5 | First-fetch centering/trigger under-specified | FIXED | ### Verdict: APPROVED Runtime verification: full cargo + gdUnit suites via the pre-push gate on every push (3094 client / full server). Live capture against a running server: legend grows to 7 sections, TMP/QTR toggle clean; glyph truth pinned by exact-literal fixture replay. pql decisions validate clean on the final amendment. T-1137 updated with the binding queue-serving model before any wiring work can pick it up.
jpmschweitzer closed this pull request 2026-07-18 12:47:16 +02:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jpmschweitzer/settled-reach#185