Files
settled-reach/tooling/economy-db/economy_import/paths.py
T
jpmschweitzerandClaude Fable 5 4f73624eff refactor(db): split import_economics.py; single generator-source registry (T-1067)
import_economics.py 2,620 → 309 lines — a thin orchestrator keeping the
exact CLI, single-transaction/rollback contract, and exit codes. The 16
import steps, MIGRATION_SQL, brands shell-out, validators, and stamp
write now live in tooling/economy-db/economy_import/ (db, migration,
economy, corporations, brands, bodies, atlas, specialization, traits,
validators, stamp, paths, errors). Full type hints throughout.

tooling/generator_sources.py replaces the triplicated source registry
(importer / stamp checker / pr-process watch list — the skill now derives
its list via --list). The registry stamps itself, and economy_import/
modules are globbed fail-closed, so a future module is stamped the moment
it exists — closing the silently-weakened-stamp failure mode.

Rider: connector config helpers centralized in tooling/db/common.py.

Byte-identical behavior proven: full-import table dump diff EMPTY over
107,843 lines / 37 tables (volatile timestamp fields excluded); dry-run
output parity; generated_brands.toml sha unchanged. make test-tooling
PASS; ruff clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 20:13:28 +02:00

51 lines
1.7 KiB
Python

"""Source-file path constants for the economy_import modules.
Single façade: modules import their input paths from here. Paths that are
also part of the import_economics meta-stamp source set are defined once in
tooling/generator_sources.py and re-exported, so the stamp registry and the
importer can never disagree about where a stamped source lives.
"""
from pathlib import Path
from generator_sources import (
ARCHITECTURE_TRAIT_BIAS_TOML,
ARCHITECTURE_TRAIT_CATALOG_TOML,
GENERATE_BRANDS_WRAPPER,
REPO_ROOT,
SPECIALIZATION_VOCAB_TOML,
SYSTEM_SPECIALIZATION_TOML,
)
__all__ = [
"ARCHITECTURE_TRAIT_BIAS_TOML",
"ARCHITECTURE_TRAIT_CATALOG_TOML",
"BRANDS_TOML",
"CHAINS_TOML",
"COMMODITIES_TOML",
"CORPORATIONS_DIR",
"CURRENCY_ZONES_TOML",
"DB_PATH",
"GENERATED_BRANDS_TOML",
"GENERATE_BRANDS_WRAPPER",
"REPO_ROOT",
"SCHEMA_SQL",
"SPECIALIZATION_VOCAB_TOML",
"STAR_MAP",
"SYSTEM_SPECIALIZATION_TOML",
"WIKI_STAR_SYSTEMS",
]
DB_PATH: Path = REPO_ROOT / "server" / "data" / "systems.db"
STAR_MAP: Path = REPO_ROOT / "docs" / "design" / "star-map.json"
COMMODITIES_TOML: Path = REPO_ROOT / "wiki" / "economics" / "commodities.toml"
CHAINS_TOML: Path = REPO_ROOT / "wiki" / "economics" / "production_chains.toml"
CURRENCY_ZONES_TOML: Path = REPO_ROOT / "wiki" / "economics" / "currency_zones.toml"
SCHEMA_SQL: Path = REPO_ROOT / "server" / "data" / "systems-schema.sql"
CORPORATIONS_DIR: Path = REPO_ROOT / "wiki" / "corporations"
WIKI_STAR_SYSTEMS: Path = REPO_ROOT / "wiki" / "star-systems"
BRANDS_TOML: Path = REPO_ROOT / "wiki" / "economics" / "corporations" / "brands.toml"
GENERATED_BRANDS_TOML: Path = (
REPO_ROOT / "wiki" / "economics" / "corporations" / "generated_brands.toml"
)