Skip to content

Add Label 81 MVA (Aircraft Movement Message) decoder plugin#406

Open
thepacket wants to merge 1 commit intoairframesio:masterfrom
thepacket:plugin/label-81
Open

Add Label 81 MVA (Aircraft Movement Message) decoder plugin#406
thepacket wants to merge 1 commit intoairframesio:masterfrom
thepacket:plugin/label-81

Conversation

@thepacket
Copy link
Copy Markdown

Adds a decoder for APAC/Jetstar label 81 carrying IATA AHM 780 MVA (Aircraft-Initiated Movement Message) payloads.

Wire format

MVA
JST0122/20.VHOYR.MEL
AA0945/0950
SI FB  37

Both MVA (arrival AA) and AD (departure) shapes handled. Supplementary info SI FB surfaced as Fuel on Board.

npm run build passes.

New plugin registered in official.ts and MessageDecoder.ts.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@thepacket has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 32 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 55 minutes and 32 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: eeefdf27-b7cc-4909-ba30-742a85a07d15

📥 Commits

Reviewing files that changed from the base of the PR and between 10f9f69 and 6371dc3.

📒 Files selected for processing (3)
  • lib/MessageDecoder.ts
  • lib/plugins/Label_81_MVA.ts
  • lib/plugins/official.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@kevinelliott kevinelliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Adds a Label_81_MVA plugin for APAC/Jetstar IATA AHM 780 MVA payloads. Handles arrival (AA), departure (AD), and a single SI FB supplementary line. Registered correctly.

Verdict

Changes requested — solid scaffolding, but there are duplicate formatted entries, missing tests, and a few correctness items.

Must Fix

  • No tests. Please add coverage for: arrival example from the PR body, a departure (AD0827/0837) variant, missing SI line, missing on-blocks (AA0945-only), and a malformed line-2 negative case.
  • Duplicate timestamp items. You call ResultFormatter.timestamp(...) (which pushes code:'TIMESTAMP') and then push {type:'actual_touchdown', code:'AAT', ...} / code:'ADB' etc. with the same underlying value. Result: the same touchdown time appears twice in formatted.items. Either drop the explicit AAT/ADB/... rows or drop the timestamp() call. (See "common antipatterns" — timestamp() + explicit {type:'time'} push.)
  • ResultFormatter.timestamp() is conceptually wrong here. This isn't a "message timestamp", it's a touchdown / off-blocks event time. Prefer the dedicated helpers — ResultFormatter.on() for AA touchdown, ResultFormatter.in() for on-blocks, ResultFormatter.out() for off-blocks, ResultFormatter.off() for takeoff. That also fixes the duplicate-row problem and aligns with Label_44_*.

Should Fix

  • Airport code length not validated against type. Line-2 captures airport: [A-Z]{3,4}. A 3-char value is IATA, a 4-char value is ICAO, but arrivalAirport(decodeResult, airport) / departureAirport(decodeResult, airport) default to ICAO — so a 3-char IATA gets stored in raw.arrival_icao / raw.departure_icao. Branch on length and pass 'IATA' when it’s 3 chars.
  • HHMM range validation. aaTouchdown.substring(0,2) produces e.g. 99:99 for invalid inputs. Validate hours < 24 and minutes < 60 before formatting/pushing.
  • raw.actual_touchdown / actual_on_blocks / actual_off_blocks / actual_takeoff use a HH:MM string form while the project convention (per RawFields) uses seconds-since-midnight numeric (on_time, in_time, out_time, off_time). Switch to the dedicated formatters and you get this for free.
  • SI FB value is currently emitted as a free-form string ("FB (Fuel on Board): 37") rather than via ResultFormatter.currentFuel(). Use the formatter so consumers can pick up raw.fuel_on_board numerically.
  • raw.flight_number set both manually (line 76) and via ResultFormatter.flightNumber (line 80). The formatter already sets raw.flight_number. Drop the manual assignment.

Nits

  • lines[2] / lines[3] index access is positional — if SI arrives without the time line, the SI parsing won’t happen. Consider scanning the lines for an SI prefix instead.
  • Tail regex [A-Z0-9-]{3,10} accepts a leading - like -VHOYR. Fine in practice, but a minor anchor ([A-Z0-9](?:[A-Z0-9-]{1,8}[A-Z0-9])?) would be safer.
  • raw.airport is renamed at the formatted-row level to "Airport of Movement" — keep the raw key consistent with the formatted label (raw.airport_of_movement or surface as raw.arrival_icao/departure_icao and rely on those).

Tests

Missing. See Must Fix.

Notes

  • Registration LGTM. No collision risk — no other Label_81 plugin exists.
  • CodeRabbit rate-limited; that comment can be ignored.

Thanks @thepacket!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants