# Delivery quote freshness and saved route

Status: quote, route persistence and cancellation verified in local Chromium on21September2026. Four backend regression tests and full API build passed. Zone creation, immediate activation and persistence also passed.

## Reproduced locally

The recovery owner created zone `tutorial_lekki_phase1`, reopened its6.4474/3.47/4-mile boundary, activated it and obtained a valid15-dollar customer/11.25-dollar driver quote. The route was3.03miles,11.12minutes, Google. Changing the dropoff to Lagos airport returned `valid:false` while the earlier prices remained visible and Create Job remained enabled.

After restoring and re-quoting the local dropoff, job `UNZEC0D18U` (`6ab1987a4cf301c8783a32b7`) saved with0distance/0duration, no zone and no geocoded stop coordinates. The new-job drawer also discarded the record ID when unwrapping the create response, making Cancel silently do nothing. Reopening the saved row restored the ID; the job is now cancelled with creation and cancellation events. No driver was assigned or payment taken.

## Changes

- `websitemint/packages/ui/src/components/logistics/job-create-wizard.tsx`: track system-quote validity, clear derived prices after route changes and failures, reject late responses for old routes, block creation until a fresh valid quote, retain returned geocodes and preserve created record identity. Typed address edits discard old coordinates.
- `websitemint/packages/ui/src/components/logistics/logistics-service.ts`: typed `requireSystemQuote` create option.
- `appengine/src/logistics/delivery.service.ts` and controller: system-quoted creation revalidates through the server quote path before writing, retains server route metrics and source, geocodes, contacts/items/instructions and customer notes. Explicit manual pricing remains supported.
- `appengine/src/logistics/delivery-create-quote.spec.ts`: four passing tests cover route persistence, out-of-area refusal, provider failure and manual pricing compatibility.

## Evidence

- [Saved active boundary](assets/delivery-zone-boundary-readback.png)
- [Previous stale quote defect](assets/delivery-outside-area-stale.png)
- [Fresh successful quote with both totals](assets/delivery-requote-success.png)
- [Actual quote responses](assets/delivery-quote-sequence.json)
- [Previous missing route](assets/delivery-route-missing-before.png)
- [Original test job cancelled](assets/delivery-before-fix-cancelled.png)

## Post-fix browser verification

Route edits immediately disabled Create Job. Airport re-quote returned validfalse, cleared prices to0 in this no-adjustment fixture and kept Create Job disabled. Restoring the local address and re-quoting restored15/11.25 and enabled creation. Created `RVK9LPZD77` (`6ab19a166bad58204cb4030c`) once; reopened and verified both addresses, item, notes, coordinates, zone and tracking3.03mi/11.12min/google. Creation timeline had one event. Cancelled through the UI and reopened the same job; timeline had creation and cancellation. No driver, payment, payout or customer notification was involved.

- [Airport rejection after repair](assets/delivery-outside-area-fixed.png)
- [Fresh valid quote after repair](assets/delivery-requote-fixed.png)
- [Saved route after reopening](assets/delivery-route-fixed-readback.png)
- [Creation history](assets/delivery-created-timeline-fixed.png)
- [Same job cancelled](assets/delivery-cancelled-timeline-fixed.png)


## Zone form verification

Fixed `zone-form.tsx`: persist an explicit Inactive default, use the existing schema helper’s enum fallbacks for Type/Status, retain the saved ID, use it for immediate activation/reload and refresh the list after a status action. Original zone remains active. Created separate `tutorial_lekki_activation_check` with Custom type, same four-mile boundary and Africa/Lagos; saved Inactive, activated without reopening, reopened and verified Active/Custom, then deactivated the extra test zone. A first failed save during a confirmed local API exit was not counted as success; read-only list verification showed no duplicate before retry.

- [Saved inactive zone](assets/delivery-zone-inactive-fixed.png)
- [Activation with boundary](assets/delivery-zone-activation-fixed.png)
- [Reopened type and status](assets/delivery-zone-type-fixed.png)
- [Actual response evidence](assets/delivery-local-verification.json)

Both training jobs remain cancelled; the main zone remains active and the extra activation-test zone remains inactive. Provider-map setup and physical driver operations were not represented as completed.
