Files
settled-reach/tooling/domains/ledger/economy_import/paths.py
T
jpmschweitzerandClaude Opus 5.5 23538d640f refactor(tooling): T-1289 — economy-db becomes reach ledger
The sole generator of systems.db moves to tooling/domains/ledger/ and is
now `reach ledger import`. economy_import/ keeps its name (Rust comments in
server/src cite it); the entrypoint becomes service.py; schema_version.py
moves with the importer, which is where the version is defined.

The stamp survived the move, which is the thing that had to hold:

- generated_brands.toml is byte-identical (sha256 e748531…) before and after
- `reach check systems-db-stamp` reported STALE after the move (the registry
  saw it) and OK after the regen
- the dry-run carries every count and warning of the baseline transcript,
  and exit 2 — imported and stamped, coverage gate unmet — still reaches the
  caller through @command

`make regen-db` survives as a one-line delegate, per D-263's muscle-memory
clause: about fifty files name it, including the headers of generated wiki
TOMLs and the remedies the push gate prints. `make economy-db` is retired;
it ran `reach generate brands` before the import, which the import already
does as its first step.

economy_import.errors is reconciled as DOMAINS.md asked. ImportAborted stays
as internal rollback control flow and never reaches a caller; the service
converts it to a ReachError carrying the remedy.

regenerate_brands caught cargo_binary's ReachError, printed it and raised
ImportAborted, dropping the remedy. It runs before the import transaction
opens, so there is nothing to roll back — it now propagates.

Both sys.path bootstraps are gone; they existed only because the directory
was hyphenated. The step labels ran [1/10]…[10/13]…[17/19]; one 24-step
counter now drives the event phase and progress.

Stale pointers fixed on the way: MIGRATION_SQL has lived in
economy_import/migration.py since T-1067, but the asset-pipeline rule,
DEVOPS and the schema comments still sent readers to import_economics.py;
the rule and DEVOPS also still named the check scripts T-1281 retired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 16:18:59 +02:00

62 lines
2.2 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 tooling.generator_sources import (
ARCHITECTURE_TRAIT_BIAS_TOML,
ARCHITECTURE_TRAIT_CATALOG_TOML,
ARCHITECTURE_ZONE_BIAS_TOML,
COLOR_REGISTER_BANDS_TOML,
CORP_HQ_PLACEMENT_TOML,
CORPORATIONS_DIR,
OBJECT_TAG_VOCABULARY_TOML,
REPO_ROOT,
SETTLEMENT_NAME_LOCKED_TOML,
SPECIALIZATION_VOCAB_TOML,
SYSTEM_SPECIALIZATION_TOML,
)
__all__ = [
"ARCHITECTURE_TRAIT_BIAS_TOML",
"ARCHITECTURE_TRAIT_CATALOG_TOML",
"ARCHITECTURE_ZONE_BIAS_TOML",
"BRANDS_TOML",
"CHAINS_TOML",
"COLOR_REGISTER_BANDS_TOML",
"COMMODITIES_TOML",
"CORPORATIONS_DIR",
"CORP_HQ_PLACEMENT_TOML",
"CURRENCY_ZONES_TOML",
"DB_PATH",
"GENERATED_BRANDS_TOML",
"OBJECT_TAG_VOCABULARY_TOML",
"REPO_ROOT",
"SCHEMA_SQL",
"SETTLEMENT_NAME_LOCKED_TOML",
"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 moved to generator_sources.py (T1, PR #177): the corp pages
# are now part of the stamped source set, and stamped paths are defined once
# in the registry — re-exported via the import block above.
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"
)