From 1ce4085901a71841684e1450bd6a35a241d315e8 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Wed, 22 Jul 2026 00:51:22 +0200 Subject: [PATCH] style(simulation): cargo fmt on the fix round + governance amendment typo (Hoshe nit) --- governance/decisions/architecture.md | 2 +- server/src/atlas/detail_scatter.rs | 5 ++++- server/src/atlas/district_profile.rs | 3 +-- server/src/atlas/layer_proxy.rs | 33 +++++++++++++++++++++++----- server/src/atlas/plugin.rs | 8 ++++++- server/tests/zoom_ladder_bench.rs | 30 ++++--------------------- 6 files changed, 45 insertions(+), 36 deletions(-) diff --git a/governance/decisions/architecture.md b/governance/decisions/architecture.md index 902a10ad9..2f65849a6 100644 --- a/governance/decisions/architecture.md +++ b/governance/decisions/architecture.md @@ -1669,7 +1669,7 @@ Technical foundation decisions that constrain implementation: engine, client-ser **Amended 2026-07-21 (T-1145 — Jeroen, second companion hands-on, KALLAST window):** three regional-window presentation fixes, all client-only. **Cover-fit supersedes contain:** `fit_window_view()`'s zoom now derives from the LARGER viewport dimension with no margin factor (`max(viewport.x, viewport.y) / composite_native`, not the old `0.9 * min(...)`), so the square district-window composite fills a wide/tall viewport edge to edge instead of leaving side margins, with the shorter axis' data extending into pan-space (the same "cover" concept as CSS `object-fit: cover`) — the existing §4 pan-edge refetch is unaffected (it keys off the screen-center-to-DistrictPos mapping, which any fit already centers on `_held_center` by construction, so no refetch churn at rest). **WASD + edge-scroll supersedes drag-pan:** LMB-drag panning is removed entirely (Jeroen's ruling — drag conflicts with click semantics for the map objects, e.g. settlements, this window will host later); panning is now held WASD/arrow keys (continuous, frame-rate-independent, `_process`-polled, physical-keycode reads to stay independent of the project's existing `move_north`/etc. gameplay-movement InputMap actions bound to the same keys) plus edge-scrolling (cursor within ~24px of a viewport edge, suppressed over UI and while the OS window lacks focus); wheel zoom is unchanged; pole-wall (§5 amendment above) and east-west wrap (T-1142) semantics are preserved unchanged under the new input source. **Smoothing is an interim presentation, pending T-1143:** the composite renders as an `n`×`n` `Image`/`ImageTexture` (one pixel per district, the identical existing per-cell color pipeline) drawn scaled with linear filtering — the same treatment the planetary heightmap already gets — instead of `n`×`n` flat rects, so GPU bilinear sampling reads as a terrain gradient rather than hard blocks; the original crisp per-cell path survives behind a compile-time const specifically so T-1143's design pass can compare both directly, and this smoothing is **not** T-1143's answer to district-tier legibility, only a stopgap ahead of it. - **Amended 2026-07-21 (T-1143 design-pass rulings — Jeroen, after the zoom-ladder design pass, `docs/architecture/atlas-zoom-ladder-t1143.md`):** three rulings on the pass's reserved decisions. **(1) The item-(d) ceiling is opened for the Atlas ladder** — Jeroen: *"we set a new BHAG so old restrictions are up for debate."* The D-166 2026-07-21 zoom-ladder condition ("down to tile scale") is read **literally**: the Atlas windowed viewport may descend below quarter (512 m) toward block/tile granularity. This is an explicit ruling, not erosion — exactly the deliberate revisit the T-1112 §2 anti-erosion clause was hardened to force into the open. Item (d)'s substance survives in narrowed form: chunk/tile/voxel output still never appears as a **whole-body planetary map layer**, and the below-quarter rungs are implementation-gated on their own **measurement pass** (costs/wire for block and tile rungs are unmeasured — design pass §2/§7); the harness-verification path for L5 fill remains primary until that pass lands. **(2) Planetary rung wire carrier: progressive capped-density tiling** riding the generalized `district_window` carrier (granularity parameter, §3 of the design pass) — no new dense-raster wire shape, no forced tagged-envelope migration. **(3) The §5 entry click-through cut is superseded by continuous cursor-anchored zoom**: wheel-zoom carries the view from the orbital frame down through regional granularities continuously, anchored at the cursor, **with the condition that a full zoom-out resets to the original canonical planetary frame and location** (the fixed orbital framing is the ladder's top rest state, not a drifted pan state). The click-through descent and rectangle reticle are retired as the *sole* entry (T-1138's shipped mechanic stands until the continuous ladder replaces it in the same change — close inspection is never stranded, same discipline as the §5 fixed-view transition). D-013's "the zoom gesture owns spatial descent" reading is **restored** for this seam. **Wire-contract note (T-1150, PR #191 review — Tyre):** the `window_granularity` field ruling (2) rides on expresses **finer-than-district integer multiples only** (1 = district, 4 = quarter today; each new rung is a deliberate widening of `resolve_window_granularity`'s whitelist — the single widening point; unknown values fall back to district, never trusted from the wire). Coarser-than-district reuse (the region/orbital rungs of ruling (2)'s progressive tiling) requires the design pass's R5 signed/log-scale-or-enum redesign of the field — a new magic value is not the path. Recorded here so the type's limit is contract, not only a design-doc risk row. + **Amended 2026-07-21 (T-1143 design-pass rulings — Jeroen, after the zoom-ladder design pass, `docs/architecture/atlas-zoom-ladder-t1143.md`):** three rulings on the pass's reserved decisions. **(1) The item-(d) ceiling is opened for the Atlas ladder** — Jeroen: *"we set a new BHAG so old restrictions are up for debate."* The D-166 2026-07-21 zoom-ladder condition ("down to tile scale") is read **literally**: the Atlas windowed viewport may descend below quarter (512 m) toward block/tile granularity. This is an explicit ruling, not erosion — exactly the deliberate revisit the T-1112 §2 anti-erosion clause was hardened to force into the open. Item (d)'s substance survives in narrowed form: chunk/tile/voxel output still never appears as a **whole-body planetary map layer**, and the below-quarter rungs are implementation-gated on their own **measurement pass** (costs/wire for block and tile rungs are unmeasured — design pass §2/§7); the harness-verification path for L5 fill remains primary until that pass lands. **(2) Planetary rung wire carrier: progressive capped-density tiling** riding the generalized `district_window` carrier (granularity parameter, §3 of the design pass) — no new dense-raster wire shape, no forced tagged-envelope migration. **(3) The §5 entry click-through cut is superseded by continuous cursor-anchored zoom**: wheel-zoom carries the view from the orbital frame down through regional granularities continuously, anchored at the cursor, **with the condition that a full zoom-out resets to the original canonical planetary frame and location** (the fixed orbital framing is the ladder's top rest state, not a drifted pan state). The click-through descent and rectangle reticle are retired as the *sole* entry (T-1138's shipped mechanic stands until the continuous ladder replaces it in the same change — close inspection is never stranded, same discipline as the §5 fixed-view transition). D-013's "the zoom gesture owns spatial descent" reading is **restored** for this seam. **Wire-contract note (T-1150, PR #191 review — Tyre):** the `window_granularity` field that ruling (2) rides on expresses **finer-than-district integer multiples only** (1 = district, 4 = quarter today; each new rung is a deliberate widening of `resolve_window_granularity`'s whitelist — the single widening point; unknown values fall back to district, never trusted from the wire). Coarser-than-district reuse (the region/orbital rungs of ruling (2)'s progressive tiling) requires the design pass's R5 signed/log-scale-or-enum redesign of the field — a new magic value is not the path. Recorded here so the type's limit is contract, not only a design-doc risk row. - **Rationale:** Reusing the real UI — rather than a parallel offline renderer or dumped files — means the debug/review surface never diverges from what ships, and a dropped artifact can't go stale. Agent-navigability converts qualitative "does the synthesis look natural?" review from a manual eyeball pass into an automatable sweep that flags the few outliers for a human. The harness rides seams that already exist (`TickRate::Paused`, the paused-allowlist, `gameplay_occluded`, the bridge framing, the `run-visual` capture primitive) — a naming-and-contract exercise, not a new subsystem. - **New surface:** server pause-gating (run-conditions on the world phases keyed to a pause command); client `AtlasAgentInterface` (`observe`/`act`, Control-tree walker) + its local transport; the generation overlay rendering + selector + legend; interactive capture wired to `run-visual`. - **Implementation:** Phase 4 (epic T-750), built bottom-up — auto-pause substrate, T-969 proxy (D-225), T-960 viewer, agent channel, agent capture. Geography is the first consumer. diff --git a/server/src/atlas/detail_scatter.rs b/server/src/atlas/detail_scatter.rs index 86a3b19b2..6cbdaa570 100644 --- a/server/src/atlas/detail_scatter.rs +++ b/server/src/atlas/detail_scatter.rs @@ -329,7 +329,10 @@ mod tests { // (32_768.0) must skip every octave and fall back to 0.0 (the // norm==0.0 empty-sum guard), same as the flat_envelope_invents_nothing // envelope==0 case but reached via the cutoff instead. - assert_eq!(terrain_detail(5, 1_000.0, 2_000.0, 0.6, 0.5, 100_000.0), 0.0); + assert_eq!( + terrain_detail(5, 1_000.0, 2_000.0, 0.6, 0.5, 100_000.0), + 0.0 + ); } #[test] diff --git a/server/src/atlas/district_profile.rs b/server/src/atlas/district_profile.rs index 36dce66eb..fb1892ada 100644 --- a/server/src/atlas/district_profile.rs +++ b/server/src/atlas/district_profile.rs @@ -2044,8 +2044,7 @@ mod tests { for i in 0..20 { let wx = (100 + i * 37) as f64 * dm; let wy = (100 + i * 53) as f64 * dm; - let uncut = - derive_at_metres(test_seed(), "test_body", &p, &ta, wx, wy, &climate, 0.0); + let uncut = derive_at_metres(test_seed(), "test_body", &p, &ta, wx, wy, &climate, 0.0); let cut = derive_at_metres( test_seed(), "test_body", diff --git a/server/src/atlas/layer_proxy.rs b/server/src/atlas/layer_proxy.rs index 54c6d364d..8b48c8b84 100644 --- a/server/src/atlas/layer_proxy.rs +++ b/server/src/atlas/layer_proxy.rs @@ -606,7 +606,9 @@ fn derive_window_cell( morphology: prof.morphology_zone as u8, elev_q: prof.elev_q.clamp(0, 100) as u8, temp_dc: match prof.temperature_c { - Some(t) => ((t * 10.0).round() as i32).clamp(i16::MIN as i32 + 1, i16::MAX as i32) as i16, + Some(t) => { + ((t * 10.0).round() as i32).clamp(i16::MIN as i32 + 1, i16::MAX as i32) as i16 + } None => REGION_TEMP_NONE_DC, }, moisture_q: prof.moisture_q.clamp(0, 100) as u8, @@ -2301,7 +2303,13 @@ mod tests { if let GenCompletion::WindowDerived { body_id, layer } = c { if body_id == "BandBody" { window_cache.insert( - (body_id, layer.center, layer.n, layer.granularity, layer.min_wl_m), + ( + body_id, + layer.center, + layer.n, + layer.granularity, + layer.min_wl_m, + ), *layer, ); } @@ -2345,7 +2353,10 @@ mod tests { let layer_b = resp_b.district_window.expect("req_b must hit the cache"); assert_eq!(layer_a.min_wl_m, 4_096, "echo must be the QUANTIZED band"); assert_eq!(layer_b.min_wl_m, 4_096, "echo must be the QUANTIZED band"); - assert_eq!(layer_a, layer_b, "both requests must resolve to the identical cached layer"); + assert_eq!( + layer_a, layer_b, + "both requests must resolve to the identical cached layer" + ); } // ------------------------------------------------------------------- @@ -2502,7 +2513,13 @@ mod tests { if let GenCompletion::WindowDerived { body_id, layer } = c { if body_id == "SmallMoon" { window_cache.insert( - (body_id, layer.center, layer.n, layer.granularity, layer.min_wl_m), + ( + body_id, + layer.center, + layer.n, + layer.granularity, + layer.min_wl_m, + ), *layer, ); } @@ -2650,7 +2667,13 @@ mod tests { if let GenCompletion::WindowDerived { body_id, layer } = c { if body_id == "AliasBody" { window_cache.insert( - (body_id, layer.center, layer.n, layer.granularity, layer.min_wl_m), + ( + body_id, + layer.center, + layer.n, + layer.granularity, + layer.min_wl_m, + ), *layer, ); } diff --git a/server/src/atlas/plugin.rs b/server/src/atlas/plugin.rs index 1a49e946c..eca7a6ff7 100644 --- a/server/src/atlas/plugin.rs +++ b/server/src/atlas/plugin.rs @@ -414,7 +414,13 @@ fn drain_generation_completions( // `handle_atlas_request`'s window branch, which finds this // entry via `DistrictWindowCache::get` and serves it. window_cache.insert( - (body_id, layer.center, layer.n, layer.granularity, layer.min_wl_m), + ( + body_id, + layer.center, + layer.n, + layer.granularity, + layer.min_wl_m, + ), *layer, ); } diff --git a/server/tests/zoom_ladder_bench.rs b/server/tests/zoom_ladder_bench.rs index d2db9e3d7..d917774e9 100644 --- a/server/tests/zoom_ladder_bench.rs +++ b/server/tests/zoom_ladder_bench.rs @@ -80,16 +80,8 @@ fn time_derive_sweep( for col in 0..grid_side { let wx = col as f64 * step_m; let wy = row as f64 * step_m; - let prof = derive_at_metres( - seed, - body_id, - params, - ta, - wx, - wy, - climate, - min_wavelength_m, - ); + let prof = + derive_at_metres(seed, body_id, params, ta, wx, wy, climate, min_wavelength_m); // Prevent the optimizer from hoisting the call out of the loop. std::hint::black_box(prof.elev_q); } @@ -136,14 +128,7 @@ fn bench_derive_at_metres_district_and_quarter_spacing() { // of them; recorded for the design doc's requested (district, cutoff // 2048) combination regardless). let (elapsed, per_cell_ns) = time_derive_sweep( - seed, - "bench", - ¶ms, - &ta, - &climate, - grid_side, - district_m, - 2_048.0, + seed, "bench", ¶ms, &ta, &climate, grid_side, district_m, 2_048.0, ); println!( "district spacing, cutoff=2048m: {:>8.2} ms total, {:>7.1} ns/cell ({:.3} µs/cell)", @@ -155,14 +140,7 @@ fn bench_derive_at_metres_district_and_quarter_spacing() { // Quarter spacing (512 m), cutoff 512 m — the T-1150 Option B rung: full // reclassification at quarter spacing with the matching octave cutoff. let (elapsed, per_cell_ns) = time_derive_sweep( - seed, - "bench", - ¶ms, - &ta, - &climate, - grid_side, - quarter_m, - 512.0, + seed, "bench", ¶ms, &ta, &climate, grid_side, quarter_m, 512.0, ); println!( "quarter spacing, cutoff=512m: {:>8.2} ms total, {:>7.1} ns/cell ({:.3} µs/cell)",