fix(simulation): PR #173 review round — all 9 findings addressed

T1: heritage corridor_pool excluded from the ordinary phase-1 lottery and
coverage repair (D-232 reserves the heritage sub-pool for the remoteness
dial); reachable via hero pin, necessity swerve, and the T-1003 heritage
pool only. 3 new tests.
T2+H4: coverage repair no longer grows trait_selection past K when all
slots are pinned (phase-2 necessity swerve serves the type instead);
runtime warn when authored pins exceed K; V-TT-05 importer guardrail
bounds pins per body at 5 (max ComplexityTier K). 2 new tests + 2 python
tests.
H1: body-level dispatch aggregation extracted to pure
aggregate_body_dispatch_inputs + tested directly (union mix, MAX
prosperity/K); threading test asserts identical vocabulary/pools across
co-body settlements with per-settlement swerve rates. 2 new tests.
H2: tooling/economy-db/test_traits.py — 14 stdlib unittest cases over
V-TT-03/04/05 failure branches, wired into make test-tooling.
H3: hard-gate JSON parsers now tracing::warn on malformed blobs (silent
gate-widening) matching the sibling map parsers.
H5: catalog read memoized (OnceLock) — SQL+parse once per server run,
bias stays per-body. 1 new test.
T3: TraitDistrict seed-domain doc aligned with the two-level derive chain.
T4: D-225 misattribution dropped from the reader module doc.

systems.db regenerated + stamped (traits.py is a stamped source).
Gates: full cargo test 1638 green (goldens intact), clippy -D warnings,
ruff, make test-tooling (now incl. the traits units).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 12:18:14 +02:00
co-authored by Claude Fable 5
parent 034791602b
commit ebe8742469
8 changed files with 895 additions and 62 deletions
+7 -4
View File
@@ -126,10 +126,13 @@ pub enum SeedDomain {
/// any other body-scoped stream.
TraitVocabulary = 13,
/// Architecture-flavor district-dominant template pick (D-232 phase 2, T-994).
/// Keyed by a packed `(DistrictPos, DistrictType)` id so every settlement whose
/// quarter falls in the same D-243 2 048 m district independently derives the
/// *identical* dominant template for a given district type — same body seed +
/// same key, no cross-quarter coordination required.
/// Keyed by a **two-level derive chain** under this one domain — first by the
/// `DistrictPos` id (`pos_to_id`), then by the `DistrictType` ordinal — so
/// every settlement whose quarter falls in the same D-243 2 048 m district
/// independently derives the *identical* dominant template for a given
/// district type: same body seed + same two-level key, no cross-quarter
/// coordination required. (Two chained derives, not a packed single id —
/// see `trait_draw::pick_district_dominant_by_type`.)
TraitDistrict = 14,
/// Per-building deviation/swerve roll (D-232 deviation system, T-1003).
/// Derived off the footprint's own chain, keyed by footprint index. Distinct