Add Label A3 PDC (Pre-Departure Clearance) decoder plugin#408
Add Label A3 PDC (Pre-Departure Clearance) decoder plugin#408thepacket wants to merge 1 commit intoairframesio:masterfrom
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 30 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 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 underlyingHH:MM. Result: two near-identical time rows informatted.items. Pick one (prefertimestamp()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
260419parsing as2026-04-19only happens to "work" because today is in 2026 — for190426it would silently produce2019-04-26. Verify against documented field semantics before merging; if it really is YYMMDD, update PR description and the inlineDDMMYYreference in the header comment (line ~28). raw.adtstores formattedHH:MMstrings mixed with alphanumeric flow tokens. Per project convention numeric times go in seconds-of-day (e.g.out_time). Either store the parsed numeric inraw.out_time/raw.off_timeand the token-form separately, or namespace asraw.adt: { time?: number; token?: string }.
Should Fix
- HHMM range validation.
timeandadtare not validated. Inputs like2599produce25:99strings and incorrect TODs. - Header regex isn’t anchored.
headerRelacks^; combined with\/?the parser will happily match a substring deep inside an unrelated body. Anchor at start (after the trim). raw.routeis a string (free-form text), but theRawFieldsroutefield is typed asRoute(a structured object — seelib/types/route.ts). Either parse to that type or rename your raw key (e.g.raw.route_text/ useResultFormatter.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_typeare all bespoke. Document or namespace. appRawshape is lossy. You join thefreqandD02token with a single space and stash onraw.app_trailing. Either expose both fields separately ({ frequency, descriptor }) or leave fully raw onremaining.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. UseResultFormatter.callsign(...).decodeResult.raw.callsign = callsign;is then immediately overwritten byResultFormatter.flightNumber(...)(which setsraw.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!
Adds a decoder for label A3 electronic Pre-Departure Clearance responses.
Handles two envelope separator forms:
.separator:RIOCGYA.DC1.CLD 2227 260419 SBGR PDC 692…/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 buildpasses.