Implements D-242 end-to-end: corp HQs leave the city pool, and per-settlement population + settlement_class are baked at import. Closes T-1074 + T-1075; unblocks T-1076 (road-graph hub refinement).
T-1074 — corp-HQ settlement model
Removed the reserved=1 corp-HQ cross-reference (populate_atlas_city_names_corps) — all 30 duplicate co-named city groups (10x Groombridge on GJ380c, etc.) eliminated; 0 duplicate (body_id, name) groups post-regen.
New corporations.corp_specialization keyed on the D-237 vocabulary, extended 27 -> 30 (trade_distribution, hospitality_hub, professional_services); authored per corp as wiki frontmatter across 155 pages.
Authored wiki/economics/corp_hq_placement.toml: all 30 values -> {CityTenant, Standalone} + standalone_economic_role.
CityTenant: new headquarters_city_id FK (58/60 linked). Standalone: 94 settlements emitted as ordinary atlas_city_names rows — zero Rust production changes at the read_body_settlements -> match_cities seam; 2 new regression tests lock the invariant.
headquarters_body backfilled via the lifted most-populated-body heuristic + body-type tiebreak fix (154/155; the 1 gap is a pre-existing broken Sova ref — T-1054).
Retired the orphaned tooling/populate-corporations.sh hand-seed script.
T-1075 — population/class bake
import_economics derives per-city population from bodies.population via a documented integer Zipf rank-size curve on every regen — sums exactly, 0 discrepancies across 276 bodies.
D-242 implementation status + derivation-at-import amendment; D-207/D-223 supersede notes; new TOMLs registered in tooling/generator_sources.py.
Verification
3x consecutive make regen-db deterministic (identical counts), stamp fresh; full cargo test green; clippy --all-targets -D warnings clean; ruff + make test-tooling green; live cascade run places a Standalone HQ alongside pooled cities through the unmodified pipeline.
Follow-ups
T-1115 filed: 10 wiki-pageless legacy corps + GJ 702B has zero authored city names.
## Summary
Implements D-242 end-to-end: corp HQs leave the city pool, and per-settlement population + settlement_class are baked at import. Closes T-1074 + T-1075; unblocks T-1076 (road-graph hub refinement).
### T-1074 — corp-HQ settlement model
- Removed the reserved=1 corp-HQ cross-reference (`populate_atlas_city_names_corps`) — all 30 duplicate co-named city groups (10x Groombridge on GJ380c, etc.) eliminated; 0 duplicate (body_id, name) groups post-regen.
- New `corporations.corp_specialization` keyed on the D-237 vocabulary, extended 27 -> 30 (trade_distribution, hospitality_hub, professional_services); authored per corp as wiki frontmatter across 155 pages.
- Authored `wiki/economics/corp_hq_placement.toml`: all 30 values -> {CityTenant, Standalone} + standalone_economic_role.
- CityTenant: new `headquarters_city_id` FK (58/60 linked). Standalone: 94 settlements emitted as ordinary `atlas_city_names` rows — zero Rust production changes at the `read_body_settlements` -> `match_cities` seam; 2 new regression tests lock the invariant.
- `headquarters_body` backfilled via the lifted most-populated-body heuristic + body-type tiebreak fix (154/155; the 1 gap is a pre-existing broken Sova ref — T-1054).
- Retired the orphaned `tooling/populate-corporations.sh` hand-seed script.
### T-1075 — population/class bake
- `import_economics` derives per-city population from `bodies.population` via a documented integer Zipf rank-size curve on every regen — sums exactly, 0 discrepancies across 276 bodies.
- `settlement_class` defaults PopulationBudget (D-196 thresholds); `wiki/economics/settlement_name_locked.toml` pins 8 hero cities NameLocked. EconomicTriggered/OrganicGrowth stay simulation-time.
### Governance
D-242 implementation status + derivation-at-import amendment; D-207/D-223 supersede notes; new TOMLs registered in `tooling/generator_sources.py`.
### Verification
3x consecutive `make regen-db` deterministic (identical counts), stamp fresh; full cargo test green; clippy --all-targets -D warnings clean; ruff + make test-tooling green; live cascade run places a Standalone HQ alongside pooled cities through the unmodified pipeline.
### Follow-ups
T-1115 filed: 10 wiki-pageless legacy corps + GJ 702B has zero authored city names.
Review: settlement-dataset-d242 → main (type: code + content slice)
Reviewers: Hoshe (code quality), Tyre (architecture), Miri (world consistency — wiki/vocabulary slice). All three read source from the branch worktree (HEAD 0c8a27047, verified = branch tip, not sparse). Pre-push gate (fmt/clippy/full cargo test/deny/ruff/test-tooling/stamp) passed before push and was not duplicated here. Runtime verification: no client or merge-path code touched; live cascade run documented in the PR description.
Hoshe (Code Quality): REQUEST_CHANGES
Zipf population-spread math verified correct (exact-sum, non-negative, monotonic across 20,000+ randomized trials), Rust test additions genuinely load-bearing, SQL parameterization clean throughout. But the headquarters_body backfill has a live bug, and the tiebreak it feeds rests on a premise the PR's own data disproves.
headquarters_body backfill is a permanent one-shot no-op: corporations is append-only across regen runs and the if hq_body: continue guard treats the heuristic's own prior output as authored data (nothing is actually authored in this column). Live-verified: 0 headquarters_body backfilled on every rerun; prometheus-labs/kovalev-freight are stuck on GJ702B-belt while the branch's fixed heuristic returns GJ702Bb. Lead independently confirmed against the committed DB. Fix: provenance marker distinguishing authored vs derived (so derived always re-runs), or drop the guard until an authoring path exists.
_BODY_TYPE_SETTLEMENT_PREFERENCE premise ("asteroid_belt/oort_cloud are geometry, never named settlements") is contradicted by this PR's own generated data in 8 of 9 divergence cases — populate_standalone_hq_settlements freely places settlements on belts (GJ845-belt → Orkney Ceramics, GJ268-belt → Jeju Lattice, GJ222A-belt → Groot Karoo Cellars + Kalahari Leatherworks). If H1 is fixed as-is, the tiebreak would forcibly move calluna-wellness and namsan-collective off currently-working belt tenant links onto planets with zero cities. Either the type-ranking should defer to "does this body have city rows", or the standalone-HQ insertion needs the same body-type restriction. H1+H2 need one joint design call.
The "verified against a real, repeated make regen-db / deterministic across 3 consecutive runs" claims describe a no-op being stably a no-op — the backfill+tiebreak never actually fire after the first run. Correct the verification note once H1/H2 land so the next reader doesn't assume the tiebreak is exercised in production.
Tyre (Architecture): REQUEST_CHANGES
Implementation cross-checked against D-242, D-237, D-223, D-207, D-211, D-196, D-010 and the asset-pipeline rule. Determinism of the pure-integer Zipf spread holds; D-242 verification counts match the committed systems.db exactly; vocabulary extension is clean 1:1 coverage; the FK-clear-ordering fix is correct; "standalone HQ = ordinary row" tradeoff is explicitly disclosed in D-242 and works on current data (checked: 94/95 recoverable via name join, zero collisions) — not flagged. Two gaps:
#
File
Issue
T1
tooling/generator_sources.py:134-152
wiki/corporations/*.md (155 files) is not in the stamp source set, but these pages now author corp_specialization → drives hq_placement, headquarters_body, and standalone settlement-row creation. An edit there without make regen-db slips past check-systems-db-stamp and the pre-push hook, contradicting the asset-pipeline freshness guarantee. Pre-existing gap, but this PR makes it load-bearing. Fix: glob CORPORATIONS_DIR into IMPORT_ECONOMICS_SOURCES.
populate_corp_specialization only UPDATEs corps present in the current authored set — no NULL-reset pass first, so a removed frontmatter key leaves a stale baked value and rebuild-from-source determinism breaks on import history. The sibling settlement_class bake (atlas.py:333-337, this same PR) implements reset-before-override correctly for exactly this reason. Mirror it. (headquarters_body's never-clobber is a separate, intentional design — see H1 for its own problem.)
Miri (World Consistency): REQUEST_CHANGES
Sampled 36/155 corp pages (all five flagged judgment calls + every specialization bucket), full re-read of the vocabulary/placement/hero-pin TOMLs, cross-checked against D-237 examples and system wiki prose. Categorization accurate in every sampled case but one; the 3 new vocabulary values, all 30 placement mappings, and all 8 NameLocked pins check out.
Miscategorized. The page describes "Licensed Re-embodiment and Longevity Services", "the Assembly re-embodiment medical license", "40+ clinic locations" — a licensed clinical-services institution central to the setting's longevity/Perpetual-class lore, not general advisory (professional_services anchors on insurance/consulting/arbitration). longevity_monopoly is correctly reserved for Prometheus Labs (sole provider); Somatic Futures is explicitly non-monopoly ("and a small number of other certified operators"). This is a second instance of the exact vocabulary-gap class this PR fixed with its 3 new values. Fix: add licensed_clinical_services (anchor medical_services, NonPhysical → CityTenant, Specialist — non-monopoly counterpart to longevity_monopoly) and re-tag somatic-futures. Placement (CityTenant at Kallast) is correct either way.
Verdict: CHANGES REQUESTED
6 findings (H1-H3, T1-T2, M1). H1+H2 are one joint design decision; T1/T2/M1 are independent, well-scoped fixes. H3 is a documentation correction downstream of H1/H2.
Process note: a reviewer's live-import verification dirtied the worktree systems.db; the lead restored it to the committed state before this comment — the branch tree is clean for the fix round.
## Review: settlement-dataset-d242 → main (type: code + content slice)
Reviewers: Hoshe (code quality), Tyre (architecture), Miri (world consistency — wiki/vocabulary slice). All three read source from the branch worktree (HEAD `0c8a27047`, verified = branch tip, not sparse). Pre-push gate (fmt/clippy/full cargo test/deny/ruff/test-tooling/stamp) passed before push and was not duplicated here. Runtime verification: no client or merge-path code touched; live cascade run documented in the PR description.
### Hoshe (Code Quality): REQUEST_CHANGES
Zipf population-spread math verified correct (exact-sum, non-negative, monotonic across 20,000+ randomized trials), Rust test additions genuinely load-bearing, SQL parameterization clean throughout. But the headquarters_body backfill has a live bug, and the tiebreak it feeds rests on a premise the PR's own data disproves.
| # | File | Issue |
|---|------|-------|
| H1 | tooling/economy-db/economy_import/corporations.py:292-313 | headquarters_body backfill is a **permanent one-shot no-op**: `corporations` is append-only across regen runs and the `if hq_body: continue` guard treats the heuristic's own prior output as authored data (nothing is actually authored in this column). Live-verified: `0 headquarters_body backfilled` on every rerun; prometheus-labs/kovalev-freight are stuck on `GJ702B-belt` while the branch's fixed heuristic returns `GJ702Bb`. Lead independently confirmed against the committed DB. Fix: provenance marker distinguishing authored vs derived (so derived always re-runs), or drop the guard until an authoring path exists. |
| H2 | tooling/economy-db/economy_import/atlas.py:167-184 | `_BODY_TYPE_SETTLEMENT_PREFERENCE` premise ("asteroid_belt/oort_cloud are geometry, never named settlements") is contradicted by this PR's own generated data in 8 of 9 divergence cases — populate_standalone_hq_settlements freely places settlements on belts (GJ845-belt → Orkney Ceramics, GJ268-belt → Jeju Lattice, GJ222A-belt → Groot Karoo Cellars + Kalahari Leatherworks). If H1 is fixed as-is, the tiebreak would forcibly move calluna-wellness and namsan-collective off currently-working belt tenant links onto planets with zero cities. Either the type-ranking should defer to "does this body have city rows", or the standalone-HQ insertion needs the same body-type restriction. H1+H2 need one joint design call. |
| H3 | governance/decisions/architecture.md (D-242 implementation-status entry) + wiki/economics/settlement_name_locked.toml header | The "verified against a real, repeated make regen-db / deterministic across 3 consecutive runs" claims describe a no-op being stably a no-op — the backfill+tiebreak never actually fire after the first run. Correct the verification note once H1/H2 land so the next reader doesn't assume the tiebreak is exercised in production. |
### Tyre (Architecture): REQUEST_CHANGES
Implementation cross-checked against D-242, D-237, D-223, D-207, D-211, D-196, D-010 and the asset-pipeline rule. Determinism of the pure-integer Zipf spread holds; D-242 verification counts match the committed systems.db exactly; vocabulary extension is clean 1:1 coverage; the FK-clear-ordering fix is correct; "standalone HQ = ordinary row" tradeoff is explicitly disclosed in D-242 and works on current data (checked: 94/95 recoverable via name join, zero collisions) — not flagged. Two gaps:
| # | File | Issue |
|---|------|-------|
| T1 | tooling/generator_sources.py:134-152 | `wiki/corporations/*.md` (155 files) is not in the stamp source set, but these pages now author corp_specialization → drives hq_placement, headquarters_body, and standalone settlement-row creation. An edit there without `make regen-db` slips past check-systems-db-stamp and the pre-push hook, contradicting the asset-pipeline freshness guarantee. Pre-existing gap, but this PR makes it load-bearing. Fix: glob CORPORATIONS_DIR into IMPORT_ECONOMICS_SOURCES. |
| T2 | tooling/economy-db/economy_import/corporations.py:284-291 | populate_corp_specialization only UPDATEs corps present in the current authored set — no NULL-reset pass first, so a removed frontmatter key leaves a stale baked value and rebuild-from-source determinism breaks on import history. The sibling settlement_class bake (atlas.py:333-337, this same PR) implements reset-before-override correctly for exactly this reason. Mirror it. (headquarters_body's never-clobber is a separate, intentional design — see H1 for its own problem.) |
### Miri (World Consistency): REQUEST_CHANGES
Sampled 36/155 corp pages (all five flagged judgment calls + every specialization bucket), full re-read of the vocabulary/placement/hero-pin TOMLs, cross-checked against D-237 examples and system wiki prose. Categorization accurate in every sampled case but one; the 3 new vocabulary values, all 30 placement mappings, and all 8 NameLocked pins check out.
| # | File | Issue |
|---|------|-------|
| M1 | wiki/corporations/somatic-futures.md (corp_specialization: professional_services) | Miscategorized. The page describes "Licensed Re-embodiment and Longevity Services", "the Assembly re-embodiment medical license", "40+ clinic locations" — a licensed clinical-services institution central to the setting's longevity/Perpetual-class lore, not general advisory (professional_services anchors on insurance/consulting/arbitration). longevity_monopoly is correctly reserved for Prometheus Labs (sole provider); Somatic Futures is explicitly non-monopoly ("and a small number of other certified operators"). This is a second instance of the exact vocabulary-gap class this PR fixed with its 3 new values. Fix: add `licensed_clinical_services` (anchor medical_services, NonPhysical → CityTenant, Specialist — non-monopoly counterpart to longevity_monopoly) and re-tag somatic-futures. Placement (CityTenant at Kallast) is correct either way. |
### Verdict: CHANGES REQUESTED
6 findings (H1-H3, T1-T2, M1). H1+H2 are one joint design decision; T1/T2/M1 are independent, well-scoped fixes. H3 is a documentation correction downstream of H1/H2.
Process note: a reviewer's live-import verification dirtied the worktree systems.db; the lead restored it to the committed state before this comment — the branch tree is clean for the fix round.
H1+H2: headquarters_body is reset+derived every run (DB is never source); optional authored frontmatter override, hard-validated; tiebreak now population DESC -> city-bearing body -> type rank -> body_id, preserving belt tenancies and fixing GJ702B to GJ702Bb. T2: NULL-reset pass for corp_specialization/hq_placement before authored re-apply (poison-tested). T1: wiki/corporations/*.md globbed into IMPORT_ECONOMICS_SOURCES. M1: licensed_clinical_services vocabulary value (31st, NonPhysical->CityTenant) + somatic-futures retag. Fixpoint verified stable across 4 consecutive regens (0 diffs); regen systems.db.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
No pushbacks; every finding was accepted and addressed. Lead independently re-verified the headline claims against the regenerated DB before this comment.
Fixed — reset+derive every run. The three importer-owned columns (corp_specialization, hq_placement, headquarters_body) are NULLed for all corps each run, authored values re-applied from source, heuristic re-resolves the rest. An optional authored headquarters_body: frontmatter override is implemented now (hard-validated: body must exist and sit in the corp's HQ system) — authored data lives in source files, never in DB state. Verified: 4 consecutive regens each print "154 headquarters_body resolved (recomputed every run)" with full-snapshot diffs A=B=C=D at 0 differences; a poisoned-DB test (garbage in all three columns) fully re-derives a wiki corp and reverts a legacy corp to NULL.
H2
Body-type tiebreak premise contradicted by belt settlements
Fixed — city-presence tier added. Tiebreak is now population DESC → city-bearing body (has atlas_city_names rows) → body-type rank → body_id. Both working belt tenancies are preserved with identical targets (calluna-wellness → Orkney Ceramics on GJ845-belt; namsan-collective → Jeju Lattice on GJ268-belt — verified the only signal that can preserve these is the presence tier, since those settlements are themselves Standalone-HQ rows). GJ702B corps move to planet GJ702Bb (only 2 placement changes repo-wide vs baseline; still unmatched tenants pending T-1115, logged not errored). The presence set reads the previous run's settled atlas_city_names state — documented as deliberate hysteresis (one-run lag for brand-new Standalone corps; loud warning if empty) in the docstring and D-242, with the fixpoint proven stable empirically. _BODY_TYPE_SETTLEMENT_PREFERENCE comment rewritten to the corrected premise.
H3
Verification wording describes a no-op being stably a no-op
Fixed. D-242 status entry and settlement_name_locked.toml header rewritten to describe recompute-every-run behavior and the actually-measured outcomes (incl. why the 3 corp-named NameLocked pins survive recompute: population-first re-derivation, not held-over state). Prometheus gap now cites T-1115.
T1
Corp wiki pages not in the stamp source set
Fixed. CORPORATIONS_DIR moved into the registry; _corporation_pages() globs wiki/corporations/*.md (sorted, index.md excluded, fail-closed) into IMPORT_ECONOMICS_SOURCES; paths.py re-exports from the registry. check-systems-db confirms the stamp now covers the 155 pages.
T2
No reset pass for corp_specialization/hq_placement
Fixed. NULL-reset for all corps before the authored re-apply, mirroring the settlement_class reset-before-override pattern. Removed-key case verified: a corp dropped from the authored set reverts to all-NULL on the next run.
M1
somatic-futures miscategorized as professional_services
Fixed. New licensed_clinical_services vocabulary value (31st: anchor medical_services, NonPhysical, Specialist, override concentrated — passes V-SES-03), corp_hq_placement.toml stanza (CityTenant; no standalone_economic_role per the file's Standalone-only convention), somatic-futures retagged. Placement unchanged (CityTenant at Kallast, GJ144d). 155/155 specialized; vocabulary 31 values / placement map 31 stanzas.
Gate re-run on push: fmt/clippy/full cargo test/deny/ruff/test-tooling/stamp all green. Reviewers have been asked to verify their own findings for the re-review verdict.
## Review response — all 6 findings fixed (commits e63caeb62, 9bb533a8b)
No pushbacks; every finding was accepted and addressed. Lead independently re-verified the headline claims against the regenerated DB before this comment.
| # | Finding | Resolution |
|---|---------|------------|
| H1 | headquarters_body backfill permanent one-shot no-op | **Fixed — reset+derive every run.** The three importer-owned columns (corp_specialization, hq_placement, headquarters_body) are NULLed for all corps each run, authored values re-applied from source, heuristic re-resolves the rest. An optional authored `headquarters_body:` frontmatter override is implemented now (hard-validated: body must exist and sit in the corp's HQ system) — authored data lives in source files, never in DB state. Verified: 4 consecutive regens each print "154 headquarters_body resolved (recomputed every run)" with full-snapshot diffs A=B=C=D at 0 differences; a poisoned-DB test (garbage in all three columns) fully re-derives a wiki corp and reverts a legacy corp to NULL. |
| H2 | Body-type tiebreak premise contradicted by belt settlements | **Fixed — city-presence tier added.** Tiebreak is now population DESC → **city-bearing body** (has atlas_city_names rows) → body-type rank → body_id. Both working belt tenancies are preserved with identical targets (calluna-wellness → Orkney Ceramics on GJ845-belt; namsan-collective → Jeju Lattice on GJ268-belt — verified the only signal that can preserve these is the presence tier, since those settlements are themselves Standalone-HQ rows). GJ702B corps move to planet GJ702Bb (only 2 placement changes repo-wide vs baseline; still unmatched tenants pending T-1115, logged not errored). The presence set reads the previous run's settled atlas_city_names state — documented as deliberate hysteresis (one-run lag for brand-new Standalone corps; loud warning if empty) in the docstring and D-242, with the fixpoint proven stable empirically. _BODY_TYPE_SETTLEMENT_PREFERENCE comment rewritten to the corrected premise. |
| H3 | Verification wording describes a no-op being stably a no-op | **Fixed.** D-242 status entry and settlement_name_locked.toml header rewritten to describe recompute-every-run behavior and the actually-measured outcomes (incl. why the 3 corp-named NameLocked pins survive recompute: population-first re-derivation, not held-over state). Prometheus gap now cites T-1115. |
| T1 | Corp wiki pages not in the stamp source set | **Fixed.** CORPORATIONS_DIR moved into the registry; _corporation_pages() globs wiki/corporations/*.md (sorted, index.md excluded, fail-closed) into IMPORT_ECONOMICS_SOURCES; paths.py re-exports from the registry. check-systems-db confirms the stamp now covers the 155 pages. |
| T2 | No reset pass for corp_specialization/hq_placement | **Fixed.** NULL-reset for all corps before the authored re-apply, mirroring the settlement_class reset-before-override pattern. Removed-key case verified: a corp dropped from the authored set reverts to all-NULL on the next run. |
| M1 | somatic-futures miscategorized as professional_services | **Fixed.** New licensed_clinical_services vocabulary value (31st: anchor medical_services, NonPhysical, Specialist, override concentrated — passes V-SES-03), corp_hq_placement.toml stanza (CityTenant; no standalone_economic_role per the file's Standalone-only convention), somatic-futures retagged. Placement unchanged (CityTenant at Kallast, GJ144d). 155/155 specialized; vocabulary 31 values / placement map 31 stanzas. |
Gate re-run on push: fmt/clippy/full cargo test/deny/ruff/test-tooling/stamp all green. Reviewers have been asked to verify their own findings for the re-review verdict.
All three reviewers re-verified their own findings against branch tip 9bb533a8b — each independently confirmed the fixes in code and against the committed DB, not just from the fix-round claims:
Hoshe: APPROVE. H1 reset+derive confirmed (corporations.py:373-382); GJ702B corps verified at GJ702Bb; dry-run reproduces "154 resolved (recomputed every run)". H2 city-bearing tier confirmed (atlas.py:228-235) — re-ran the original 9-system divergence check: all 8 belt-settlement systems resolve to the belt, both live tenancies preserved. H3 governance wording now accurate. No new issues.
Tyre: APPROVE. T1 verified end-to-end: corp-page frontmatter edits now change the stamped SHA. T2 poison-tested: removed key reverts all three columns to NULL. H2 hysteresis ruled architecturally acceptable: committed DB is a self-consistent fixpoint (0 changes on re-run), resolution is order-independent, failure modes bounded and loud; residual observation (committed DB mildly load-bearing for 11 belt-tenant tiebreaks) disclosed and traced to the T-1115 content gap — not a blocker.
Miri: APPROVE. licensed_clinical_services style-consistent and correctly distinct from longevity_monopoly on the market-structure axis; placement stanza well-formed; boundary scan (sato-medical, salud-alliance, calluna-wellness, prometheus-labs, spitsbergen-retreat) confirms no other corp moves — the line is Assembly medical licensure of the clinical practice itself.
Merging to main and closing.
## Re-review verdict: APPROVED
All three reviewers re-verified their own findings against branch tip 9bb533a8b — each independently confirmed the fixes in code and against the committed DB, not just from the fix-round claims:
- **Hoshe: APPROVE.** H1 reset+derive confirmed (corporations.py:373-382); GJ702B corps verified at GJ702Bb; dry-run reproduces "154 resolved (recomputed every run)". H2 city-bearing tier confirmed (atlas.py:228-235) — re-ran the original 9-system divergence check: all 8 belt-settlement systems resolve to the belt, both live tenancies preserved. H3 governance wording now accurate. No new issues.
- **Tyre: APPROVE.** T1 verified end-to-end: corp-page frontmatter edits now change the stamped SHA. T2 poison-tested: removed key reverts all three columns to NULL. H2 hysteresis ruled architecturally acceptable: committed DB is a self-consistent fixpoint (0 changes on re-run), resolution is order-independent, failure modes bounded and loud; residual observation (committed DB mildly load-bearing for 11 belt-tenant tiebreaks) disclosed and traced to the T-1115 content gap — not a blocker.
- **Miri: APPROVE.** licensed_clinical_services style-consistent and correctly distinct from longevity_monopoly on the market-structure axis; placement stanza well-formed; boundary scan (sato-medical, salud-alliance, calluna-wellness, prometheus-labs, spitsbergen-retreat) confirms no other corp moves — the line is Assembly medical licensure of the clinical practice itself.
Merging to main and closing.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Implements D-242 end-to-end: corp HQs leave the city pool, and per-settlement population + settlement_class are baked at import. Closes T-1074 + T-1075; unblocks T-1076 (road-graph hub refinement).
T-1074 — corp-HQ settlement model
populate_atlas_city_names_corps) — all 30 duplicate co-named city groups (10x Groombridge on GJ380c, etc.) eliminated; 0 duplicate (body_id, name) groups post-regen.corporations.corp_specializationkeyed on the D-237 vocabulary, extended 27 -> 30 (trade_distribution, hospitality_hub, professional_services); authored per corp as wiki frontmatter across 155 pages.wiki/economics/corp_hq_placement.toml: all 30 values -> {CityTenant, Standalone} + standalone_economic_role.headquarters_city_idFK (58/60 linked). Standalone: 94 settlements emitted as ordinaryatlas_city_namesrows — zero Rust production changes at theread_body_settlements->match_citiesseam; 2 new regression tests lock the invariant.headquarters_bodybackfilled via the lifted most-populated-body heuristic + body-type tiebreak fix (154/155; the 1 gap is a pre-existing broken Sova ref — T-1054).tooling/populate-corporations.shhand-seed script.T-1075 — population/class bake
import_economicsderives per-city population frombodies.populationvia a documented integer Zipf rank-size curve on every regen — sums exactly, 0 discrepancies across 276 bodies.settlement_classdefaults PopulationBudget (D-196 thresholds);wiki/economics/settlement_name_locked.tomlpins 8 hero cities NameLocked. EconomicTriggered/OrganicGrowth stay simulation-time.Governance
D-242 implementation status + derivation-at-import amendment; D-207/D-223 supersede notes; new TOMLs registered in
tooling/generator_sources.py.Verification
3x consecutive
make regen-dbdeterministic (identical counts), stamp fresh; full cargo test green; clippy --all-targets -D warnings clean; ruff + make test-tooling green; live cascade run places a Standalone HQ alongside pooled cities through the unmodified pipeline.Follow-ups
T-1115 filed: 10 wiki-pageless legacy corps + GJ 702B has zero authored city names.
Remove the reserved=1 corp-HQ city-pool cross-reference (duplicate co-named cities); corp_specialization keyed on the D-237 vocabulary extended 27->30; authored corp_hq_placement.toml {CityTenant,Standalone} map; headquarters_body backfill via lifted most-populated-body heuristic + body-type tiebreak; standalone HQs emitted as ordinary settlement rows; Zipf rank-size population spread from bodies.population at import; settlement_class defaults PopulationBudget + settlement_name_locked.toml hero pins; retire orphaned populate-corporations.sh; regen systems.db. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>Review: settlement-dataset-d242 → main (type: code + content slice)
Reviewers: Hoshe (code quality), Tyre (architecture), Miri (world consistency — wiki/vocabulary slice). All three read source from the branch worktree (HEAD
0c8a27047, verified = branch tip, not sparse). Pre-push gate (fmt/clippy/full cargo test/deny/ruff/test-tooling/stamp) passed before push and was not duplicated here. Runtime verification: no client or merge-path code touched; live cascade run documented in the PR description.Hoshe (Code Quality): REQUEST_CHANGES
Zipf population-spread math verified correct (exact-sum, non-negative, monotonic across 20,000+ randomized trials), Rust test additions genuinely load-bearing, SQL parameterization clean throughout. But the headquarters_body backfill has a live bug, and the tiebreak it feeds rests on a premise the PR's own data disproves.
corporationsis append-only across regen runs and theif hq_body: continueguard treats the heuristic's own prior output as authored data (nothing is actually authored in this column). Live-verified:0 headquarters_body backfilledon every rerun; prometheus-labs/kovalev-freight are stuck onGJ702B-beltwhile the branch's fixed heuristic returnsGJ702Bb. Lead independently confirmed against the committed DB. Fix: provenance marker distinguishing authored vs derived (so derived always re-runs), or drop the guard until an authoring path exists._BODY_TYPE_SETTLEMENT_PREFERENCEpremise ("asteroid_belt/oort_cloud are geometry, never named settlements") is contradicted by this PR's own generated data in 8 of 9 divergence cases — populate_standalone_hq_settlements freely places settlements on belts (GJ845-belt → Orkney Ceramics, GJ268-belt → Jeju Lattice, GJ222A-belt → Groot Karoo Cellars + Kalahari Leatherworks). If H1 is fixed as-is, the tiebreak would forcibly move calluna-wellness and namsan-collective off currently-working belt tenant links onto planets with zero cities. Either the type-ranking should defer to "does this body have city rows", or the standalone-HQ insertion needs the same body-type restriction. H1+H2 need one joint design call.Tyre (Architecture): REQUEST_CHANGES
Implementation cross-checked against D-242, D-237, D-223, D-207, D-211, D-196, D-010 and the asset-pipeline rule. Determinism of the pure-integer Zipf spread holds; D-242 verification counts match the committed systems.db exactly; vocabulary extension is clean 1:1 coverage; the FK-clear-ordering fix is correct; "standalone HQ = ordinary row" tradeoff is explicitly disclosed in D-242 and works on current data (checked: 94/95 recoverable via name join, zero collisions) — not flagged. Two gaps:
wiki/corporations/*.md(155 files) is not in the stamp source set, but these pages now author corp_specialization → drives hq_placement, headquarters_body, and standalone settlement-row creation. An edit there withoutmake regen-dbslips past check-systems-db-stamp and the pre-push hook, contradicting the asset-pipeline freshness guarantee. Pre-existing gap, but this PR makes it load-bearing. Fix: glob CORPORATIONS_DIR into IMPORT_ECONOMICS_SOURCES.Miri (World Consistency): REQUEST_CHANGES
Sampled 36/155 corp pages (all five flagged judgment calls + every specialization bucket), full re-read of the vocabulary/placement/hero-pin TOMLs, cross-checked against D-237 examples and system wiki prose. Categorization accurate in every sampled case but one; the 3 new vocabulary values, all 30 placement mappings, and all 8 NameLocked pins check out.
licensed_clinical_services(anchor medical_services, NonPhysical → CityTenant, Specialist — non-monopoly counterpart to longevity_monopoly) and re-tag somatic-futures. Placement (CityTenant at Kallast) is correct either way.Verdict: CHANGES REQUESTED
6 findings (H1-H3, T1-T2, M1). H1+H2 are one joint design decision; T1/T2/M1 are independent, well-scoped fixes. H3 is a documentation correction downstream of H1/H2.
Process note: a reviewer's live-import verification dirtied the worktree systems.db; the lead restored it to the committed state before this comment — the branch tree is clean for the fix round.
Review response — all 6 findings fixed (commits
e63caeb62,9bb533a8b)No pushbacks; every finding was accepted and addressed. Lead independently re-verified the headline claims against the regenerated DB before this comment.
headquarters_body:frontmatter override is implemented now (hard-validated: body must exist and sit in the corp's HQ system) — authored data lives in source files, never in DB state. Verified: 4 consecutive regens each print "154 headquarters_body resolved (recomputed every run)" with full-snapshot diffs A=B=C=D at 0 differences; a poisoned-DB test (garbage in all three columns) fully re-derives a wiki corp and reverts a legacy corp to NULL.Gate re-run on push: fmt/clippy/full cargo test/deny/ruff/test-tooling/stamp all green. Reviewers have been asked to verify their own findings for the re-review verdict.
Re-review verdict: APPROVED
All three reviewers re-verified their own findings against branch tip
9bb533a8b— each independently confirmed the fixes in code and against the committed DB, not just from the fix-round claims:Merging to main and closing.
Pull request closed