Add Label 41 CMC Fault Report decoder plugin#402
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 41 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_41_Fault for an airborne maintenance / CMC fault report with /FB sub-label (JetBlue variant). Registers in MessageDecoder.ts and lib/plugins/official.ts.
Verdict
The header parse is solid, HHMM range is validated (good — that's better than the sibling PRs), and the position parsing is clean. A couple of items to address before merge.
Must Fix
- No companion
Label_41_Fault.test.ts. Every plugin inlib/plugins/has a Jest test file. Please add one with the example wire format plus negative cases (no/ADtoken, malformed lat/lon, missing fault text). - Lossy fall-through. On regex mismatch or invalid HHMM you
setDecodeLevel(false)and return without populatingremaining.text. Usethis.failUnknown(decodeResult, message.text, options)(seeLabel_15.ts) so the unparsed text is still surfaced.
Should Fix
- Sub-label handling. You manually push a custom
{type:'sub_label', code:'SUBLBL'}chip and writeraw.sub_labelonly via the chip metadata. There's an existingResultFormatter.sublabel(decodeResult, '/FB')helper that setsraw.sublabeland emits a canonical chip. Prefer the helper. Even better: inspectmessage.sublabelfrom the parser if it's already populated upstream, rather than re-parsing the prefix fromtext. - Qualifier scope.
qualifiers()currently returns{ labels: ['41'] }with no preamble filter, so this plugin will be tried for every label-41 message. The implementation only handles/FB-prefixed payloads. Consider addingpreambles: ['/FB'](compare withLabel_15.tswhich usespreambles: ['(2']) so the plugin only fires on matching messages, leaving room for other label-41 variants. - Flight-number regex.
^[A-Z]{2,3}\d{1,5}[A-Z]?$matchesJBU837but rejects e.g. tail numbers or longer airline prefixes. If non-matching, you silently skip surfacing it — at minimum log viathis.debug(options, ...)so the dropped value is visible during debugging.
Nits
Message Typechip duplicatesformatted.description. Same applies to theSUBLBLchip ifResultFormatter.sublabelis adopted.decodeResult.raw.report_timestores"HH:MM"whileraw.message_timestamp(fromResultFormatter.timestamp) stores seconds-since-midnight — consumers now have two slightly different "report time" representations on the same result. Drop the string version unless there's a downstream that needs it.- Lat/lon parse uses
\d+(?:\.\d+)?— fine for the example. No range check on lat (≤90) / lon (≤180); worth a one-liner. - Several
(parts[N] || '').trim()calls —partsis already trimmed via.map((s) => s.trim()), the second.trim()is redundant.
Tests
Missing — please add Label_41_Fault.test.ts.
Notes
- Registration: confirmed in
lib/MessageDecoder.tsandlib/plugins/official.ts. Good.
Thanks @thepacket!
Adds a decoder for airborne maintenance / Central Maintenance Computer fault reports (JetBlue
/FBsub-label).Wire format
Surfaces time, maintenance routing address, position, flight ID, CMC message code, plain-English fault description. Nine trailing empty slots (reserved fields) ignored.
npm run buildpasses.