diff --git a/decisions/architecture.md b/decisions/architecture.md index 5b3c3f5c6..7f986b70a 100644 --- a/decisions/architecture.md +++ b/decisions/architecture.md @@ -1205,7 +1205,7 @@ Technical foundation decisions that constrain implementation: engine, client-ser - **Ticket:** #922 - **Raised by:** Generation cascade workshop (#897) - **Cross-reference:** D-096 (DistrictLayoutMode::Organic — consumes block_irregularity), D-194 (district mix — founding_age is an input), D-214 (PoliticalArchetype — archetype_step source) -- **Amendment (2026-05-26 — `founding_age_years` backfill, ticket #1000):** `founding_age_years` is backfilled on every inhabited body in `tooling/economy-db/import_economics.py` MIGRATION_SQL via `COALESCE(events-first, wave-fallback)`. **Events-first:** the system's authored `historical_events.age_years` for an `event_type ∈ {founding, first_settlement, colonization}` — currently empty in the live DB, so it is forward-compatible scaffolding only. **Wave-fallback** — canonical **founding-edge** of each wave's range (`docs/design/systems-framework-final-miri.md:495–499`): +- **Amendment (2026-05-26 — `founding_age_years` backfill, ticket #1000):** `founding_age_years` is backfilled on every inhabited body in `tooling/economy-db/import_economics.py` MIGRATION_SQL via `COALESCE(events-first, wave-fallback)`. **Events-first:** the system's authored `historical_events.age_years` for `event_type = 'colonial_charter'` — the canonical founding event authored during the economics built-world workshop. 9 systems in the live DB carry a colonial_charter row, driving 11 inhabited body values; 5 of those diverge meaningfully from their wave fallback (e.g. GJ 144 = 580 vs wave-1 fallback 600, GJ 338B = 590, GJ 380 = 480). **Wave-fallback** — canonical **founding-edge** of each wave's range (`docs/design/systems-framework-final-miri.md:495–499`): | `settlement_wave` | era | range (years ago) | founding-edge fallback | |---|---|---|---| diff --git a/server/data/systems.db b/server/data/systems.db index c9d63db87..8168bb200 100644 Binary files a/server/data/systems.db and b/server/data/systems.db differ diff --git a/tooling/economy-db/import_economics.py b/tooling/economy-db/import_economics.py index f2f493ae0..141fba10c 100755 --- a/tooling/economy-db/import_economics.py +++ b/tooling/economy-db/import_economics.py @@ -380,6 +380,7 @@ SET founding_age_years = COALESCE( FROM historical_events he WHERE he.system_id = bodies.system_id AND he.event_type = 'colonial_charter' + ORDER BY he.sort_order ASC LIMIT 1 ), ( @@ -389,6 +390,7 @@ SET founding_age_years = COALESCE( WHEN 'wave_3' THEN 300 WHEN 'wave_4' THEN 100 WHEN 'wave_5' THEN 40 + ELSE NULL -- unexpected settlement_wave: add a WHEN above END FROM system_history sh WHERE sh.system_id = bodies.system_id