Skip to content

Additional guards and checks for Flex trips#538

Merged
irees merged 7 commits intomainfrom
no-route-geoms-for-flex
Dec 13, 2025
Merged

Additional guards and checks for Flex trips#538
irees merged 7 commits intomainfrom
no-route-geoms-for-flex

Conversation

@drewda
Copy link
Copy Markdown
Member

@drewda drewda commented Dec 12, 2025

Copilot AI review requested due to automatic review settings December 12, 2025 19:27
Copy link
Copy Markdown
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 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.AfterWrite to skip shapes with no coordinates, preventing index out of bounds panic
  • Adds a guard in createMissingShape to 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.

Copy link
Copy Markdown
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

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.

@irees irees changed the title guard against creating shapes for flex trips Additional guards and checks for Flex trips Dec 13, 2025
@irees irees merged commit 86e9fb3 into main Dec 13, 2025
6 checks passed
@irees irees deleted the no-route-geoms-for-flex branch December 13, 2025 02:17
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.

flex import failing on tlv2 production

3 participants