fix(simulation): one absolute-metre derive core (D-256, T-1174)
derive_district_profile is now a thin wrapper over the shared derive_at_metres_with_riparian core at survey-cell-centre world metres — one derive core, two position sets. The batch pseudo-grid and the true D-243 district grid were two coordinate systems sharing one bare (i32,i32) type; the new SurveyCellPos newtype re-keys every batch product (BodyWorldState.districts, Layer1Output.survey_basin_dirs) so the compiler rejects cross-namespace passing. Fixes two latent same-position divergences the T-1174 investigation surfaced: three inconsistent latitude conventions collapse into the core's single inverse mapping, and the region-climate baseline now floor-divides true world metres instead of collapsing the whole body onto region (0,0)'s baseline — batch climate becomes latitude/region graded (D-245 direction: every changed believability metric increased). Binding preservations per D-256(c): basin_direction rides a post-call override with the true L1 D8 survey-cell aggregate (layer1's map re-keyed to SurveyCellPos, identity lookup — a floor-divide lookup against the pseudo-keyed map would have silently defaulted every cell North); the riparian verdict comes from near_perennial_water_at, never the empty-slice default (which would have flipped riverside vegetation_class). Quarter-skeleton morphology_zone now resolves at the settlement's exact world position via derive_at_metres at work-item execution (where TerrainAnalysisCache lives), replacing the survey-cell-centre map lookup (D-256(d)); settlement_district_pos fixed to true-district floor-division in passing (same doc/impl mismatch class). Second pixel-vs-metre conflation fixed in aliveness_probe's anchor-walk math. Window path byte-unchanged (window_derivation_golden 6/6 byte- identical); derivation_harness golden untouched; believability golden regenerated. Full lib + integration suites green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
//! `cascade_golden`).
|
||||
|
||||
use settled_reach_server::atlas::believability::{
|
||||
analyze, cascade_for_body, evaluate_criteria, seed_to_u64, BelievabilityReport,
|
||||
analyze, cascade_snapshot_for_body, evaluate_criteria, seed_to_u64, BelievabilityReport,
|
||||
};
|
||||
|
||||
const GOLDEN_FILE: &str = "tests/golden/believability.json";
|
||||
@@ -42,8 +42,18 @@ const VALIDATION_BODIES: &[(&str, &str, &str)] = &[
|
||||
/// Run the cascade + analyze for one body, or `None` if its committed data is absent.
|
||||
fn report_for(body_id: &str, seed: &str) -> Option<BelievabilityReport> {
|
||||
let world_seed = seed_to_u64(seed);
|
||||
match cascade_for_body(world_seed, body_id) {
|
||||
Ok(bws) => Some(analyze(world_seed, body_id, &bws.districts)),
|
||||
match cascade_snapshot_for_body(world_seed, body_id) {
|
||||
Ok((snapshot, params)) => {
|
||||
let bws = snapshot.into_body_world_state();
|
||||
Some(analyze(
|
||||
world_seed,
|
||||
body_id,
|
||||
&bws.districts,
|
||||
bws.heightmap_width,
|
||||
bws.heightmap_height,
|
||||
params.body_radius_km,
|
||||
))
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("[believability] SKIP {body_id}: {e}");
|
||||
None
|
||||
|
||||
@@ -1927,7 +1927,7 @@ fn derive_profile_for_body(params: &BodyParams) -> DistrictProfile {
|
||||
seed,
|
||||
params,
|
||||
&ta,
|
||||
(0, 0),
|
||||
scale::SurveyCellPos(0, 0),
|
||||
8,
|
||||
&climate,
|
||||
"test_body",
|
||||
|
||||
@@ -578,7 +578,7 @@ fn generate_atlas_layer_response_fixtures() {
|
||||
}],
|
||||
grid_w: 512,
|
||||
grid_h: 256,
|
||||
district_basin_dirs: std::collections::BTreeMap::new(),
|
||||
survey_basin_dirs: std::collections::BTreeMap::new(),
|
||||
};
|
||||
// T-960 §1/§2: a small populated RoadGraphLayer + SettlementLayer, one
|
||||
// settlement (a capital) connected to one waypoint-free short edge.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"voxel_sampled_districts": 64,
|
||||
"contrast": {
|
||||
"moisture_q": {
|
||||
"min": 16,
|
||||
"min": 17,
|
||||
"max": 97,
|
||||
"distinct": 74
|
||||
},
|
||||
@@ -23,7 +23,7 @@
|
||||
"ocean_fraction_q": {
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"distinct": 42
|
||||
"distinct": 44
|
||||
},
|
||||
"morphology_zones": 9,
|
||||
"vegetation_classes": 4,
|
||||
@@ -37,7 +37,7 @@
|
||||
"drainage_samples": 0,
|
||||
"drainage_monotonic": 0,
|
||||
"vegetation_samples": 64,
|
||||
"vegetated_districts": 5
|
||||
"vegetated_districts": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -69,7 +69,7 @@
|
||||
"morphology_zones": 6,
|
||||
"vegetation_classes": 2,
|
||||
"terrain_materials": 2,
|
||||
"voxel_relief_m": 21,
|
||||
"voxel_relief_m": 22,
|
||||
"micro_habitat_distinct": 0
|
||||
},
|
||||
"coherence": {
|
||||
|
||||
Reference in New Issue
Block a user