Add Label C1 Loadsheet decoder plugin#416
Add Label C1 Loadsheet decoder plugin#416thepacket 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 17 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_C1_Loadsheet for label C1 electronic loadsheet uplinks. Tolerant line-by-line parser with a single-line fallback that splits on known keywords. Registered last in MessageDecoder.ts/official.ts. No companion test file.
Verdict
Comment-only review — biggest single issue is the missing test coverage given how many fields this plugin tries to handle. The parsing logic is generally well-structured, but a few mismatches with the project's conventions and a couple of small bugs should be addressed.
Must Fix
- Add a
Label_C1_Loadsheet.test.ts. This plugin recognizes ~13 distinct field types — please cover them. At minimum:qualifiers(), the multi-line happy path from the doc-comment example, the single-line fallback (splitIntoFieldskeyword path),PRELIMINARYvsFINALvariants, theSIroute-vs-free-text branch, theNOTOC: NOnormalization, and a non-matching message. - Use
ResultFormatterfor shared concerns. Today the plugin setsraw.tailand pushes a customcode: 'TAIL'item with label'Aircraft Registration', instead of callingResultFormatter.tail(decodeResult, m[1]). Same for therouteSI branch —ResultFormatter.departureAirport/arrivalAirportalready exist and produce the canonical IATA/ICAO items. Directraw.departure_iata = ...followed by a customcode: 'ROUTE'item bypasses the canonical "Origin/Destination" rows that consumers (and the test fixtures) expect.
Should Fix
- Add a
preamblesqualifier if at all possible. Every C1 observation in your doc-comment begins with.(the FRAGDLH-style sender token). If that's reliable,preambles: ['.']would prevent this plugin from running its full keyword scan against unrelated C1 traffic. - DDHHMM has no bounds validation.
190925is fine, but999999is happily decoded as "Day 99 @ 99:99Z". Either validatedd <= 31,hh < 24,mm < 60, or document the looseness. Same applies to the loadsheetreference_timecapture (free-form pass-through is fine; just be aware). PAXregex captures wrong totals when classes are swapped. For inputPAX C/Y 6/84you bindclasses = ['C','Y']andcounts = [6, 84]— perfect. ForPAX Y/C 84/6you'd produce{Y: 84, C: 6}which is correct, but theclassLabelmapping has a duplicate entry: bothCandJmap to'Business'. That's acceptable airline-data shorthand, but worth a comment explaining you're treating them as equivalent intentionally.splitIntoFieldsis destructive across the input. It collapses\s{2,}to a single space before line-splitting. That's deliberate, but if a free-textSIline contains intentional double spaces, they're lost. Move the whitespace collapse inside per-line handling rather than at the top.raw.day = Number(dd)clobbers the typed field.RawFields.dayisnumber | string, so this is OK, but be aware the sameraw.dayslot is used byResultFormatter.day()— if a future C1 message also arrives with a UTC timestamp elsewhere you may write twice. Considerraw.dtg_dayto disambiguate.const [_, dd, hh, mm] = m;— under stricter eslint configs the unused leading_triggers@typescript-eslint/no-unused-vars. The codebase tends to usem[1]/m[2]/m[3]indexed access (seeLabel_15.ts). Optional cleanup.
Nits
- The keyword-splitter list mixes
'AN ','PAX ','PAX/'etc. — some have trailing space, some have a slash. That's fine but awkward to maintain. Consider a[{name, regex}]table. - Doc-comment is excellent, very useful for future maintainers.
- Saving
decodeResult.raw.is_agm = trueas a typed boolean is fine; just consistent with how other plugins represent markers (most use aformatted.itemsentry only, norawfield). partialdecode level whenremaining.length === 0but a section was unrecognized — small thing, butsetDecodeLevel(decodeResult, anyMatched, remaining.length ? 'partial' : 'full')returnsdecoded: falseifanyMatchedwas false. Confirm that's intended (it is, per the protocol).
Tests
None added. Please add Label_C1_Loadsheet.test.ts. See "Must Fix" above for coverage list.
Notes — Registration & Coexistence
- Registered at the tail of
pluginClassesand exported fromofficial.ts. No other plugin claims label C1, so order is irrelevant. - No coexistence concerns.
Thanks @thepacket!
Adds a decoder for label C1 electronic loadsheet uplinks.
npm run buildpasses.