Additional guards and checks for Flex trips#538
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds defensive guards to prevent crashes when processing GTFS flex trips that use location_id or location_group_id instead of regular stop_id references. These flex trips can result in shapes with no valid coordinates, which would cause panics or errors in downstream processing.
- Adds a guard in
RouteGeometryBuilder.AfterWriteto skip shapes with no coordinates, preventing index out of bounds panic - Adds a guard in
createMissingShapeto return an error when no valid stops exist, preventing attempts to create invalid shapes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ext/builders/route_geometry_builder.go | Adds early return when processing shapes with zero coordinates to prevent panic when accessing the first point |
| copier/copier.go | Adds validation to skip shape generation for trips with no valid stop_ids (e.g., flex trips) and returns descriptive error |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes interline-io/calact-network-analysis-tool#258