Skip to content

Add Label A3 PDC (Pre-Departure Clearance) decoder plugin#408

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

Add Label A3 PDC (Pre-Departure Clearance) decoder plugin#408
thepacket wants to merge 1 commit intoairframesio:masterfrom
thepacket:plugin/label-a3

Conversation

@thepacket
Copy link
Copy Markdown

Adds a decoder for label A3 electronic Pre-Departure Clearance responses.

Handles two envelope separator forms:

  • Rio/AA style with . separator: RIOCGYA.DC1.CLD 2227 260419 SBGR PDC 692…
  • Frankfurt/CFMU style with / separator: /FRADFYA.DC1/CLD 0658 220612 EDDF PDC 688…

Surfaces facility, subtype, time, date (YYMMDD), origin, destination, PDC sequence, callsign, departure runway, SID, full route, squawk, ADT (HHMM or flow token), next frequency, ATIS, startup-approval, TSAT token, trailing APP.

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 30 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 30 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: 8707386c-3561-413e-a10f-8a343c156070

📥 Commits

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

📒 Files selected for processing (3)
  • lib/MessageDecoder.ts
  • lib/plugins/Label_A3_PDC.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 Label_A3_PDC for Pre-Departure Clearance messages, handling both .-separator (Rio/AA) and /-separator (CFMU/EDDF) header variants, plus body fields (callsign, runway, SID, route, squawk, ADT, NEXT FREQ, ATIS, APP, STARTUP/TSAT). Registered correctly.

Verdict

Changes requested — broadest of the five PRs, with some genuine correctness issues and the now-familiar missing-tests problem.

Must Fix

  • No tests. Please add coverage for: the Rio header form (RIOCGYA.DC1.CLD …), the CFMU header form (/FRADFYA.DC1/CLD …), a no-trailer body (just SID + route), all-trailers (squawk + ADT digits + NEXT FREQ + ATIS + APP), STARTUP-only and STARTUP+TSAT bodies, and a malformed-header negative case.
  • Duplicate Clearance Time row. ResultFormatter.timestamp(...) (line 167) pushes {type:'time', code:'TIMESTAMP'}, and lines 210–215 then push another {type:'time', code:'TIME', label:'Clearance Time (UTC)'} with the same underlying HH:MM. Result: two near-identical time rows in formatted.items. Pick one (prefer timestamp() only — and drop the explicit push). Same antipattern flagged in #406.
  • Date is parsed as YYMMDD but PR body / header comment call it DDMMYY. The code itself documents the contradiction (lines 148–150). Please confirm and pick one. The example 260419 parsing as 2026-04-19 only happens to "work" because today is in 2026 — for 190426 it would silently produce 2019-04-26. Verify against documented field semantics before merging; if it really is YYMMDD, update PR description and the inline DDMMYY reference in the header comment (line ~28).
  • raw.adt stores formatted HH:MM strings mixed with alphanumeric flow tokens. Per project convention numeric times go in seconds-of-day (e.g. out_time). Either store the parsed numeric in raw.out_time/raw.off_time and the token-form separately, or namespace as raw.adt: { time?: number; token?: string }.

Should Fix

  • HHMM range validation. time and adt are not validated. Inputs like 2599 produce 25:99 strings and incorrect TODs.
  • Header regex isn’t anchored. headerRe lacks ^; combined with \/? the parser will happily match a substring deep inside an unrelated body. Anchor at start (after the trim).
  • raw.route is a string (free-form text), but the RawFields route field is typed as Route (a structured object — see lib/types/route.ts). Either parse to that type or rename your raw key (e.g. raw.route_text / use ResultFormatter.flightPlan(...) which is the existing convention for free-form route text).
  • Non-standard raw keys. subtype, format, pdc_sequence, sid, squawk, next_frequency, atis_code, app_trailing, startup_approval, tsat_token, facility, message_type are all bespoke. Document or namespace.
  • appRaw shape is lossy. You join the freq and D02 token with a single space and stash on raw.app_trailing. Either expose both fields separately ({ frequency, descriptor }) or leave fully raw on remaining.text.
  • Trailer-start scan uses prefixes that overlap with route content. body.indexOf('ADT') will hit 'ADT' inside any waypoint name containing those letters (e.g. RADTU). Use word-boundary regex matches, like the field extractors below them.
  • Callsign regex[A-Z]{2,3}\d{1,5}|[A-Z][A-Z0-9]{2,7} accepts almost any capitalised token. Add a rough deny-list for known route tokens (CLRD, OFF, VIA, SQUAWK) or anchor the line.

Nits

  • ResultFormatter.flightNumber(decodeResult, callsign) — callsign and flight number aren’t the same thing. Use ResultFormatter.callsign(...).
  • decodeResult.raw.callsign = callsign; is then immediately overwritten by ResultFormatter.flightNumber(...) (which sets raw.flight_number, leaving callsign untouched — but see above).
  • The "ignore wild-guesses" comment in the doc-block reads as internal guidance — consider tightening to "exposed verbatim because the field is undocumented".
  • replace(/\s+/g, ' ') on the route preserves ATC syntax (/F350/) but collapses the double-spaces SBGR uses for delimiting. That’s probably intentional but worth a test.

Tests

Missing. See Must Fix.

Notes

  • Registration LGTM (MessageDecoder pluginClasses + official.ts re-export).
  • CodeRabbit rate-limited; warning 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