Auto-refuel on leg start; all manual refueling UI + endpoint removed (ISS-082, v0.42.0) #86

Merged
kamilkrzywda merged 1 commits from feat/auto-refuel into master 2026-09-21 17:41:58 +02:00
Owner

Fixes #82

Planes now top up automatically when they start a leg — no more manual refueling.

Dispatch (flyPlane): before the feasibility check, the tank is topped to min(maxFuel, max(fuel, 150% of the wind/condition-adjusted requirement)); the liters are charged at the rep-discounted fuel price. Unaffordable → 409 insufficient funds, plane stays grounded with nothing mutated (a legit game state — fly again once cash allows). A leg that doesn't fit even a full tank still 409s insufficient fuel.

Auto-chain (deliverPackages): the chain no longer strands on a short tank — when the next queued leg exceeds landed fuel, an affordable top-up to the identical target happens and the plane chains; only an unaffordable top-up grounds it with the queue kept intact.

Removed: POST /api/planes/{planeId}/refuel endpoint + refuelPlane() action (v0.12.0 removal template), the left-pane "Refuel to full" section, the per-leg Refuel button and their dead state; OpenAPI 14 → 13 endpoints (RefuelRequest schema gone). New test hook POST /api/test/set-fuel replaces API refuel in e2e setups; heal helpers drop their refuel-and-retry guards.

Unit: −15 (refuel suite) +6 new (dispatch top-up exact cost, free no-op, cash-0 409 with fuel untouched, beyond-range backstop, engine chain-via-top-up + cash-0 variant). E2e: ~25 /refuel sites across 9 specs → set-fuel hook; one end-to-end dispatch auto-top-up test (exact cash delta from snapshot + real lib helpers); panes spec now asserts Refuel-UI absence.

Fixes #82 Planes now top up automatically when they start a leg — no more manual refueling. **Dispatch (`flyPlane`)**: before the feasibility check, the tank is topped to `min(maxFuel, max(fuel, 150% of the wind/condition-adjusted requirement))`; the liters are charged at the rep-discounted fuel price. Unaffordable → 409 `insufficient funds`, plane stays grounded with nothing mutated (a legit game state — fly again once cash allows). A leg that doesn't fit even a full tank still 409s `insufficient fuel`. **Auto-chain (`deliverPackages`)**: the chain no longer strands on a short tank — when the next queued leg exceeds landed fuel, an affordable top-up to the identical target happens and the plane chains; only an unaffordable top-up grounds it with the queue kept intact. **Removed**: `POST /api/planes/{planeId}/refuel` endpoint + `refuelPlane()` action (v0.12.0 removal template), the left-pane "Refuel to full" section, the per-leg Refuel button and their dead state; OpenAPI 14 → 13 endpoints (`RefuelRequest` schema gone). New test hook `POST /api/test/set-fuel` replaces API refuel in e2e setups; heal helpers drop their refuel-and-retry guards. Unit: −15 (refuel suite) +6 new (dispatch top-up exact cost, free no-op, cash-0 409 with fuel untouched, beyond-range backstop, engine chain-via-top-up + cash-0 variant). E2e: ~25 `/refuel` sites across 9 specs → set-fuel hook; one end-to-end dispatch auto-top-up test (exact cash delta from snapshot + real lib helpers); panes spec now asserts Refuel-UI absence.
kamilkrzywda added 1 commit 2026-09-21 17:24:31 +02:00
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-21 17:24:41 +02:00
kamilkrzywda merged commit 78032a2051 into master 2026-09-21 17:41:58 +02:00
Sign in to join this conversation.