# Sprint 37: Sweep — CI Tasks **Goal:** Spring-clean accumulated debt: asset pipeline discipline, PROTOCOL_VERSION removal, D-167/D-032 dead-code purge, New Game regression fix, copy wiki residue, bookmark save-state, and generator quality patches. **Branch:** `sprint-37/ci` **Agents:** Gestalt (systems), Hoshe (QA) ## New Tickets | # | Title | Priority | Blocked by | |---|-------|----------|------------| | #854 | Generator-driven asset pipeline — regeneration discipline and versioning (epic) | high | — | | #855 | systems.db regeneration with versioning awareness | high | #854 | | #856 | Stamp systems.db with generator metadata (meta table) | high | #855 | | #857 | Pre-push git hook for systems.db consistency | high | #856 | | #858 | Extend /pr-push with rebase + regen + stage | high | #856 | | #859 | Document the source-canonical rule (.claude/rules/asset-pipeline.md + DEVOPS) | medium | #856 | | #723 | Add decision-to-ticket coverage report | medium | — | Use `tooling/db/ticket show ` for full details. ## Key Decisions No domain decisions gate this sprint's work. The asset pipeline epic creates new process conventions documented in `.claude/rules/asset-pipeline.md` (deliverable of #859). ## Notes **#854 — Generator-driven asset pipeline (epic wrapper)** - This epic establishes the mental model: `server/data/systems.db` is a read-only canonical snapshot, deterministically produced from source files (markers.json, *.toml, generator code). Direct DB edits are forbidden except when mirrored back to source. - Children: #855 → #856 → #857 and #858 (parallel after #856) → #859 (docs, after #856). - Driver: Sprint 36 had a binary conflict risk between two branches both committing systems.db changes. This epic prevents the class of problem going forward and establishes the versioning primitives the future savegame system will need. - #854 itself has no code deliverable — it is the parent epic for tracking purposes. Work happens in children. **#855 — systems.db regeneration with versioning awareness** - Every generator (`import_economics.py`, `generate_atlas.py`, `generate_brands`) must be updated to accept a `--stamp` flag (or equivalent) that writes metadata to the DB after generation. - The regeneration step should be idempotent: running it twice on the same sources produces identical output. - Unblocks #856, #857, #858, #859. **#856 — Stamp systems.db with generator metadata (meta table)** - Add a `meta` table to `db/schema.sql`: columns `schema_version`, `generator_sha`, `generated_at`. - Each generator writes its own row on completion. - The stamp is what lets a future savegame DB record which canonical snapshot it derives from (migration lineage). - Blocked by #855 (generators must be updated before stamping is meaningful). **#857 — Pre-push git hook for systems.db consistency** - Hook fires on `git push` and verifies: if `systems.db` is staged, its `meta.generator_sha` matches the current HEAD SHA of the generator source files. - If not, rejects the push with a message: "systems.db is stale — run `make regen-db` before pushing." - Install via `make install-hooks`. Document in #859. **#858 — Extend /pr-push with rebase + regen + stage** - The `/pr-push` skill runs before PR creation. Extend it to: (1) rebase on main, (2) run `make regen-db` if any generator source was modified in the branch, (3) stage the updated `systems.db`. - This prevents the class of binary conflict where two branches both modify generator sources and commit separate DB snapshots. - Parallel to #857 after #856 is done. **#859 — Document the source-canonical rule** - Deliverables: 1. `.claude/rules/asset-pipeline.md` — canonical rules file covering: what systems.db is, how to make a DB change, why direct edits are forbidden, the meta table stamp, the pre-push hook, why /pr-push regenerates. 2. `CLAUDE.md` hook — one-line reference under a new `### Asset pipeline` subsection pointing at the rules file. 3. `docs/DEVOPS.md` — short section on the pipeline: meta table, `make install-hooks`, regenerate-before-push workflow. - Blocked by #856 (meta table must exist before documenting it). **#723 — Decision-to-ticket coverage report** - No schema change needed — `tickets.decision_ref` already exists. - Deliverables: 1. `make decisions-coverage` — shows each D-record with its implementing ticket(s). 2. `make decisions-orphan` — shows D-records with no implementing tickets (verify existing target works). 3. `tooling/db/decision show D-159` — includes linked ticket IDs in output. - The reverse link (decision → tickets) is a `SELECT` query, not a new column. Avoids fragile two-way sync. - Standalone, parallel to the asset pipeline chain. ## Dependency Chain ``` #854 (epic) → no code #855 (regen awareness) → #856 (meta table) → #857 (pre-push hook) → #858 (pr-push extension) → #859 (documentation) #723 → standalone, parallel to all above ``` ## PR Workflow ```bash tea pr create --repo jpmschweitzer/settled-reach --login schweitz \ --title "ci: sprint 37 — asset pipeline discipline, decision coverage report" \ --description "body" \ --base main --head sprint-37/ci ```