refactor(simulation): harden #952 cascade per QA + architecture review

Addresses the Hoshe (QA) + Tyre (architecture) review of the SeedChain/cascade
work:

- Golden was pinning an empty river network (128x64 produced 0 river cells).
  Bumped to 256x128, where GJ1c yields a real network (93 river cells, 19
  mouths) — Layer 1's rivers are now actually guarded, not just attractors.
- SeedChain::for_body(world_seed, body_id) + fnv1a_64: the single canonical
  body_id(String) -> u64 path (FNV-1a, the repo convention), so callers can't
  derive divergent worlds from the same seed via different ad-hoc hashes. The
  golden now uses it.
- Stability guards: seed_domain_discriminants_are_pinned test (CI fails if a
  SeedDomain tag is renumbered); AttractorType gains #[repr(u8)] + explicit
  discriminants (it's cast as a sort key in features.rs).
- Tests: SeedChain::root(0) non-degenerate; run_cascade error path (missing
  file -> Err, not panic).
- Comments: clarified the id=0 derivations (sibling separation is caller-side
  via the per-district/quarter chain; #957 threads the index), tightened the
  all_district_types reachability comment (it pins the seed-0 sequence, not a
  probabilistic claim), and noted the golden's WORLD_SEED is cosmetic at
  Layers 0-1 + the x86_64 f32 capture caveat.

Deferred with reason: the run_cascade -> CascadeInputs struct refactor (Tyre)
is left for #954 — designing Layer-2's context shape now would be later-phase
detail, and there's a single caller to migrate then. EntityRng keeps its
domainless combine (migrating is stream-changing) — noted in D-224.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 13:24:03 +02:00
co-authored by Claude Opus 4.7
parent b4eff847fc
commit a61d030b47
7 changed files with 5938 additions and 4022 deletions
+12 -7
View File
@@ -371,22 +371,27 @@ pub enum TerritorialStatus {
/// The type of terrain feature that attracts settlement placement.
/// Source: D-195, D-209
// `#[repr(u8)]` with explicit discriminants: `AttractorType` is cast `as u8` as
// the primary sort key for the attractor list (`features.rs`), so the layout is
// load-bearing — reordering would change attractor ordering and the cascade
// golden. Append new variants; never renumber or reorder existing ones.
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum AttractorType {
/// Where a river meets sea level or coastline. Historically high-value.
RiverMouth,
RiverMouth = 0,
/// Proximity to coast without a river mouth. Port access.
CoastalAccess,
CoastalAccess = 1,
/// Where a river crosses a topographic saddle or confluence point.
RiverCrossing,
RiverCrossing = 2,
/// Local elevation minimum; flat, arable, sheltered.
ValleyFloor,
ValleyFloor = 3,
/// Saddle point between adjacent drainage basins; controls a mountain pass.
PassEntrance,
PassEntrance = 4,
/// Adjacent to a lake polygon.
LakeShore,
LakeShore = 5,
/// Flat terrain away from all other attractors; fallback for plains settlements.
PlainCenter,
PlainCenter = 6,
}
/// Fine-grained terrain classification carried by each `GeographicAttractor`.