Repository navigation
fix: empty RT entity types - #1856
Merged
Merged
Conversation
davidgamez
commented
Oct 6, 2026
| description: Unique identifier of the GTFS feed. | ||
| example: mdb-123 | ||
| latest_state: | ||
| $ref: "#/components/schemas/GtfsFeedContinuousCoverage" |
Member
Author
There was a problem hiding this comment.
Changes in the operations API are missing updates from the previous PRs.
davidgamez
marked this pull request as ready for review
October 6, 2026 14:56
cka-y
approved these changes
Oct 6, 2026
| # An empty cell leaves the stored entity types alone. | ||
| self.logger.warning(f"Entity types array is empty for feed {stable_id}") | ||
| feed.entitytypes.clear() | ||
| return |
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.
Summary:
Fixes #1847. GTFS-RT feeds with a blank entity type returned HTTP 500 on every access path, and broke any
/v1/searchpage spanning them.process_entity_typesinapi/src/scripts/populate_db_gtfs.pysplit theentity_typecell with"".split("-"), which returns[""]rather than[]. The loop therefore ran once with an empty token and createdEntitytype(name=""); theelsebranch was dead code. The generated models validateentity_typesagainst thevp/tu/saenum fromDatabaseCatalogAPI.yaml, so a blank name failed serialization for the feed and for every unrelated feed on the same page.Three layers:
normalize_entity_typestrims, lowercases, drops blanks, dedupes, and keeps onlyEntityTypemembers (warn + skip otherwise). Entity types are replaced only when the normalized list is non-empty, preserving the existing "empty cell does not wipe" convention.liquibase/changes/fix_empty_entity_types.sql) — deletes blankentitytypefeedthenentitytyperows, addsCHECK (name IN ('vp','tu','sa')), refreshesfeedsearch.VP | sa), and a partly invalid cell (tu-bogus), plus a DB-wide assertion that no blank entity type names exist.Expected behavior:
GET /v1/search?data_type=gtfs_rt&limit=100&offset=0no longer 500s.entity_typecell in the catalog CSV produces noentitytyperow;VP | sayields["vp","sa"],tu-bogusyields["tu"]with a logged warning.INSERT INTO entitytype(name) VALUES ('')is rejected by the DB.No public API surface change. Note:
get_gtfs_rt_feeds_queryinner-joinsEntitytype, so the two fixed feeds stay out of the/v1/gtfs_rt_feedslist endpoint until they have real entity types (pre-existing behaviour, not changed here).Testing tips:
After deploy, confirm
GET /v1/gtfs_rt_feeds/mdb-3438,mdb-3439, and a full-catalog paginated crawl of/v1/search?data_type=gtfs_rt../scripts/api-tests.shto make sure you didn't break anything