Add Label B9 ATIS Request decoder plugin#414
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 19 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 new Label_B9_ATIS_Request plugin for label B9 D-ATIS request downlinks (/ICAO.TI2/SEQ ICAO LETTER SUBQ CHK). Registers it last in MessageDecoder.ts/official.ts. No companion test file.
Verdict
Comment-only review — needs changes before merge. The decoding logic is reasonable and self-contained, but there are no tests, no preamble qualifier (so the plugin runs against every B9 message even when it can't apply), and a couple of small data-model concerns.
Must Fix
- Add a
Label_B9_ATIS_Request.test.ts. Every other label plugin in this directory has one and the project's review checklist explicitly flags missing tests. At minimum:qualifiers()shape, a happy-path decode for/EDDK.TI2/024EDDKA661A, the partial-header fallback, and a non-matching string. - Restrict the qualifier to a real preamble. Right now
qualifiers()returnslabels: ['B9']only — every B9 message is run through this regex even when it's clearly not a TI2 request. Addpreambles: ['/'](every observed shape begins with/) so the dispatcher can short-circuit. This is consistent with peers likeLabel_H1_Paren(preambles: ['(']).
Should Fix
raw.arrival_icao = gsis semantically wrong. A B9 ATIS request targets a ground-station ATIS service — that station may or may not be the flight's arrival airport. Storing it underarrival_icaowill pollute downstream consumers that aggregate by destination. Drop it; you already exposeground_station_icaoand the top-level airport item undercode: 'GNDSTN'. Same applies to the partial-header fallback path (line 67).decodeResult.formatted.items = [...](line 111) replaces the array. It happens to be empty here becauseinitResult()doesn't push anything, but the convention everywhere else in the codebase isitems.push(...). Switching avoids a subtle footgun ifinitResultis ever extended.raw.checksumis typednumberinRawFieldsbut you assign a string.chkis[A-Z0-9]{2,4}, e.g."661A". Either assign it under a different key (raw.atis_checksum_hex) or convert viaparseInt(chk, 16). Today this just relies on the index signature falling through, but it'll trip up anyone reading types.
Nits
- The phonetic table is fine, but it's effectively a const map — pulling it out of the class avoids reallocating on every decode (cosmetic only).
- "differs from header" / "echoes target" annotation embedded in the value string is friendly but mixes data and presentation — fine for now, just be aware it makes programmatic comparison harder.
- The 2–4 char checksum window is wide; if you have a sample showing variable widths it would be nice to capture in a comment so future maintainers don't tighten it accidentally.
Tests
None added. Please add Label_B9_ATIS_Request.test.ts covering at minimum:
qualifiers()shape (will need to be updated after adding the/preamble)- Happy path (
/EDDK.TI2/024EDDKA661A) — assert tail/letter/subq/checksum and the items array - Partial-header fallback (
/EDDK.TI2/...garbage) - Non-matching string returns
decoded: false
Notes — Registration & Coexistence
- Registered at the tail of
pluginClassesinMessageDecoder.ts(afterLabel_QQ) and exported fromofficial.ts. No other plugin claims label B9, so order is irrelevant. - No coexistence concerns.
Thanks @thepacket!
There was a problem hiding this comment.
Pull request overview
Adds a new decoder plugin for ACARS Label B9 ATIS request downlinks (aircraft → ground-station ATIS service), parsing the /ICAO.SUBTYPE/SEQ ECHO LETTER SUBQ CHK wire format and producing both a full and a partial-header decode. Registers the new plugin in the official plugin barrel and the MessageDecoder plugin list.
Changes:
- New
Label_B9_ATIS_Requestplugin with a primary regex, a partial fallback that decodes just the/ICAO.SUBTYPE/header, and a phonetic mapper for the ATIS letter. - Exports the new plugin from
lib/plugins/official.ts. - Registers the new plugin in
MessageDecoderafter theLabel_QSentry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/plugins/Label_B9_ATIS_Request.ts | New decoder plugin for B9 ATIS request messages |
| lib/plugins/official.ts | Re-exports the new B9 plugin |
| lib/MessageDecoder.ts | Registers the new plugin in the default plugin list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| decodeResult.raw.payload_echo_icao = echo; | ||
| decodeResult.raw.atis_letter = letter; | ||
| decodeResult.raw.atis_subqualifier = subq; | ||
| decodeResult.raw.checksum = chk; |
| * /KLAX.TI2/024KLAXDB1CC | ||
| * /KSFO.TI2/040KSFOCBE89 | ||
| */ | ||
| export class Label_B9_ATIS_Request extends DecoderPlugin { |
|
|
||
| qualifiers() { | ||
| return { | ||
| labels: ['B9'], |
| decodeResult.raw.preamble = '/'; | ||
| decodeResult.raw.ground_station_icao = gs; | ||
| decodeResult.raw.atis_subtype = subtype; | ||
| decodeResult.raw.sequence = seq; |
| }; | ||
| } | ||
|
|
||
| decode(message: Message, options: Options = {}): DecodeResult { |
Adds a decoder for label B9 D-ATIS requests (request for ATIS broadcast).
npm run buildpasses.