Problem
trips-for-route currently hardcodes the activity window used to include active trips around the current time:
runningLateWindow = 30 minutes
runningEarlyWindow = 10 minutes
These values are defined directly in trips_for_route_handler.go (line 66) with a TODO noting that Maglev should support config for these values like the Java OBA server.
Because the values are hardcoded, agencies cannot tune how aggressively Maglev includes trips that are slightly late, slightly early, or running past midnight.
Scenario
A transit agency wants trips-for-route to behave differently from the current defaults:
- Agency operates frequent service with longer real-world delay tails
- Vehicles commonly remain relevant beyond the fixed 30-minute late window
- Or the agency wants stricter matching and does not want trips included 10 minutes early
At the moment, changing this behavior requires a code change instead of a configuration change.
Impact
This affects behavioral parity and deployability:
- Maglev cannot yet match agency-specific or Java OBA-like tuning for
trips-for-route
- Operators cannot adjust trip visibility behavior without rebuilding the server
- Small differences in these windows can change which trips appear active near schedule boundaries and after midnight
Current Code
In trips_for_route_handler.go (line 66), the handler currently uses:
runningLateNanos = 30 minutes
runningEarlyNanos = 10 minutes
There is also a TODO indicating these values should come from configuration.
Suggested Fix
Add configuration for these windows while preserving current behavior as defaults.
Possible Approach
- Add
running-late-window and running-early-window fields to config
- Keep defaults at:
30m (late window)
10m (early window)
- Wire these values through application config into the REST handler
- Update tests to cover:
- Default values
- Custom configured values
- Document the new config fields in the README / config schema
Problem
trips-for-routecurrently hardcodes the activity window used to include active trips around the current time:runningLateWindow = 30 minutesrunningEarlyWindow = 10 minutesThese values are defined directly in
trips_for_route_handler.go(line 66) with a TODO noting that Maglev should support config for these values like the Java OBA server.Because the values are hardcoded, agencies cannot tune how aggressively Maglev includes trips that are slightly late, slightly early, or running past midnight.
Scenario
A transit agency wants
trips-for-routeto behave differently from the current defaults:At the moment, changing this behavior requires a code change instead of a configuration change.
Impact
This affects behavioral parity and deployability:
trips-for-routeCurrent Code
In
trips_for_route_handler.go(line 66), the handler currently uses:runningLateNanos = 30 minutesrunningEarlyNanos = 10 minutesThere is also a TODO indicating these values should come from configuration.
Suggested Fix
Add configuration for these windows while preserving current behavior as defaults.
Possible Approach
running-late-windowandrunning-early-windowfields to config30m(late window)10m(early window)