feat(simulation): T-1162 — invention octaves into the Atlas window path (coast crinkle, quarter relief, vegetation patchiness)

Coast: WARP_OCTAVE_WAVELENGTHS_M 5->9 entries (262144m down to 1024m,
Quarter's Nyquist floor) with new min_wavelength_m cutoff plumbing in
coast_warp_px/warp_fbm (the warp previously had no cutoff at all).
Relief: invent_primitives feeds the VOXEL band (1024-128m, salted) into
elev_q/slope_q under the same envelope/cutoff discipline. Vegetation:
new vegetation_invention module — two-tier (BodyParams+latitude envelope
ceiling; single blended fBm field, never-gated 100-400km massif tier at
70% + cutoff-gated district/voxel texture at 30%) perturbing moisture_q
OUTPUT so precipitation/glaciation/vegetation shift as one world-fact;
wire format unchanged. MIN_WL_BANDS_M 5->6 (adds 1024m band).

Mid-implementation correction caught by tests: District's quantized
floor is 4096m (OCTAVE_WAVELENGTHS_M[3]), not 2x DISTRICT_M — the 8192m
and 4096m coast octaves are legitimately District-admitted enrichment;
only 2048/1024m coast + the voxel band are Quarter-exclusive. Docs and
golden cutoffs corrected to match.

New golden: tests/window_derivation_golden.rs + fixture (derivation_
harness pattern, UPDATE_GOLDEN=1 regen) with structural guards pinning
Quarter/District divergence. Bench (zoom_ladder_bench, release): no
regression — all rungs at or below baseline (District c0 3.54->~3.0
us/cell, Quarter 2.10->1.77, orbital 1.48->1.42, n=6400 window
0.86->0.59 ms). Revert-verified voxel_relief cutoff exclusion. Server
lib 1840 passed; new module 11 tests; district_profile 84 (+6, 1
noise-fragile pre-existing test properly fixed via 8-district
latitude-band averaging).

Tickets: T-1162

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 22:56:34 +02:00
co-authored by Claude Fable 5
parent c9028af77e
commit 5cb63b6867
8 changed files with 1483 additions and 45 deletions
+47 -10
View File
@@ -404,20 +404,46 @@ fn clamp_window_n_v2(raw_n: u32, granularity: WindowGranularity) -> u32 {
}
}
/// Quantized `window_min_wl_m` bands (T-1150, zoom ladder design doc §5):
/// `0` (no cutoff) plus every entry of
/// [`crate::atlas::detail_scatter::OCTAVE_WAVELENGTHS_M`] — the SAME array
/// `terrain_detail`'s octave sum truncates against (both district and
/// quarter rungs derive via `terrain_detail`, so this is genuinely "the
/// rung's own octave bands", not a second independently-chosen scale).
/// Quantized `window_min_wl_m` bands (T-1150, zoom ladder design doc §5;
/// retuned T-1162 part (c)): `0` (no cutoff) plus every entry of
/// [`crate::atlas::detail_scatter::OCTAVE_WAVELENGTHS_M`] (32,768/16,384/
/// 8,192/4,096 m — District's own Nyquist floor, `2 × DISTRICT_M`), plus a
/// FIFTH band at `1,024` m — Quarter's own Nyquist floor (`2 × QUARTER_M =
/// 1,024`, matching a rung's content wavelength to what its `512` m sample
/// spacing can actually resolve — nothing finer than the rung can express,
/// nothing coarser than it deserves). `1,024` m is also the finest entry of
/// the extended [`crate::atlas::coast_invention::WARP_OCTAVE_WAVELENGTHS_M`]
/// band (T-1162 part a) and the coarsest entry of
/// [`crate::atlas::detail_scatter::VOXEL_OCTAVE_WAVELENGTHS_M`] the sub-district
/// relief wiring (T-1162 part b) admits at Quarter — one band serves both.
///
/// **Pre-T-1162 bands unchanged in VALUE** (32,768/16,384/8,192/4,096 stay
/// exactly where they were) — but **NOT unchanged in behavior at 8,192/4,096
/// specifically**: `terrain_detail`'s own octave array is untouched by this
/// ticket, so THAT contribution is byte-identical at every pre-existing band,
/// but the coast warp's octave array gained genuinely new 8,192/4,096 m
/// entries (T-1162 part a) that a District-rung request quantizing to those
/// bands now legitimately admits — District's real Nyquist floor (4,096 m)
/// is coarse enough to resolve that content, so this is intended enrichment
/// at District too, not a leak (see `coast_invention::WARP_OCTAVE_WAVELENGTHS_M`'s
/// doc for the full admit/exclude table). Only the 32,768/16,384 bands are
/// truly inert-to-this-ticket (no octave in any extended array falls in that
/// range). The sub-district relief band ([`crate::atlas::detail_scatter::VOXEL_OCTAVE_WAVELENGTHS_M`],
/// all ≤1,024 m) and the coast warp's two finest additions (2,048/1,024 m)
/// are genuinely excluded at every pre-existing band (all ≥4,096) — those are
/// Quarter-exclusive, admitted only by the new `1,024` band. The new band is
/// additive at the END of the array — appending, not reordering, keeps every
/// existing index-based reference to the first four entries valid.
///
/// Descending order except the leading `0.0` sentinel, matched by
/// `quantize_min_wl_m`'s scan below.
const MIN_WL_BANDS_M: [f64; 5] = [
const MIN_WL_BANDS_M: [f64; 6] = [
0.0,
crate::atlas::detail_scatter::OCTAVE_WAVELENGTHS_M[0],
crate::atlas::detail_scatter::OCTAVE_WAVELENGTHS_M[1],
crate::atlas::detail_scatter::OCTAVE_WAVELENGTHS_M[2],
crate::atlas::detail_scatter::OCTAVE_WAVELENGTHS_M[3],
1_024.0,
];
/// Snap a wire-supplied `window_min_wl_m` to the nearest fixed band in
@@ -2660,9 +2686,9 @@ mod tests {
assert_eq!(quantize_min_wl_m(0), 0);
}
/// A value nearer to 0 than to the finest real octave band (4,096) snaps
/// to 0 (no cutoff) — the band set includes 0 as a real, selectable band,
/// not just a special-cased default.
/// A value nearer to 0 than to the finest real octave band (T-1162: now
/// 1,024, the Quarter-rung floor) snaps to 0 (no cutoff) — the band set
/// includes 0 as a real, selectable band, not just a special-cased default.
#[test]
fn quantize_min_wl_m_small_value_snaps_to_zero_band() {
assert_eq!(quantize_min_wl_m(500), 0);
@@ -2678,6 +2704,17 @@ mod tests {
assert_eq!(quantize_min_wl_m(7_500), 8_192);
}
/// T-1162: a value between the new 1,024 band and 0 snaps to whichever is
/// nearer — exercises the new finest band specifically, not just the
/// pre-existing four.
#[test]
fn quantize_min_wl_m_snaps_to_new_quarter_floor_band() {
// Nearer 1,024 than 0 (dist 224 vs 800).
assert_eq!(quantize_min_wl_m(800), 1_024);
// Nearer 1,024 than 4,096 (dist 476 vs 2,596).
assert_eq!(quantize_min_wl_m(1_500), 1_024);
}
/// A value far above the coarsest band snaps to the coarsest band, never
/// panics or overflows — quantization must be a TOTAL function over all
/// u32 input (never trust the wire).