Skip to content

Conversation

@t2gran
Copy link
Member

@t2gran t2gran commented Nov 14, 2025

Summary

This PR fixes a bug where extra journeys (GTFS ADDED trips / NeTEx ExtraJourney) were missing from arrival/departure boards. The root cause was that TimetableSnapshot.addPatternToIndex() was incorrectly checking if the stop pattern was modified in real-time, rather than checking if the pattern was created in real-time. This PR introduces a clearer distinction between real-time patterns with modified stop patterns (rerouted trips) and real-time patterns for completely new trips (added trips/extra journeys).

Changes

  • Two boolean flags distinguish different real-time pattern types:
    • realTimeTripPattern: True for any pattern created by real-time updates (rerouted OR added)
    • stopPatternChangedInRealTime: True only when a scheduled trip's stop pattern is modified. This is exactly
      the same as the previous createdByRealtimeUpdater flag.
  • TimetableSnapshot.addPatternToIndex() now uses isRealTimeTripPattern() to include all real-time patterns
  • Builder methods clarify intent:
    • withRealTimeStopPatternChanged(): For rerouted trips with modified stop patterns
    • withRealTimeAddedTrip(): For completely new trips (GTFS ADDED / NeTEx ExtraJourney)
    • : For scheduled trip patterns.

Core changes

  • TripPattern.java: Added dual flags, new methods, improved JavaDoc
  • TripPatternBuilder.java: New builder methods with clear semantics
  • TimetableSnapshot.java: Fixed index update logic (line 600)

Needs more investigation

  • The use of TripPattern#isStopPatternChangedInRealTime() in TransferIndexGenerator and RealTimeRaptorTransitDataUpdater should be investigated. It is probably better to use the more generic isRealTimeTripPattern() in these places, and than add logic for handling ADDED trips (even if that logic is just to ignore these cases). The code as is, is easy to misunderstand.

Build on top of #7130

Issue

Fixes #7008

Testing

  • ✅ Unit tests are updated
  • ✅ Test coverage includes both added trips and rerouted trips

Manual Testing

I have manually tested the case documented in the issue, before and after applying the fix.

Documentation

  • ✅ JavaDoc updated for all modified public methods
  • ✅ Added comprehensive documentation explaining the distinction between realTimeTripPattern and stopPatternChangedInRealTime
  • ✅ Added TODO comments highlighting areas for future improvement

Changelog

  • Should be included in changelog: This fixes a user-visible bug where added trips (GTFS ADDED / NeTEx ExtraJourney) were missing from arrival/departure boards.

Bumping the serialization version id

  • ✅ Needed because of the new flag in TripPattern

@t2gran t2gran added this to the 2.9 (next release) milestone Nov 14, 2025
@t2gran t2gran requested a review from a team as a code owner November 14, 2025 00:30
@t2gran t2gran added !Bug Apply to issues describing a bug and PRs witch fixes it. +Real-Time The issue/PR is related to RealTime updates Entur Test This is currently being tested at Entur labels Nov 14, 2025
@vpaturet vpaturet removed the Entur Test This is currently being tested at Entur label Nov 14, 2025
@habrahamsson-skanetrafiken habrahamsson-skanetrafiken marked this pull request as draft November 20, 2025 13:47
@t2gran t2gran force-pushed the show-extra-journeys-depature-board branch 2 times, most recently from 2bf1a28 to e2f35ad Compare December 8, 2025 14:11
@t2gran t2gran force-pushed the show-extra-journeys-depature-board branch from e2f35ad to 166e934 Compare December 16, 2025 18:40
@t2gran t2gran marked this pull request as ready for review December 16, 2025 18:41
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.09%. Comparing base (2891fc2) to head (e3abc5d).
⚠️ Report is 5 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...tripplanner/transit/model/network/TripPattern.java 71.42% 1 Missing and 1 partial ⚠️
...nsit/mappers/RealTimeRaptorTransitDataUpdater.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #7052      +/-   ##
=============================================
- Coverage      72.09%   72.09%   -0.01%     
- Complexity     20694    20695       +1     
=============================================
  Files           2244     2244              
  Lines          83899    83911      +12     
  Branches        8347     8348       +1     
=============================================
+ Hits           60488    60495       +7     
- Misses         20482    20485       +3     
- Partials        2929     2931       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@t2gran t2gran marked this pull request as draft December 17, 2025 00:20
@t2gran t2gran added the Entur Test This is currently being tested at Entur label Dec 17, 2025
@vpaturet vpaturet added +Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR and removed Entur Test This is currently being tested at Entur labels Dec 17, 2025
@leonardehrenfried
Copy link
Member

You have to resolve the conflicts, I'm afraid.

@t2gran t2gran added the Entur Test This is currently being tested at Entur label Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Bug Apply to issues describing a bug and PRs witch fixes it. +Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR Entur Test This is currently being tested at Entur +Real-Time The issue/PR is related to RealTime updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trips added in realtime-data (SIRI ET ExtraJourneys) do not appear in departure-/arrival boards

4 participants