Description
Exporting a route from the Results page and then uploading that exact file to the Driver Assist page fails with an "Invalid save file format" error. The two sides use incompatible JSON shapes:
- Export (downloadRouteJson.ts) writes a
Route object — { vehicleId, driverName, stops: [{ id, address, lat, lng, sequence, capacityUsed, timeWindow, note, ... }], ... } (see results/types.ts).
- Import (importSession.ts) only accepts a session-save envelope
{ version: 1, savedAt, data: { deliveries, vehicles } } or a raw optimize request { deliveries, vehicles }.
Because the exported Route shape matches neither schema, validation throws and the upload is rejected on both the Driver Assist page and the upload-route handoff path.
Goal
A user can export a route from the Results page, upload that exact file on the Driver Assist page, and have the Driver Assist screen populate with that route's stops.
Reproduction
Steps
- Run an optimization and open the Results page.
- Export a route to JSON (per-route export from the Results page).
- Go to the Driver Assist page (or the upload-route page) and upload the file from step 2.
Expected: Driver Assist loads the route and lists its stops (address, recipient, phone, package count, notes) as pending deliveries.
Actual: Upload is rejected with an error (e.g. "Invalid save file format." / "Please upload a valid JSON file.") and no route loads.
Environment: app/ui (Next.js web UI), branch main. Reproducible regardless of OS/browser.
Scope
In scope
- Make the Results-page exported
Route JSON a valid input for the Driver Assist importer, so the export → upload round-trip works.
- Map the exported
Route/Stop fields onto what Driver Assist renders: stop ordering (sequence), address, addresseeName → customer name, phoneNumber, capacityUsed → package count, note, and lat/lng for navigation.
- Preserve existing accepted formats (session-save envelope and raw optimize request) so current upload paths keep working.
- Surface a clear error only when the file genuinely isn't a recognized route/session file.
Out of scope
- Changing the Results-page export format or filename convention (only adjust import to accept it, unless aligning the export is the cleaner fix — see open question).
- Multi-route files / bulk upload of multiple routes in one file.
- Mobile app import (
app/mobile).
- Redesigning the Driver Assist UI or the
DriverRoute data model.
Acceptance Criteria
##Assignee
@hir-al-14
Description
Exporting a route from the Results page and then uploading that exact file to the Driver Assist page fails with an "Invalid save file format" error. The two sides use incompatible JSON shapes:
Routeobject —{ vehicleId, driverName, stops: [{ id, address, lat, lng, sequence, capacityUsed, timeWindow, note, ... }], ... }(see results/types.ts).{ version: 1, savedAt, data: { deliveries, vehicles } }or a raw optimize request{ deliveries, vehicles }.Because the exported
Routeshape matches neither schema, validation throws and the upload is rejected on both the Driver Assist page and the upload-route handoff path.Goal
A user can export a route from the Results page, upload that exact file on the Driver Assist page, and have the Driver Assist screen populate with that route's stops.
Reproduction
Steps
Expected: Driver Assist loads the route and lists its stops (address, recipient, phone, package count, notes) as pending deliveries.
Actual: Upload is rejected with an error (e.g. "Invalid save file format." / "Please upload a valid JSON file.") and no route loads.
Environment:
app/ui(Next.js web UI), branchmain. Reproducible regardless of OS/browser.Scope
In scope
RouteJSON a valid input for the Driver Assist importer, so the export → upload round-trip works.Route/Stopfields onto what Driver Assist renders: stop ordering (sequence),address,addresseeName→ customer name,phoneNumber,capacityUsed→ package count,note, andlat/lngfor navigation.Out of scope
app/mobile).DriverRoutedata model.Acceptance Criteria
lat/lng.Routefile (round-trip), added to the importSession test suite.##Assignee
@hir-al-14