feat(db): import_economics owns atlas index — names pool, empty geometry (D-223 #951)

Rework the regen-db atlas path for the names-only marker pool:

- populate_atlas_city_names now reads the names.cities pool instead of
  the retired geometry-bearing cities[] records; population/kind are
  deferred to placement (#955). Adds a deterministic clear-then-insert
  (no UNIQUE on (body_id, name)) that fixes a latent duplicate-
  accumulation bug — atlas_city_names dropped from an inflated 3276 to a
  clean 329 pooled names + 134 corp-HQ rows.
- ensure_atlas_index_schema applies the canonical ATLAS INDEX block from
  systems-schema.sql and empties the 8 geometry tables every regen; the
  Phase 4 server cascade fills them (they start empty — the revealed gap).
- Sol (system 'GJ 0') is permanently exempt from the normal generators:
  skipped in both the name-pool importer and the corp-HQ cross-ref.
- MIGRATION_SQL drops the retired generate_atlas meta stamp row so the
  fail-closed stamp checker accepts older committed DBs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 23:28:53 +02:00
co-authored by Claude Opus 4.7
parent 642be3ac41
commit b0bfbfc7dd
2 changed files with 116 additions and 29 deletions
+6 -4
View File
@@ -183,7 +183,7 @@ CREATE TABLE IF NOT EXISTS bodies (
-- Rendering
-- terrain_reference: repo-root-relative path to the body's heightmap PNG.
-- Convention (enforced by populate_terrain_reference.py and assumed by
-- generate_atlas.py and the Godot client's atlas scene loader):
-- the atlas importers and the Godot client's atlas scene loader):
-- wiki/star-systems/<system_slug>/bodies/<body_id>/heightmap.png
-- where <system_slug> = system_id with spaces replaced by hyphens
-- (e.g. "GJ 244A" → "GJ-244A"). NULL means no heightmap has been
@@ -359,9 +359,11 @@ CREATE TABLE IF NOT EXISTS corp_lifecycle_events (
-- these tables exist so the atlas implant app and development queries don't
-- have to scan hundreds of JSON files. Polyline geometry stays in the files —
-- the DB only stores scalar/filterable fields + `point_count` as a rough length
-- proxy. Populated and refreshed by tooling/planet-gen/generate_atlas.py, which
-- proxy. The geometry tables are populated by the server-side generation
-- cascade (Phase 4, D-223) and start empty; tooling/economy-db/import_economics.py
-- extracts this entire block (between BEGIN/END ATLAS INDEX markers) from this
-- file at runtime so the DDL lives in exactly one place.
-- file at runtime and empties the geometry tables on regen, so the DDL lives in
-- exactly one place.
-- Per-body grid dimensions (one row per body that has a markers.json).
-- Lets any query interpret the pixel coordinates below without touching disk.
@@ -566,7 +568,7 @@ CREATE INDEX IF NOT EXISTS idx_gate_links_to ON gate_links(to_system_id);
-- .config/hooks/pre-push — rejects pushes with stale DB (#857)
-- /pr-push skill — triggers make regen-db if stale (#858)
CREATE TABLE IF NOT EXISTS meta (
generator_name TEXT PRIMARY KEY, -- 'import_economics' | 'generate_atlas'
generator_name TEXT PRIMARY KEY, -- 'import_economics' (generate_atlas retired #951)
schema_version TEXT NOT NULL, -- monotonic semver string (e.g. "1.0.0") — see #888
schema_sha TEXT, -- SHA-1 hex of systems-schema.sql content (tamper detection)
generator_sha TEXT NOT NULL, -- SHA-1 hex of generator source file(s) content