chore(ci): generator-driven asset pipeline — meta stamp + hook + regen target

Adds systems.db regeneration discipline (#855) via a `meta` table (#856)
stamped by every generator, a pre-push hook that rejects stale DBs (#857),
and the top-level `make regen-db` / `make check-systems-db` targets that
drive the whole pipeline.

The stamp stores SHA-1 of generator source + schema, so the pre-push hook
can cheaply detect "you changed a generator but forgot to regen the DB"
before a binary merge conflict lands. Sprint 36 hit that class of conflict
on two branches touching systems.db simultaneously — this is the systemic
fix.

Regenerated systems.db is stamped; `make check-systems-db` passes.

Refs: #855 #856 #857

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 17:34:52 +02:00
co-authored by Claude Opus 4.6
parent f0465e40c1
commit 8371e05e52
7 changed files with 311 additions and 5 deletions
+17
View File
@@ -480,6 +480,23 @@ CREATE INDEX IF NOT EXISTS idx_corps_type ON corporations(corp_type);
CREATE INDEX IF NOT EXISTS idx_star_systems_currency ON star_systems(currency_zone);
CREATE INDEX IF NOT EXISTS idx_gate_links_from ON gate_links(from_system_id);
CREATE INDEX IF NOT EXISTS idx_gate_links_to ON gate_links(to_system_id);
-- Generator metadata stamp (#855, #856)
-- One row per generator, updated on each successful non-dry-run.
-- schema_version: SHA-1 of server/data/systems-schema.sql content at generation time
-- generator_sha: SHA-1 of the generator source file(s) content
-- generated_at: ISO-8601 UTC timestamp of the run
--
-- Used by:
-- tooling/check-systems-db-stamp — verifies freshness before push (#857)
-- .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' | 'generate_brands'
schema_version TEXT NOT NULL, -- SHA-1 hex of systems-schema.sql content
generator_sha TEXT NOT NULL, -- SHA-1 hex of generator source file(s) content
generated_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_commodities_tier ON commodities(tier);
CREATE INDEX IF NOT EXISTS idx_production_chains_output ON production_chains(output_commodity_id);
CREATE INDEX IF NOT EXISTS idx_chain_inputs_commodity ON chain_inputs(input_commodity_id);