v0.46.0 — queue: consume-on-dispatch, chain backstops, sell guard + tests (#88) #93

Merged
kamilkrzywda merged 2 commits from feat/queue-tests-fixes into master 2026-09-22 01:22:26 +02:00
Owner

Closes #88

Fixes (root causes found while adding the tests)

  • Phantom zero-hop / queue bypass — flyPlane now consumes queue[0] when dispatching to the first queued destination, so landing no longer triggers a zero-distance self-leg from auto-chain. Skip-ahead (/fly to a non-first queued dest) stays allowed as an explicit override; FIFO order is preserved (documented in code).
  • Auto-chain full-tank backstop — engine chain path now grounds the plane ('available', queue intact) when the next leg's required fuel exceeds tank capacity, mirroring flyPlane's 409.
  • Defensive self-leg drop — chain skips a queue[0] === locationIcao entry without flying (legacy rows only).
  • sellPlane guard — 409 "cancel queued legs first" when the plane has queued legs (previously discarded silently).

Tests

  • Unit +5 (368 → 373): consume-on-dispatch, skip-ahead no-mutation, sell 409, full-tank backstop, defensive self-leg drop.
  • E2E +4 (54 → 58): new e2e/queue.spec.ts — 3-leg FIFO ordering across two landings; refuel-between-legs at exact rep-discounted cost (drained tank via set-fuel); cancel-mid-chain while flying. Extended state.spec.ts — staged queue survives docker compose restart flight. Reworked two-planes.spec.ts — 240 s phantom-absorbing poll replaced by explicit no-self-leg assertions.
  • New test hook /api/test/set-cash (absolute wallet set; add-cash is additive-only). Test hooks are out-of-spec by convention, so OpenAPI unchanged (lib/openapi.test.ts pins the path list).

Verification

Local: tsc --noEmit clean · vitest run 373/373 · playwright test --list 58 tests in 15 files. Full e2e runs in CI (dind stack) per AGENTS.md.

Closes #88 ## Fixes (root causes found while adding the tests) - **Phantom zero-hop / queue bypass** — `flyPlane` now consumes `queue[0]` when dispatching to the first queued destination, so landing no longer triggers a zero-distance self-leg from auto-chain. Skip-ahead (`/fly` to a non-first queued dest) stays allowed as an explicit override; FIFO order is preserved (documented in code). - **Auto-chain full-tank backstop** — engine chain path now grounds the plane ('available', queue intact) when the next leg's required fuel exceeds tank capacity, mirroring `flyPlane`'s 409. - **Defensive self-leg drop** — chain skips a `queue[0] === locationIcao` entry without flying (legacy rows only). - **sellPlane guard** — 409 "cancel queued legs first" when the plane has queued legs (previously discarded silently). ## Tests - Unit +5 (368 → 373): consume-on-dispatch, skip-ahead no-mutation, sell 409, full-tank backstop, defensive self-leg drop. - E2E +4 (54 → 58): new `e2e/queue.spec.ts` — 3-leg FIFO ordering across two landings; refuel-between-legs at exact rep-discounted cost (drained tank via set-fuel); cancel-mid-chain while flying. Extended `state.spec.ts` — staged queue survives `docker compose restart flight`. Reworked `two-planes.spec.ts` — 240 s phantom-absorbing poll replaced by explicit no-self-leg assertions. - New test hook `/api/test/set-cash` (absolute wallet set; add-cash is additive-only). Test hooks are out-of-spec by convention, so OpenAPI unchanged (`lib/openapi.test.ts` pins the path list). ## Verification Local: `tsc --noEmit` clean · `vitest run` 373/373 · `playwright test --list` 58 tests in 15 files. Full e2e runs in CI (dind stack) per AGENTS.md.
kamilkrzywda added 1 commit 2026-09-22 00:37:06 +02:00
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-22 00:37:14 +02:00
kamilkrzywda added 1 commit 2026-09-22 01:13:22 +02:00
fix(e2e): bound post-departure fuel burn in refuel-cost spec (#88)
CI / build + unit + e2e (pull_request) Successful in 9m5s
b76acbacac
kamilkrzywda merged commit 3dbac9c549 into master 2026-09-22 01:22:26 +02:00
Sign in to join this conversation.