Skip to content

Bug: Old uplod .json page shows up when the route file results in an error #198

Description

@kirillakovalenko

Description

When a driver uploads a route file on the Driver Assist upload page (/upload-route) and the file fails to import (invalid JSON, wrong shape, etc.), the failure is not surfaced on that page. The upload page only validates file extension/size and reads the file text — it then stores the raw content in sessionStorage and pushes to /driver_assist. The actual parse/transform happens later in driver_assist's useEffect (page.tsx:70-105). When that import throws, importFailed is set and the page falls through to a bare-bones built-in "Upload JSON" fallback screen (page.tsx:218-245) — the old black-and-white "tester" upload screen that predates /upload-route and should be removed.

The result: the driver lands on a deprecated, unstyled upload screen instead of seeing the error on the page they actually uploaded from.

Goal

Remove the deprecated in-page tester upload screen, and ensure invalid route uploads surface the error on the original /upload-route page.

Reproduction

Steps

  1. Go to /upload-route.
  2. Select a .json file that is valid JSON but not a valid route (or otherwise fails transformSessionToDriverRoute).
  3. Click Continue.

Expected: An error message appears on the /upload-route page (the page you uploaded from) explaining the file is invalid, and you stay on that page to retry.
Actual: You are taken to /driver_assist, which renders the old bare-bones "driver_assist / Upload JSON" tester screen with the error text, instead of the styled upload page.

Environment: main branch, app/ui (Next.js app router). Affected files: app/ui/src/app/driver_assist/page.tsx, app/ui/src/app/upload-route/page.tsx.

Scope

In scope

  • Remove the deprecated in-page tester upload screen rendered in driver_assist (page.tsx:218-245) and the related direct-upload fallback path (importRoute, the file input/inputRef, and isImporting state) if no longer needed.
  • On import failure in driver_assist (page.tsx:86-93), route the user back to /upload-route and surface the error there instead of showing the fallback screen.
  • Verify /upload-route already has an error state (page.tsx:240-247); it currently only covers extension/size and file.text() failures. Extend it so JSON parse / route-transform failures also display on this page (e.g. pass the error back via query param or sessionStorage and render it in the existing .ur-error block).

Out of scope

  • Redesigning the /upload-route UI beyond wiring up the error message.
  • Changing the route file format or the transformSessionToDriverRoute validation logic itself.
  • Mobile app upload flow (app/mobile).

Acceptance Criteria

  • The deprecated in-page tester upload screen in driver_assist is removed.
  • Uploading an invalid route file via /upload-route shows a clear error on /upload-route and keeps the user on that page.
  • A valid route file still imports and navigates to /driver_assist successfully (no regression).
  • No dead code remains from the removed fallback path (unused state, refs, handlers, styles).
  • Test coverage added/updated for the invalid-upload error path (see existing driverRouteImport.test.ts).

Assignee

@hir-al-14

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions