Skip to content

Bug: flight_plan_utils.parseHeader RP branch overwrites route_status with the full header #427

@kevinelliott

Description

@kevinelliott

Summary

In lib/utils/flight_plan_utils.ts, parseHeader is inconsistent about what it stores in decodeResult.raw.route_status across the various status prefixes (RF, RP, RI, RM, RS). The RP branch in particular sets the field to the short status code, then immediately overwrites it with the entire header string at the end of the branch.

Affected code

lib/utils/flight_plan_utils.ts (parseHeader):

} else if (header.startsWith('RP')) {
  decodeResult.raw.route_status = 'RP';            // set to 'RP'
  decodeResult.formatted.items.push({
    type: 'status',
    code: 'ROUTE_STATUS',
    label: 'Route Status',
    value: 'Route Planned',
  });
  decodeResult.raw.route_status = header;          // <-- overwrites with full header
} else if (header.startsWith('RI')) {
  decodeResult.raw.route_status = 'RI';
  ...
}

For all other branches (RF, RI, RM, RS) route_status ends up as the two-letter code. For RP it ends up as the entire header string. Consumers reading raw.route_status see different shapes depending on the prefix.

Suggested fix

Drop the trailing decodeResult.raw.route_status = header;. If there is route content embedded in an RP header (mirroring the RF branch's if (header.length &gt; 2) { addRoute(...) }), parse it the same way RF does instead of stuffing it into the status field:

} else if (header.startsWith('RP')) {
  decodeResult.raw.route_status = 'RP';
  decodeResult.formatted.items.push({
    type: 'status', code: 'ROUTE_STATUS',
    label: 'Route Status', value: 'Route Planned',
  });
  if (header.length &gt; 2) {
    addRoute(decodeResult, header.substring(2));
  }
}

(Whichever behavior is actually desired — but route_status should be a stable enum-like value.)

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