Skip to content

Multileg unified implementation test#103

Merged
CarlAndreasArnegard merged 9 commits intomainfrom
multileg-unified-implementation-test
Mar 2, 2026
Merged

Multileg unified implementation test#103
CarlAndreasArnegard merged 9 commits intomainfrom
multileg-unified-implementation-test

Conversation

@CarlAndreasArnegard
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings February 26, 2026 09:17
@CarlAndreasArnegard CarlAndreasArnegard self-assigned this Feb 26, 2026
Copy link
Contributor

Copilot AI left a 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 implements a unified multileg flight aggregation system that replaces the previous merged flights approach with a chain-based model. The new implementation handles direct flights (2 stops), multi-leg flights (3+ stops), and circular routes uniformly by stitching individual arrival/departure records into complete flight chains.

Changes:

  • Introduced UnifiedFlight and FlightStop models to represent flight chains with multiple stops
  • Implemented fetchUnifiedFlights() method that groups flights by ID+date and stitches legs chronologically
  • Added mapUnifiedFlightsToSiri() in SiriETMapper to convert unified flights to SIRI format
  • Updated /siri endpoint to use the new unified flight aggregation system
  • Added comprehensive test suite covering direct, multi-leg, circular, and edge-case scenarios
  • Added Svalbard (LYR) airport handling (classified as international by Avinor but treated as domestic)

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main/kotlin/model/UnifiedFlight.kt New model classes for representing flight chains with multiple stops and status tracking per stop
src/main/kotlin/service/FlightAggregationService.kt Implements flight chain stitching logic with gap detection, origin/destination inference, and time window filtering
src/main/kotlin/siri/SiriETMapper.kt Adds unified flight to SIRI mapping with route hash computation, status handling, and fully-cancelled flight detection
src/main/kotlin/Endpoint.kt Updates /siri endpoint to use new fetchUnifiedFlights() instead of fetchAllMergedFlightsAsList()
src/main/kotlin/constants.kt Adds SVALBARD_AIRPORTS constant for special handling of Svalbard routes
src/main/kotlin/Main.kt Updates scanBasePackages from "routes.api" to "routes" (cosmetic change with no functional impact)
src/test/kotlin/service/FlightAggregationServiceTest.kt Comprehensive test suite covering direct flights, multi-leg flights, circular routes, gap detection, missing data inference, and Svalbard classification

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Williamjondahl Williamjondahl self-assigned this Feb 27, 2026
Copy link
Collaborator

@NiriLorentzen NiriLorentzen left a comment

Choose a reason for hiding this comment

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

Should have some more comments to explain the flow better, otherwise nice code.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
73.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Collaborator

@NiriLorentzen NiriLorentzen left a comment

Choose a reason for hiding this comment

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

My comments seem to have been resolved, lgtm

@CarlAndreasArnegard CarlAndreasArnegard merged commit 66d7555 into main Mar 2, 2026
7 of 8 checks passed
@CarlAndreasArnegard CarlAndreasArnegard deleted the multileg-unified-implementation-test branch March 2, 2026 14:42
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.

4 participants