Skip to content

Add Label 41 CMC Fault Report decoder plugin#402

Open
thepacket wants to merge 1 commit into
airframesio:masterfrom
thepacket:plugin/label-41
Open

Add Label 41 CMC Fault Report decoder plugin#402
thepacket wants to merge 1 commit into
airframesio:masterfrom
thepacket:plugin/label-41

Conversation

@thepacket

Copy link
Copy Markdown

Adds a decoder for airborne maintenance / Central Maintenance Computer fault reports (JetBlue /FB sub-label).

Wire format

/FB 0340/AD MDST/N 39.321,W 74.146,JBU837,MCM03,AIR PACK 1 REGUL FAULT,,,,,,,,,

Surfaces time, maintenance routing address, position, flight ID, CMC message code, plain-English fault description. Nine trailing empty slots (reserved fields) ignored.

npm run build passes.

New plugin registered in official.ts and MessageDecoder.ts.
@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

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 41 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 41 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: 3571575d-dc94-4e66-b016-9a8268163d2f

📥 Commits

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

📒 Files selected for processing (3)
  • lib/MessageDecoder.ts
  • lib/plugins/Label_41_Fault.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.

@kevinelliott kevinelliott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in lib/plugins/ has a Jest test file. Please add one with the example wire format plus negative cases (no /AD token, malformed lat/lon, missing fault text).
  • Lossy fall-through. On regex mismatch or invalid HHMM you setDecodeLevel(false) and return without populating remaining.text. Use this.failUnknown(decodeResult, message.text, options) (see Label_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 write raw.sub_label only via the chip metadata. There's an existing ResultFormatter.sublabel(decodeResult, '/FB') helper that sets raw.sublabel and emits a canonical chip. Prefer the helper. Even better: inspect message.sublabel from the parser if it's already populated upstream, rather than re-parsing the prefix from text.
  • 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 adding preambles: ['/FB'] (compare with Label_15.ts which uses preambles: ['(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]?$ matches JBU837 but rejects e.g. tail numbers or longer airline prefixes. If non-matching, you silently skip surfacing it — at minimum log via this.debug(options, ...) so the dropped value is visible during debugging.

Nits

  • Message Type chip duplicates formatted.description. Same applies to the SUBLBL chip if ResultFormatter.sublabel is adopted.
  • decodeResult.raw.report_time stores "HH:MM" while raw.message_timestamp (from ResultFormatter.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 — parts is 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.ts and lib/plugins/official.ts. Good.

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