-
-
Notifications
You must be signed in to change notification settings - Fork 15
Adding Label 44 /FB Parsing #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Warning Rate limit exceeded
⌛ 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. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a new Label_44_Slash decoder plugin with tests, registers and re-exports it, and refactors flight_plan_utils to move addProcedure into the FlightPlanUtils class with updated call sites. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Plugin as Label_44_Slash
participant DateTime as DateTimeUtils
participant FlightPlan as FlightPlanUtils
participant Result as DecodeResult
Client->>Plugin: decode(message, options)
Plugin->>Plugin: split message text on '/'
Plugin->>Plugin: validate 4 segments
alt valid segments
Plugin->>Plugin: parse fields (position, flight_number, arrival_airport)
Plugin->>DateTime: convert ETA timestamp
DateTime-->>Plugin: eta_time
alt extended 18-field variant
Plugin->>FlightPlan: FlightPlanUtils.addProcedure(decodeResult, route, type)
FlightPlan-->>Plugin: procedure added (raw + formatted)
end
Plugin->>Result: set fields, decoded=true, decodeLevel='partial'
else invalid
Plugin->>Result: decoded=false, decodeLevel='none'
end
Plugin-->>Client: return DecodeResult
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for parsing Label 44 Flight Briefing (/FB) messages, which provide flight status information including position, ETA, fuel, and arrival procedures.
Changes:
- Refactored
addProcedurefrom a private function to a public static method inFlightPlanUtilsclass - Added new
Label_44_Slashdecoder plugin to parse Flight Briefing messages - Registered the new plugin in the MessageDecoder
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/utils/flight_plan_utils.ts | Converted addProcedure from private function to public static method to support external usage |
| lib/plugins/official.ts | Added export for new Label_44_Slash plugin |
| lib/plugins/Label_44_Slash.ts | New decoder plugin for parsing Label 44 Flight Briefing (/FB) messages |
| lib/plugins/Label_44_Slash.test.ts | Test coverage for the new Flight Briefing decoder |
| lib/MessageDecoder.ts | Registered Label_44_Slash plugin in the decoder |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@lib/plugins/Label_44_Slash.ts`:
- Around line 8-9: Update the mismatched inline comment so it reflects the
actual message type used in the class: change the comment that currently reads
"On Runway Report" above the class Label_44_Slash to match the
formatted.description value "Flight Briefing" (or vice‑versa if you prefer the
comment to drive the description) by editing the comment near the class
declaration and ensuring formatted.description in the Label_44_Slash
implementation remains consistent with that comment.
🧹 Nitpick comments (2)
lib/utils/flight_plan_utils.ts (1)
97-115: Indentation inconsistency with class methods.The
addProceduremethod appears to have inconsistent indentation compared to other methods in the class (processFlightPlan,parseHeader). Consider aligning the indentation for consistency.🔧 Suggested formatting fix
-public static addProcedure(decodeResult: DecodeResult, value: string, type: string) { - if (decodeResult.raw.procedures === undefined) { - decodeResult.raw.procedures = []; - } - const data = value.split('.'); - let waypoints; - if (data.length > 1) { - waypoints = data.slice(1).map((leg) => RouteUtils.getWaypoint(leg)); - } - const route = { name: data[0], waypoints: waypoints }; - decodeResult.raw.procedures.push({ type: type, route: route }); - const procedureName = type.substring(0, 1).toUpperCase() + type.slice(1); - decodeResult.formatted.items.push({ - type: `procedure`, - code: 'proc', - label: `${procedureName} Procedure`, - value: RouteUtils.routeToString(route), - }); -}; + public static addProcedure(decodeResult: DecodeResult, value: string, type: string) { + if (decodeResult.raw.procedures === undefined) { + decodeResult.raw.procedures = []; + } + const data = value.split('.'); + let waypoints; + if (data.length > 1) { + waypoints = data.slice(1).map((leg) => RouteUtils.getWaypoint(leg)); + } + const route = { name: data[0], waypoints: waypoints }; + decodeResult.raw.procedures.push({ type: type, route: route }); + const procedureName = type.substring(0, 1).toUpperCase() + type.slice(1); + decodeResult.formatted.items.push({ + type: `procedure`, + code: 'proc', + label: `${procedureName} Procedure`, + value: RouteUtils.routeToString(route), + }); + }lib/plugins/Label_44_Slash.ts (1)
46-60: Consider adding validation for parsed numeric values.The
parseFloatcalls on lines 49, 52, and 59 could returnNaNif the input data is malformed. This could propagate invalid data into the decode result. Consider adding validation or defensive checks.💡 Example defensive check
const latitude = (data[0].charAt(0) === "S" ? -1 : 1) * parseFloat(data[0].slice(1).trim()); const longitude = (data[1].charAt(0) === "W" ? -1 : 1) * parseFloat(data[1].slice(1).trim()); if (isNaN(latitude) || isNaN(longitude)) { // Handle invalid position data ResultFormatter.unknown(decodeResult, `${data[0]},${data[1]}`); } else { ResultFormatter.position(decodeResult, { latitude, longitude }); }
Summary by CodeRabbit
New Features
Tests
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.