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 > 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 > 2) {
addRoute(decodeResult, header.substring(2));
}
}
(Whichever behavior is actually desired — but route_status should be a stable enum-like value.)
Summary
In
lib/utils/flight_plan_utils.ts,parseHeaderis inconsistent about what it stores indecodeResult.raw.route_statusacross the various status prefixes (RF,RP,RI,RM,RS). TheRPbranch 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):For all other branches (
RF,RI,RM,RS)route_statusends up as the two-letter code. ForRPit ends up as the entire header string. Consumers readingraw.route_statussee different shapes depending on the prefix.Suggested fix
Drop the trailing
decodeResult.raw.route_status = header;. If there is route content embedded in anRPheader (mirroring theRFbranch'sif (header.length > 2) { addRoute(...) }), parse it the same wayRFdoes instead of stuffing it into the status field:(Whichever behavior is actually desired — but
route_statusshould be a stable enum-like value.)