Add Label 5U Weather Information Request decoder plugin#404
Conversation
New plugin registered in official.ts and MessageDecoder.ts.
|
Warning Rate limit exceeded
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 37 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
kevinelliott
left a comment
There was a problem hiding this comment.
Summary
Adds a Label_5U_WXR plugin handling two observed Weather Information Request shapes (Form A: OS KHRL/WXRKHRL, and Form B: 3LFRB/EINN/BIKF). Registered in MessageDecoder.ts and official.ts.
Verdict
Changes requested — no tests, and Form B mis-uses departureAirport. Otherwise small surface, easy fixes.
Must Fix
- No tests. Every other plugin in
lib/plugins/has a companionLabel_*.test.ts. Please add coverage for at least: Form A canonical (OS KHRL/WXRKHRL,), Form B canonical (3LFRB/EINN/BIKF), empty body, malformed body, and theunshiftordering of items. - Form B mis-uses
ResultFormatter.departureAirport()/arrivalAirport()for the first two ICAOs (lines 59–60). In a WXRQ list there is no semantic departure or arrival airport — these are weather request targets. This pollutesraw.departure_icao/raw.arrival_icaoand the ORG/DST formatted slots with values that are not flight endpoints. Consider exposing them only via a neutralWXRREQrow plus a typedraw.weather_request_icaos: string[].
Should Fix
- Form B
countregex is greedy and unbounded.^(?<count>\d+)(?<icaos>...)will happily consume any leading digit run. ARINC count fields here are typically a single digit. Anchor with\d{1,2}and validate the count matchesicaos.length. - Non-standard raw keys.
raw.count,raw.icaos,raw.subtype,raw.wxr_request_icaoare bespoke. Prefer documented forms or namespace them (e.g.wxr_request: { icaos: [], count: n }). countis stored as a string (raw.count = count). Other plugins store numeric counts as numbers; considerNumber(count).- Form A regex is not anchored at the end (
/^...\/WXR(?<wxrIcao>[A-Z]{3,4})/). If trailing content carries additional comma-separated entries (per the file’s own header comment), capture them or leave them onremaining.textrather than silently discarding.
Nits
- The pretty box-drawing comment is great, but please normalise the unicode dashes (── / └──) — some editors render them inconsistently in diffs.
decodeResult.formatted.items.unshift(...)after several pushes makes the final ordering hard to reason about. Build the items in order (or use a small helper) instead of mixing unshift + push.- The Form A subtype is captured as
[A-Z]{1,4}but onlyOSis documented. A small inline comment listing observed subtypes (OS, …) would help future maintainers.
Tests
Missing entirely. See Must Fix.
Notes
- Registration LGTM — plugin added at the end of
pluginClassesinMessageDecoder.tsand exported fromofficial.ts. No conflicts with existing 5U handlers (none exist). - CodeRabbit hit a rate limit and did not actually review this PR; the warning comment can be ignored.
Thanks @thepacket!
There was a problem hiding this comment.
Pull request overview
Adds an official decoder plugin for ACARS label 5U to parse autonomous weather information requests (WXRQ), supporting two observed payload formats.
Changes:
- Introduces
Label_5U_WXRplugin to decode Form A (<subtype> <ICAO>/WXR<ICAO>) and Form B (<count><ICAO1>/<ICAO2>/...) payloads. - Registers the new plugin in the official plugins barrel export.
- Adds the plugin to
MessageDecoder’s plugin registration list.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| lib/plugins/official.ts | Exports the new Label_5U_WXR plugin from the official plugin barrel. |
| lib/plugins/Label_5U_WXR.ts | Implements label 5U WXRQ decoding logic for two observed formats. |
| lib/MessageDecoder.ts | Registers the new plugin so it is used during decoding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const count = formB.groups.count; | ||
| const icaos = formB.groups.icaos.split('/'); | ||
| const [dep, dest, ...alternates] = icaos; | ||
|
|
||
| decodeResult.raw.count = count; | ||
| decodeResult.raw.icaos = icaos; | ||
| ResultFormatter.departureAirport(decodeResult, dep); | ||
| if (dest) ResultFormatter.arrivalAirport(decodeResult, dest); | ||
|
|
||
| decodeResult.formatted.items.unshift( | ||
| { | ||
| type: 'message_type', | ||
| code: 'MSGTYP', | ||
| label: 'Message Type', | ||
| value: 'Weather Information Request (WXRQ)', | ||
| }, | ||
| { | ||
| type: 'count', | ||
| code: 'COUNT', | ||
| label: 'Sequence / Count', | ||
| value: count, | ||
| }, | ||
| ); |
| const regex = | ||
| /^(?<subtype>[A-Z]{1,4})\s+(?<dest>[A-Z]{3,4})\/WXR(?<wxrIcao>[A-Z]{3,4})/; | ||
| const m = text.match(regex); |
| if (!m?.groups) { | ||
| this.setDecodeLevel(decodeResult, false); | ||
| return decodeResult; | ||
| } |
| const decodeResult = this.initResult( | ||
| message, | ||
| 'Autonomous Weather Information Request (WXRQ)', | ||
| ); |
| const { subtype, dest, wxrIcao } = m.groups; | ||
|
|
||
| decodeResult.raw.subtype = subtype; | ||
| ResultFormatter.arrivalAirport(decodeResult, dest); | ||
| decodeResult.raw.wxr_request_icao = wxrIcao; | ||
|
|
| }; | ||
| } | ||
|
|
||
| decode(message: Message, options: Options = {}): DecodeResult { |
| if (formB?.groups) { | ||
| const count = formB.groups.count; | ||
| const icaos = formB.groups.icaos.split('/'); |
Adds a decoder for label 5U autonomous weather information requests (WXRQ). Handles two observed variants:
Form A — subtype + ICAO +
/WXR+ICAO:Form B — count + slash-separated ICAO list:
npm run buildpasses.