feat(simulation): lakes from settled hydrology (D-227, T-1184)
Productionizes the T-1177 equilibrium solver: run_layer1 now solves hydrology once per body (~24ms, mirrors drainage::analyze) and carries it as TerrainAnalysis.hydrology; run_layer1_with_moisture threads the real body moisture ceiling (extracted derive_moisture_ceiling_q), with the T-1177 population-survey default as fallback. The resident rung-0 global tier does not exist yet (T-1181's scope) — hydrology rides TerrainAnalysis and lands in that tier for free when it is built (deviation recorded on the ticket). MorphologyZone::Lake is now sourced from the settled solver at derive time: a gridunit is Lake when bilinear-sampled filled surface exceeds bilinear-sampled original elevation at the sample's own (px, py) — the continuous comparison, so lake edges refine with rung like coastlines; never a discrete basin-cell projection. The gate sits strictly between OpenOcean (>= 80) and the old ocean_fraction heuristic (>= 60), which survives as the derive-fresh fallback when no solve is attached — byte-identical to pre-T-1184 output in that case. Static classification, distinct from the sim-state flooded plane; no endorheic bit (the drains-vs-closed cue is T-1185's outlet-course presence, per the D-227 amendment (4) sequencing). Zero new wire bytes. Acceptance: lake_classification_cache_hit_equals_cache_miss (solve twice independently, byte-identical zones, non-vacuous Lake hit) plus hydrology determinism tests. Golden fidelity: the window golden fixture now builds TerrainAnalysis through the production entry point (run_layer1_with_moisture, per-body), and a dedicated lake_bowl golden body pins the hydrology-sourced Lake path (morphology 1 at ocean_fraction_q 0 — provably not the heuristic); the 108 pre-existing golden rows are byte-identical (pure append). believability.json moved by one lake-shaped line (GJ338Bd voxel_relief_m 27->28, a correctly reclassified lake district leaving the dry-relief sample set). river_course and derivation-harness goldens unchanged. Full suite: 2114 passed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3830,6 +3830,20 @@ mod tests {
|
||||
assert_eq!(ta_pass1.water_dist, ta_pass2.water_dist);
|
||||
assert_eq!(ta_pass1.slope_deg, ta_pass2.slope_deg);
|
||||
assert_eq!(ta_pass1.elev_pct, ta_pass2.elev_pct);
|
||||
// T-1184: two independent hydrology solves (each run_layer1 call
|
||||
// solves fresh — no shared HydrologyResult) must also agree
|
||||
// byte-for-byte, extending this test's own "weakest link in the
|
||||
// determinism chain" rationale to the newest field on TerrainAnalysis.
|
||||
let hydro1 = ta_pass1
|
||||
.hydrology
|
||||
.as_ref()
|
||||
.expect("run_layer1 must populate hydrology");
|
||||
let hydro2 = ta_pass2
|
||||
.hydrology
|
||||
.as_ref()
|
||||
.expect("run_layer1 must populate hydrology");
|
||||
assert_eq!(hydro1.elevation, hydro2.elevation);
|
||||
assert_eq!(hydro1.filled, hydro2.filled);
|
||||
|
||||
// Now the FULL path: pack a DistrictWindowLayer from each independent
|
||||
// TerrainAnalysis and confirm the complete served payload agrees.
|
||||
|
||||
Reference in New Issue
Block a user