Skip to content

Add Label B9 ATIS Request decoder plugin#414

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

Add Label B9 ATIS Request decoder plugin#414
thepacket wants to merge 1 commit intoairframesio:masterfrom
thepacket:plugin/label-b9

Conversation

@thepacket
Copy link
Copy Markdown

Adds a decoder for label B9 D-ATIS requests (request for ATIS broadcast).

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 19 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 19 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: 699c1c0b-a911-411e-8fa7-8a3512fa746d

📥 Commits

Reviewing files that changed from the base of the PR and between 10f9f69 and 737ca0d.

📒 Files selected for processing (3)
  • lib/MessageDecoder.ts
  • lib/plugins/Label_B9_ATIS_Request.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 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() returns labels: ['B9'] only — every B9 message is run through this regex even when it's clearly not a TI2 request. Add preambles: ['/'] (every observed shape begins with /) so the dispatcher can short-circuit. This is consistent with peers like Label_H1_Paren (preambles: ['(']).

Should Fix

  • raw.arrival_icao = gs is 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 under arrival_icao will pollute downstream consumers that aggregate by destination. Drop it; you already expose ground_station_icao and the top-level airport item under code: '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 because initResult() doesn't push anything, but the convention everywhere else in the codebase is items.push(...). Switching avoids a subtle footgun if initResult is ever extended.
  • raw.checksum is typed number in RawFields but you assign a string. chk is [A-Z0-9]{2,4}, e.g. "661A". Either assign it under a different key (raw.atis_checksum_hex) or convert via parseInt(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 pluginClasses in MessageDecoder.ts (after Label_QQ) and exported from official.ts. No other plugin claims label B9, so order is irrelevant.
  • No coexistence concerns.

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