From 54609eab1a40d9f2d556501968a37a06020d181a Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Mon, 8 Jun 2026 18:36:41 +0200 Subject: [PATCH] test+docs(simulation): address PR #164 review (both APPROVE) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Band-invariant test now sweeps high altitude (6 km) as well as sea level, so the lapse term + cold-end clamp are exercised jointly, not lat alone. (Hoshe #1, Tyre #3) - Clarify the temp() helper comment: seed 0 is deterministic but still applies a constant non-zero nudge. (Hoshe #2) - (Hoshe #3: confirmed tectonic_activity is genuinely absent from systems-schema.sql; the reader's 'not in schema' comment is accurate — no change.) Co-Authored-By: Claude Opus 4.8 (1M context) --- server/src/atlas/region_profile.rs | 37 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/server/src/atlas/region_profile.rs b/server/src/atlas/region_profile.rs index fa6b14c2f..b21e3d0f0 100644 --- a/server/src/atlas/region_profile.rs +++ b/server/src/atlas/region_profile.rs @@ -1171,7 +1171,8 @@ mod tests { // T-1024 / D-240 climate derivation tests — planet_class envelope model // ----------------------------------------------------------------------- - /// Convenience: derive temperature with seed=0 for deterministic tests. + /// Convenience: derive temperature with a fixed seed (0) — deterministic, but + /// note seed 0 still applies its (constant, non-zero) nudge like any other seed. fn temp(planet_class: &str, atmosphere: &str, lat: f64, elev_km: f64) -> Option { let params = BodyParams { planet_class: Some(planet_class.into()), @@ -1313,21 +1314,25 @@ mod tests { let (cold, warm) = climate.envelope(class); for atmo in &atmospheres { for &lat in &latitudes { - for seed in seeds { - let params = BodyParams { - planet_class: Some((*class).into()), - atmosphere: Some((*atmo).into()), - region_latitude_deg: lat, - elevation_km: 0.0, - ..Default::default() - }; - let t = derive_temperature_c(¶ms, &climate, seed) - .expect("non-airless body must have temperature"); - assert!( - t >= cold && t <= warm, - "class={class} atmo={atmo} lat={lat} seed={seed}: \ - temperature {t}°C outside band [{cold}, {warm}]" - ); + // Sweep sea level AND high altitude so the lapse term + clamp + // are exercised jointly against the cold end, not just lat alone. + for elev in [0.0_f64, 6.0] { + for seed in seeds { + let params = BodyParams { + planet_class: Some((*class).into()), + atmosphere: Some((*atmo).into()), + region_latitude_deg: lat, + elevation_km: elev, + ..Default::default() + }; + let t = derive_temperature_c(¶ms, &climate, seed) + .expect("non-airless body must have temperature"); + assert!( + t >= cold && t <= warm, + "class={class} atmo={atmo} lat={lat} elev={elev} seed={seed}: \ + temperature {t}°C outside band [{cold}, {warm}]" + ); + } } } }