# Test Results — 2026-07-21

Executed per `TEST-PLAN.md` against a freshly reseeded dev DB. **Final: 97/97 pass** (after fixes).

## Issues found & fixed

### Frictionless billing (the core requirement)
1. **Finalize required "Ready" status** — walk-in billing forced draft→in_progress→ready hops.
   🔧 `orders.service.ts`: finalize now allowed from any active status (only `paid`/`closed` block). UI button shown whenever the order has items and isn't paid/closed.
2. **After billing, the receipt never opened** — `OrderDetailPage` navigated to `data.receiptId` but the API returns `id`. 🔧 Fixed.
3. **Approval never gates billing** — verified: an order with `approvalStatus=pending` finalizes fine (test `APPROVAL-pending-still-bills`). Approval is purely opt-in.
4. **Receipt page recomputed totals from live items** instead of the immutable snapshot. 🔧 Uses `receipt.subtotal/discount/tax/total` now; print bill shows real shop address/phone; `.print-only` no longer leaks into screen view.

### Broken ops pages (wrong endpoints/params)
5. **Settings page called `/api/shop`** (doesn't exist) — page was fully broken. 🔧 → `/api/settings`.
6. **Reports page called `/reports/orders/status` and `/reports/top-customers`** (don't exist) — two of three report cards broken; also expected wrong response shapes (`breakdown` array vs object, `lifetimeValue` vs `ltv`), and "All-Time Revenue" mislabeled a 30-day figure. 🔧 All fixed.
7. **Refund button used POST** — API is PATCH; refunds from the UI always failed. 🔧 Fixed.
8. **Search sent `?q=` but the API reads `?search=`** in CustomersPage, VehiclesPage, ReceiptsPage, PartPicker, NewOrderPage — all list searches silently returned unfiltered results. 🔧 Fixed (OrdersPage had been fixed earlier).
9. **New-order vehicle picker queried `/vehicles?customerId=`** which the API ignored — it listed *every* vehicle in the shop regardless of the chosen customer. 🔧 Added `customerId` filter support to the vehicles route.
10. **Dashboard fired admin-only queries for all roles** (inventory 403s for staff/tech, revenue 403s for staff/tech). 🔧 Queries now gated by role.

### Test-run artifacts (not bugs)
- D6b initially hit the paid-order guard before the item-scoping check — correct precedence; re-verified scoping with two draft orders (404 as expected).

## Verified end-to-end (walk-in flow, zero friction)
create customer → add vehicle → new order (vehicle picker correctly scoped) → add part+labor →
**finalize directly from draft** (no approval, no status hops) → receipt with money snapshot
(70 / 6.13 / 76.13) → stock auto-decremented → paid order locked → printable bill with shop info →
refund works once, 409 on repeat.

Full suite: auth (13), customers (10), vehicles (6), orders/items (13), billing (12), inventory (8),
reports (6), users/settings (7), public API (14), admin appointments (12), portal (6), UI wiring (6).
