Skip to content

Handle unavailable route distance without numeric overflow #1722

Description

@timohueser

Parent: #1433. Program: #1448. Found during browser card/reset fault checks for #1720; this is a separate pre-existing route-display failure.

Problem

RouteMatch returns dist_m = u32::MAX when no route segment can be decoded, including a route read failure. Navigator preserves this unavailable-distance sentinel. The Map off-route chip and Statistics header pass it to numeric formatting. Metric rounding adds 500 in u32 and panics in checked builds; release output is also false. Other whole-unit rounding paths have the same upper-bound problem.

Scope

Document the existing unavailable cross-track value and make Map/Statistics show their existing off-route label without an invented distance when it is unavailable. Keep matcher geometry, progress, search, I/O and navigation policy unchanged. Do not add a new error coordinator or sentinel to unrelated distance domains.

Make the existing affected distance rounding arithmetic safe for its u32 inputs, retaining normal metric/imperial thresholds, rounding and copy. Prefer widened intermediate arithmetic or an equally simple exact expression. Do not change units or introduce new UI text.

Acceptance

  • Whole owning App and route suites cover no usable route segment/unreadable source reaching Map and Statistics without panic or a fabricated distance. Reuse the current source failure and rendering seams; no new debug API.
  • Focused formatter cases cover ordinary crossover/rounding and upper bounds in metric/imperial without wrapping. Keep tests within owning suites, not a new fixture framework.
  • Scoped Clippy, relevant Thumb check, registry, formatting and any required documentation checks pass. State whether public docs change.
  • Check the affected named frames; normal UI snapshot hashes must remain stable. No local full snapshot sweep or full CI mirror.
  • Independent adversarial review and green CI before merge. This source correction does not require physical testing first.

Status: complete in PR #1724, merged as 72fc615a after independent review and green CI. All 1,371 owning tests, scoped Clippy, Thumb/native builds, registry and formatting pass. Normal Map/Statistics hashes are unchanged. The final combined shipping image passes all current resource gates; exact commands and limits are in the PR. Physical high-water remains open under #1501/#1448.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions