Skip to content

fix: give GTFS-RT feeds their own location group rows - #1903

Merged
cka-y merged 2 commits into
mainfrom
fix/rt-feed-location-groups
Nov 17, 2026
Merged

cka-y merged 2 commits into
mainfrom
fix/rt-feed-location-groups

Conversation

@cka-y

@cka-y cka-y commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

update_feed_location gave a schedule feed's GTFS-RT feeds the schedule feed's own feedosmlocationgroup objects. With the delete-orphan cascade on Feed.feedosmlocationgroups, a schedule feed with realtime feeds gets no location groups, and neither do its realtime feeds. Rows that already existed move to the realtime feed on the next run and are dropped on the run after. Found while reviewing #1884.

Active feeds on prod:

GTFS feeds with stop points Feeds Without location groups
No realtime feed 2,581 23
Has a realtime feed 700 682
GTFS-RT feeds Feeds Without location groups
Schedule feed geolocated 1,767 1,753
Schedule feed not geolocated 43 43
No schedule feed 191 191

So 99% of active realtime feeds whose schedule feed was geolocated have no location groups.

  • Each feed now gets its own rows.
  • fix_rt_feed_location_groups.sql copies schedule feeds' groups to their realtime feeds.
  • After deploy, run reverse_geolocation_batch with include_only_unprocessed: false: the affected schedule feeds already have stop points, so the default run skips them.

Expected behavior:

After reverse geolocation, a schedule feed and each of its realtime feeds have the same location groups.

Testing tips:

./scripts/api-tests.sh --folder functions-python/reverse_geolocation. The new test fails on main.

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

Reverse geolocation reused the schedule feed's feedosmlocationgroup rows for
its realtime feeds, which moved them to the last realtime feed and made later
runs fail. Each feed now gets its own rows, stale groups are deleted, and a
changeset backfills realtime feeds from their schedule feeds.
@cka-y
cka-y marked this pull request as ready for review November 16, 2026 14:49

@davidgamez davidgamez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@cka-y
cka-y merged commit ae18bcc into main Nov 17, 2026
24 of 25 checks passed
@cka-y
cka-y deleted the fix/rt-feed-location-groups branch November 17, 2026 15:31
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.

2 participants