Make the SHIP SYSTEMS tab functional: real ship systems that can be expanded, upgraded or newly built using resources/parts found during exploration.
Scope
DB:ship_systems table (id, type, level, status) + inventory of resources/parts from findings; starting ship seeded on new game.
Actions:POST /api/ship/expand, /api/ship/upgrade, /api/ship/build — cost validation against inventory, turn cost, event writes. Some options gated by researched tech (see SKILL TREE issue).
API:GET /api/ship (systems + levels + inventory), the three action endpoints. Update OpenAPI spec.
Frontend: cards show real level/status; EXPAND/UPGRADE/BUILD NEW buttons call the API and are disabled when unaffordable/gated. Left column SHIP SYSTEMS + VESSEL METRICS panels mirror real state (progress bars = real values). No placeholder data for this tab or the left column.
e2e: with resources in hand, an upgrade works and is reflected on the card + left column; persists across restart.
Local verify green: tsc / vitest / playwright --list (+ build DOM check).
Dependencies
After LOCAL SYSTEM issue (needs inventory from exploration). Tech gating lands with SKILL TREE.
## Goal
Make the SHIP SYSTEMS tab functional: real ship systems that can be expanded, upgraded or newly built using resources/parts found during exploration.
## Scope
- **DB:** `ship_systems` table (id, type, level, status) + inventory of resources/parts from findings; starting ship seeded on new game.
- **Actions:** `POST /api/ship/expand`, `/api/ship/upgrade`, `/api/ship/build` — cost validation against inventory, turn cost, event writes. Some options gated by researched tech (see SKILL TREE issue).
- **API:** `GET /api/ship` (systems + levels + inventory), the three action endpoints. Update OpenAPI spec.
- **Frontend:** cards show real level/status; EXPAND/UPGRADE/BUILD NEW buttons call the API and are disabled when unaffordable/gated. Left column SHIP SYSTEMS + VESSEL METRICS panels mirror real state (progress bars = real values). No placeholder data for this tab or the left column.
## Acceptance criteria
- Unit tests: cost validation, inventory deduction, level caps, turn cost, event writes.
- e2e: with resources in hand, an upgrade works and is reflected on the card + left column; persists across restart.
- Local verify green: tsc / vitest / playwright --list (+ build DOM check).
## Dependencies
After LOCAL SYSTEM issue (needs inventory from exploration). Tech gating lands with SKILL TREE.
Shipped in v0.6.0 (PR #15, merge bd16d3f), deployed to https://space-wanderer.dev.kkhost.pl — verified /api/version → 0.6.0 and the live save backfilled its starting ship without a DB wipe.
What changed:
Backfill plumbing (root-cause fix for the recurring "live save missing new data" problem):schema_version on saves (NULL = v1) + idempotent ALTER TABLE guard; ordered backfill steps in ensureSave — v2 bodies, v3 starting crew, v4 starting ship. All deterministic from the save seed, so a backfilled save is identical to a fresh one. Future features just bump the constant and append a step — no more prod DB wipes.
Ship systems:ship_systems table (type/level/capacity, UNIQUE per type; built = level > 0). Starting ship: HULL, REACTOR, LIFE SUPPORT, NAV COMPUTER, COMMS ARRAY at LV1/CAP2; WEAPONS unbuilt.
Actions (each +1 turn + event): UPGRADE level×resource → MAX_LEVEL 5 · EXPAND capacity×resource → MAX_CAPACITY 10 · BUILD flat 3 parts, once per type. Costs in pure lib/game/ship-costs.ts, shared by API and UI so buttons disable exactly when the API would reject (404/409/422, no mutation on failure).
API: GET /api/ship + POST /api/ship/{upgrade,expand,build}; OpenAPI updated (10 paths).
UI: SHIP SYSTEMS tab on live data — real cards with UPGRADE/EXPAND/BUILD NEW, disabled when unaffordable or capped; left column StatusGrid + VESSEL METRICS bars now driven by real values (placeholder constants removed for both).
Tests: unit 38→50 (backfill idempotency/determinism vs fresh generation, exact oldest-first deduction, caps, build-once, no-mutation failures), e2e 11→12 (bounded scan loop → affordable action via UI button → card + left column reflect it; full ship state deep-equal across the mid-run container restart).
Shipped in **v0.6.0** (PR #15, merge `bd16d3f`), deployed to https://space-wanderer.dev.kkhost.pl — verified `/api/version` → 0.6.0 and the live save backfilled its starting ship without a DB wipe.
What changed:
- **Backfill plumbing (root-cause fix for the recurring "live save missing new data" problem):** `schema_version` on `saves` (NULL = v1) + idempotent ALTER TABLE guard; ordered backfill steps in ensureSave — v2 bodies, v3 starting crew, v4 starting ship. All deterministic from the save seed, so a backfilled save is identical to a fresh one. Future features just bump the constant and append a step — no more prod DB wipes.
- **Ship systems:** `ship_systems` table (type/level/capacity, UNIQUE per type; built = level > 0). Starting ship: HULL, REACTOR, LIFE SUPPORT, NAV COMPUTER, COMMS ARRAY at LV1/CAP2; WEAPONS unbuilt.
- **Actions** (each +1 turn + event): UPGRADE `level`×resource → MAX_LEVEL 5 · EXPAND `capacity`×resource → MAX_CAPACITY 10 · BUILD flat 3 parts, once per type. Costs in pure `lib/game/ship-costs.ts`, shared by API and UI so buttons disable exactly when the API would reject (404/409/422, no mutation on failure).
- **API:** GET /api/ship + POST /api/ship/{upgrade,expand,build}; OpenAPI updated (10 paths).
- **UI:** SHIP SYSTEMS tab on live data — real cards with UPGRADE/EXPAND/BUILD NEW, disabled when unaffordable or capped; left column StatusGrid + VESSEL METRICS bars now driven by real values (placeholder constants removed for both).
- **Tests:** unit 38→50 (backfill idempotency/determinism vs fresh generation, exact oldest-first deduction, caps, build-once, no-mutation failures), e2e 11→12 (bounded scan loop → affordable action via UI button → card + left column reflect it; full ship state deep-equal across the mid-run container restart).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Goal
Make the SHIP SYSTEMS tab functional: real ship systems that can be expanded, upgraded or newly built using resources/parts found during exploration.
Scope
ship_systemstable (id, type, level, status) + inventory of resources/parts from findings; starting ship seeded on new game.POST /api/ship/expand,/api/ship/upgrade,/api/ship/build— cost validation against inventory, turn cost, event writes. Some options gated by researched tech (see SKILL TREE issue).GET /api/ship(systems + levels + inventory), the three action endpoints. Update OpenAPI spec.Acceptance criteria
Dependencies
After LOCAL SYSTEM issue (needs inventory from exploration). Tech gating lands with SKILL TREE.
Shipped in v0.6.0 (PR #15, merge
bd16d3f), deployed to https://space-wanderer.dev.kkhost.pl — verified/api/version→ 0.6.0 and the live save backfilled its starting ship without a DB wipe.What changed:
schema_versiononsaves(NULL = v1) + idempotent ALTER TABLE guard; ordered backfill steps in ensureSave — v2 bodies, v3 starting crew, v4 starting ship. All deterministic from the save seed, so a backfilled save is identical to a fresh one. Future features just bump the constant and append a step — no more prod DB wipes.ship_systemstable (type/level/capacity, UNIQUE per type; built = level > 0). Starting ship: HULL, REACTOR, LIFE SUPPORT, NAV COMPUTER, COMMS ARRAY at LV1/CAP2; WEAPONS unbuilt.level×resource → MAX_LEVEL 5 · EXPANDcapacity×resource → MAX_CAPACITY 10 · BUILD flat 3 parts, once per type. Costs in purelib/game/ship-costs.ts, shared by API and UI so buttons disable exactly when the API would reject (404/409/422, no mutation on failure).