Maintenance: wear, broken burn +50%, repair (ISS-069, v0.39.0) #78

Merged
kamilkrzywda merged 1 commits from feat/maintenance into master 2026-09-21 14:20:33 +02:00
Owner

Fixes #69

Planes now wear out with distance and need maintenance:

  • Wear — each landed leg reduces health by WEAR_PER_KM × km (clamped at 0). Health is visible per plane in the Fleet list as an amber bar + % readout.
  • Broken — at health ≤ 0 the plane still flies but burns +50% fuel (BROKEN_BURN_MULTIPLIER, applied consistently at all five burn sites: dispatch feasibility, refuel requirement, landed fuel, auto-chain check, live in-flight gauge). A broken pill shows on the fleet row.
  • Repair — new POST /api/planes/{planeId}/repair: flat €1,500, restores health to 100 and grounds the plane as repairing for 3 sim days; a per-tick pass flips it back to service when the gate passes. in repair pill while grounded.

Schema: two new planes columns (health, nullable repair_until_sim_time) with guarded migrations; third status value 'repairing'. OpenAPI updated (14th endpoint, PlaneState fields) with all pins in lockstep. New test hook /api/test/set-health forces health / shortens the repair gate for e2e.

Unit: +16 tests (wear accumulation + clamp, broken-burn multiplier at engine level, repair cost/duration/unavailability/flip-back). E2e: new maintenance.spec.ts visible flow (42% → broken pill → ×1.5 landed fuel via real lib helpers → exact €1,500 drop → back to service); heal helpers in right-pane/two-planes/actions now restore health so accumulated wear can't strand the fragile feasibility pins.

Fixes #69 Planes now wear out with distance and need maintenance: - **Wear** — each landed leg reduces `health` by `WEAR_PER_KM × km` (clamped at 0). Health is visible per plane in the Fleet list as an amber bar + % readout. - **Broken** — at health ≤ 0 the plane still flies but burns **+50% fuel** (`BROKEN_BURN_MULTIPLIER`, applied consistently at all five burn sites: dispatch feasibility, refuel requirement, landed fuel, auto-chain check, live in-flight gauge). A `broken` pill shows on the fleet row. - **Repair** — new `POST /api/planes/{planeId}/repair`: flat €1,500, restores health to 100 and grounds the plane as `repairing` for 3 sim days; a per-tick pass flips it back to service when the gate passes. `in repair` pill while grounded. Schema: two new planes columns (`health`, nullable `repair_until_sim_time`) with guarded migrations; third status value `'repairing'`. OpenAPI updated (14th endpoint, PlaneState fields) with all pins in lockstep. New test hook `/api/test/set-health` forces health / shortens the repair gate for e2e. Unit: +16 tests (wear accumulation + clamp, broken-burn multiplier at engine level, repair cost/duration/unavailability/flip-back). E2e: new `maintenance.spec.ts` visible flow (42% → broken pill → ×1.5 landed fuel via real lib helpers → exact €1,500 drop → back to service); heal helpers in right-pane/two-planes/actions now restore health so accumulated wear can't strand the fragile feasibility pins.
kamilkrzywda added 1 commit 2026-09-21 14:10:55 +02:00
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-21 14:11:03 +02:00
kamilkrzywda merged commit b8f321dfd5 into master 2026-09-21 14:20:33 +02:00
Sign in to join this conversation.