Modern Apps git

← Modern-Apps.git

maps: bake the MOTIS stop id into the transit pack (TRX2 v5)

Commit
7a77bc9352b454a849a1da0806eec29e2471f307
Author
vayun-mathur <[email protected]>
When
2026-08-21 02:04 UTC (3 months ago)
Parents
584ea16
Adds two additive sections, FEED_MOTIS_PREFIX (23) and STOP_GTFS_ID (24), which compose into a Transitous stop id like us-ca-SF-bayarea_901201. That is what will let the realtime /stoptimes overlay name a stop once /map/stops is gone, with no network round-trip. They are parallel u32 STRINGS offsets rather than new StopRec fields because StopRec is a packed 16-byte stride indexed by arithmetic, so widening it would invalidate every existing pack. stop_id was previously read and discarded -- it only survived as a stop_code fallback -- so it is now interned explicitly. VERSION_MIN stays 3: v3 and v4 packs still load and motis_stop_id() returns None.

Diff

maps/src/main/rust/src/transit.rs
diff --git a/maps/src/main/rust/src/transit.rs b/maps/src/main/rust/src/transit.rsindex 08bbb5f6da..0540c28d10 100644--- a/maps/src/main/rust/src/transit.rs+++ b/maps/src/main/rust/src/transit.rs@@ -1,10 +1,16 @@ //! On-device transit index loader + RAPTOR journey planner (P11b / world pack). //! //! Consumes the compact `.transit` index produced by the host tool-//! `scripts/maps/gtfs_ingest` (P11a). The on-disk layout (format v4 "TRX2") is+//! `scripts/maps/gtfs_ingest` (P11a). The on-disk layout (format v5 "TRX2") is //! documented at the top of that tool's `src/index.rs` and MUST stay in sync //! with the section constants and record accessors here. //!+//! v5 adds two sections (23-24) holding a per-feed Transitous id prefix and each+//! stop's raw GTFS `stop_id`, which compose into a MOTIS stop id+//! (`us-ca-SF-bayarea_901201`). That is what lets the realtime `/stoptimes`+//! overlay name a stop without the `/map/stops` coordinate lookup. v3 and v4+//! packs are still accepted and simply report no MOTIS ids.+//! //! v4 adds three sections (20-22) carrying GTFS `shapes.txt` geometry, so a ride //! leg draws the vehicle's real path instead of a line through its stops. v3 //! packs are still accepted and fall back to stop-to-stop geometry.@@ -32,7 +38,7 @@ use std::collections::HashMap; // --- Format constants (mirror scripts/maps/gtfs_ingest/src/index.rs) --- const MAGIC: u32 = 0x5452_4958; // "TRIX" /// Newest format this reader understands.-const VERSION: u32 = 4;+const VERSION: u32 = 5; /// Oldest format still accepted. Reading both means an app update and a pack /// rebuild can land in either order without offline transit silently degrading /// to the online planner in between.@@ -40,8 +46,8 @@ const VERSION_MIN: u32 = 3; pub const NONE: u32 = 0xFFFF_FFFF; const HEADER_LEN: usize = 80; /// Section count of the newest format. The section directory is sized to this-/// and a v3 pack simply leaves the trailing entries empty.-const SECTION_COUNT: usize = 23;+/// and an older pack simply leaves the trailing entries empty.+const SECTION_COUNT: usize = 25; const SECTION_COUNT_V3: usize = 20;  const SEC_STRINGS: usize = 0;@@ -67,6 +73,8 @@ const SEC_STOP_ROUTE_POS: usize = 19; const SEC_SHAPE_COORDS: usize = 20; const SEC_ROUTE_SHAPE_IDX: usize = 21; const SEC_ROUTE_STOP_SHAPE: usize = 22;+const SEC_FEED_MOTIS_PREFIX: usize = 23;+const SEC_STOP_GTFS_ID: usize = 24;  const WALK_SPEED_M_S: f64 = 1.33; /// Access/egress radius: how far we will walk to the first / from the last stop.@@ -251,10 +259,10 @@ impl TransitIndex {     }      /// Validate the TRX2 header + section directory. A pack whose version this-    /// build does not know is rejected here, which is what lets the Kotlin side-    /// fall back to the online planner instead of misreading it. Versions+    /// build does not know is rejected here, which is what lets the caller treat+    /// offline transit as unavailable rather than misread it. Versions     /// `VERSION_MIN..=VERSION` are all accepted; the directory is sized from the-    /// header's own `section_count`, so a v3 pack loads with the v4-only+    /// header's own `section_count`, so an older pack loads with the newer     /// sections left empty and every read of them gated on a non-zero length.     fn parse(backing: Backing) -> Option<TransitIndex> {         if backing.len() < HEADER_LEN {@@ -653,6 +661,63 @@ impl TransitIndex {         self.read_str(off)     } +    /// Transitous id prefix of feed `feed_idx` (`us-ca-SF-bayarea`), or `None` on+    /// a pre-v5 pack or a feed whose prefix the build did not know.+    fn feed_motis_prefix_of(&self, feed_idx: u32) -> Option<String> {+        if feed_idx >= self.feed_count {+            return None;+        }+        // v3/v4 packs carry no such section; its length is the version gate.+        if self.sec[SEC_FEED_MOTIS_PREFIX].1 < (self.feed_count as usize) * 4 {+            return None;+        }+        let off =+            unsafe { read_at::<u32>(self.sec_ptr(SEC_FEED_MOTIS_PREFIX), feed_idx as usize) };+        if off == NONE {+            return None;+        }+        let prefix = self.read_str(off);+        if prefix.is_empty() {+            None+        } else {+            Some(prefix)+        }+    }++    /// MOTIS/Transitous stop id for `stop_idx`, composed as+    /// `<feed prefix>_<gtfs stop_id>` (e.g. `us-ca-SF-bayarea_901201`). This is+    /// what the realtime overlay passes to `/stoptimes`, so it replaces the+    /// coordinate-to-id round trip through `/map/stops`.+    ///+    /// `None` on a pre-v5 pack, or when the feed's prefix was unknown at build+    /// time. `StopRec` carries no `feed_idx` — only `RouteRec` does — so the feed+    /// is resolved through a route serving the stop, as [`Self::timezone_at`] does.+    pub fn motis_stop_id(&self, stop_idx: u32) -> Option<String> {+        if stop_idx >= self.stop_count {+            return None;+        }+        if self.sec[SEC_STOP_GTFS_ID].1 < (self.stop_count as usize) * 4 {+            return None;+        }+        let id_off =+            unsafe { read_at::<u32>(self.sec_ptr(SEC_STOP_GTFS_ID), stop_idx as usize) };+        if id_off == NONE {+            return None;+        }+        let gtfs_id = self.read_str(id_off);+        if gtfs_id.is_empty() {+            return None;+        }+        let (rs, re) = self.stop_routes_range(stop_idx);+        for i in rs..re {+            let feed_idx = self.route(self.stop_route(i)).feed_idx;+            if let Some(prefix) = self.feed_motis_prefix_of(feed_idx) {+                return Some(format!("{prefix}_{gtfs_id}"));+            }+        }+        None+    }+     /// IANA timezone of the feed covering `(lat, lon)`, resolved via the nearest     /// stop and one of the routes serving it. Stops carry no `feed_idx` — only     /// `RouteRec` does — so the route hop is required. Empty when nothing is@@ -1533,6 +1598,8 @@ mod tests {         lon: f64,         name: &'static str,         code: &'static str,+        /// Raw GTFS `stop_id`, baked into v5's STOP_GTFS_ID section.+        gtfs_id: &'static str,     }      struct Trip {@@ -1574,8 +1641,9 @@ mod tests {         services: Vec<Service>,         /// `(service_idx, yyyymmdd, added)`, in any order.         exceptions: Vec<(u32, u32, u32)>,-        /// `(feed name, IANA timezone)`.-        feeds: Vec<(&'static str, &'static str)>,+        /// `(feed name, IANA timezone, Transitous MOTIS prefix)`. An empty prefix+        /// reproduces a feed whose id space the build could not derive.+        feeds: Vec<(&'static str, &'static str, &'static str)>,     }      #[derive(Default)]@@ -1627,14 +1695,15 @@ mod tests {      impl Pack {         /// Serialize to a TRX2 blob at `version`. Overridable so both a-        /// stale-pack rejection and the v3-still-parses guard can be tested;-        /// below v4 the shape sections are omitted entirely.+        /// stale-pack rejection and the older-format guards can be tested; below+        /// v4 the shape sections are omitted, below v5 the MOTIS id sections are.         fn build_with_version(&self, version: u32) -> Vec<u8> {             let mut pool = Pool::new();             let pack_name_off = pool.intern("testpack");              let n_stops = self.stops.len();             let mut sec_stops = Vec::new();+            let mut sec_stop_gtfs_id = Vec::new();             let (mut min_lat, mut min_lon) = (i32::MAX, i32::MAX);             let (mut max_lat, mut max_lon) = (i32::MIN, i32::MIN);             let lat_e7: Vec<i32> = self.stops.iter().map(|s| (s.lat * 1e7) as i32).collect();@@ -1652,6 +1721,8 @@ mod tests {                 let c = pool.intern(s.code);                 u32b(&mut sec_stops, n);                 u32b(&mut sec_stops, c);+                let g = pool.intern(s.gtfs_id);+                u32b(&mut sec_stop_gtfs_id, g);             }              // Profiles, deduplicated by encoded body exactly as the writer does.@@ -1858,11 +1929,14 @@ mod tests {              let mut sec_feeds = Vec::new();             let mut sec_feed_tz = Vec::new();-            for &(name, tz) in &self.feeds {+            let mut sec_feed_motis_prefix = Vec::new();+            for &(name, tz, motis) in &self.feeds {                 let n = pool.intern(name);                 let t = pool.intern(tz);+                let m = pool.intern(motis);                 u32b(&mut sec_feeds, n);                 u32b(&mut sec_feed_tz, t);+                u32b(&mut sec_feed_motis_prefix, m);             }              let mut sections: Vec<&[u8]> = vec![@@ -1895,6 +1969,11 @@ mod tests {                 sections.push(&sec_route_shape_idx);                 sections.push(&sec_route_stop_shape);             }+            // Likewise the MOTIS id sections exist only from v5.+            if version >= 5 {+                sections.push(&sec_feed_motis_prefix);+                sections.push(&sec_stop_gtfs_id);+            }             let section_count = sections.len();              let align = |o: usize| (o + 7) & !7;@@ -1953,9 +2032,9 @@ mod tests {     fn one_route_pack() -> Pack {         Pack {             stops: vec![-                Stop { lat: 37.700, lon: -122.400, name: "Alpha", code: "A1" },-                Stop { lat: 37.710, lon: -122.400, name: "Beta", code: "B2" },-                Stop { lat: 37.720, lon: -122.400, name: "Gamma", code: "C3" },+                Stop { lat: 37.700, lon: -122.400, name: "Alpha", code: "A1", gtfs_id: "901201" },+                Stop { lat: 37.710, lon: -122.400, name: "Beta", code: "B2", gtfs_id: "901202" },+                Stop { lat: 37.720, lon: -122.400, name: "Gamma", code: "C3", gtfs_id: "901203" },             ],             routes: vec![Route {                 name: "N",@@ -1981,7 +2060,7 @@ mod tests {             }],             services: vec![weekdays()],             exceptions: Vec::new(),-            feeds: vec![("sfmuni", "America/Los_Angeles")],+            feeds: vec![("sfmuni", "America/Los_Angeles", "us-ca-SFMTA")],         }     } @@ -2310,10 +2389,10 @@ mod tests {         // Two feeds in two zones, far enough apart that the grid separates them.         let pack = Pack {             stops: vec![-                Stop { lat: 37.700, lon: -122.400, name: "West1", code: "W1" },-                Stop { lat: 37.710, lon: -122.400, name: "West2", code: "W2" },-                Stop { lat: 40.700, lon: -74.000, name: "East1", code: "E1" },-                Stop { lat: 40.710, lon: -74.000, name: "East2", code: "E2" },+                Stop { lat: 37.700, lon: -122.400, name: "West1", code: "W1", gtfs_id: "W001" },+                Stop { lat: 37.710, lon: -122.400, name: "West2", code: "W2", gtfs_id: "W002" },+                Stop { lat: 40.700, lon: -74.000, name: "East1", code: "E1", gtfs_id: "E001" },+                Stop { lat: 40.710, lon: -74.000, name: "East2", code: "E2", gtfs_id: "E002" },             ],             routes: vec![                 Route {@@ -2348,8 +2427,8 @@ mod tests {             services: vec![weekdays()],             exceptions: Vec::new(),             feeds: vec![-                ("sfmuni", "America/Los_Angeles"),-                ("mta", "America/New_York"),+                ("sfmuni", "America/Los_Angeles", "us-ca-SFMTA"),+                ("mta", "America/New_York", "us-ny-MTA"),             ],         };         let idx = pack.index();@@ -2370,8 +2449,8 @@ mod tests {      #[test]     fn a_v3_pack_still_parses_and_plans() {-        // The rollout guard: a device on the v4 reader must keep serving offline-        // transit from a v3 pack instead of silently falling back to MOTIS.+        // The rollout guard: a device on the newest reader must keep serving+        // offline transit from a v3 pack rather than rejecting it.         let pack = shaped_route_pack();         let idx = TransitIndex::from_bytes(pack.build_with_version(VERSION_MIN))             .expect("a v3 pack still loads");@@ -2385,6 +2464,39 @@ mod tests {         );     } +    #[test]+    fn a_v5_pack_composes_motis_stop_ids() {+        let idx = one_route_pack().index();+        // <feed prefix>_<raw gtfs stop_id>, the id `/stoptimes` expects. Note it is+        // the stop_id and not `code` ("A1"), which is a different GTFS column.+        assert_eq!(idx.motis_stop_id(0).as_deref(), Some("us-ca-SFMTA_901201"));+        assert_eq!(idx.motis_stop_id(2).as_deref(), Some("us-ca-SFMTA_901203"));+        // Out of range rather than a panic or a bogus id.+        assert_eq!(idx.motis_stop_id(99), None);+    }++    #[test]+    fn pre_v5_packs_report_no_motis_stop_id() {+        // The two id sections are absent, so the accessor must degrade to None+        // instead of reading whatever follows the shape sections.+        let pack = one_route_pack();+        for version in [VERSION_MIN, 4] {+            let idx = TransitIndex::from_bytes(pack.build_with_version(version))+                .expect("an older pack still loads");+            assert_eq!(idx.motis_stop_id(0), None, "v{version} carries no MOTIS ids");+        }+    }++    #[test]+    fn a_feed_with_no_known_prefix_reports_no_motis_stop_id() {+        // build_world_transit.sh mangles feed names, so its packs cannot name a+        // Transitous source; those stops must simply have no id.+        let mut pack = one_route_pack();+        pack.feeds = vec![("sfmuni", "America/Los_Angeles", "")];+        let idx = pack.index();+        assert_eq!(idx.motis_stop_id(0), None);+    }+     #[test]     fn a_ride_leg_follows_the_gtfs_shape() {         let pack = shaped_route_pack();
scripts/maps/gtfs_ingest/src/index.rs
diff --git a/scripts/maps/gtfs_ingest/src/index.rs b/scripts/maps/gtfs_ingest/src/index.rsindex 08949bed20..37805220d5 100644--- a/scripts/maps/gtfs_ingest/src/index.rs+++ b/scripts/maps/gtfs_ingest/src/index.rs@@ -1,10 +1,19 @@ //! Build the compact **world** transit index from parsed GTFS tables (possibly //! merged from many feeds) and serialize it to the on-disk `.transit` format. //!-//! ON-DISK FORMAT v4 ("TRX2", little-endian, mmap-friendly, read via+//! ON-DISK FORMAT v5 ("TRX2", little-endian, mmap-friendly, read via //! `read_unaligned` on device). THIS LAYOUT MUST STAY IN SYNC WITH //! `maps/src/main/rust/src/transit.rs`. //!+//! v5 is v4 plus two purely additive sections (23-24) that let the device name a+//! stop in Transitous/MOTIS's own id space without a network round-trip, which is+//! what keeps the realtime `/stoptimes` overlay working now that the+//! `/map/stops` coordinate-to-id lookup is gone. A MOTIS stop id is+//! `<registry-file>-<source name>_<gtfs stop_id>`, so it is composed on device+//! from a per-feed prefix and the raw `stop_id`. They are parallel `u32` STRINGS+//! offsets rather than new `StopRec` fields because `StopRec` is a packed 16-byte+//! stride indexed by arithmetic — widening it would invalidate every older pack.+//! //! v4 is v3 plus three purely additive sections (20-22) carrying GTFS //! `shapes.txt` geometry, so a ride leg draws the path the vehicle actually //! takes — and reports a truthful distance — instead of a line through its@@ -33,7 +42,7 @@ //!     one pack without id collisions (ids are namespaced per feed at build). //! //! Header (80 bytes; all u32/i32 little-endian):-//!   u32 magic (MAGIC), u32 version (VERSION=4), u32 section_count,+//!   u32 magic (MAGIC), u32 version (VERSION=5), u32 section_count, //!   u32 stop_count, u32 route_count, u32 trip_count, u32 service_count, //!   u32 profile_count, u32 feed_count, u32 grid_cell_count, u32 feed_name_off, //!   i32 min_lat_e7, i32 min_lon_e7, i32 max_lat_e7, i32 max_lon_e7,@@ -103,15 +112,24 @@ //!                        vertex index within its route's shape (NONE when the //!                        route has none). Non-decreasing within a route, so the //!                        device can slice `shape[vertex(board)..=vertex(alight)]`.+//!  23  FEED_MOTIS_PREFIX u32[feed_count] STRINGS offsets holding each feed's+//!                        Transitous id prefix (`us-ca-SF-bayarea`), or NONE when+//!                        the build did not know it. Interned, so the prefix costs+//!                        one pool entry shared by every stop in that feed.+//!  24  STOP_GTFS_ID    u32[stop_count] STRINGS offsets holding each stop's raw+//!                        GTFS `stop_id`. Joined to the prefix with `_` to form a+//!                        MOTIS stop id. Kept separate from `StopRec.code_off`,+//!                        which falls back to `stop_id` only when `stop_code` is+//!                        blank and so cannot be relied on.  use crate::gtfs::{parse_gtfs_date, parse_gtfs_time, Csv, Shape}; use crate::shapes; use std::collections::HashMap;  pub const MAGIC: u32 = 0x5452_4958; // "TRIX"-pub const VERSION: u32 = 4;+pub const VERSION: u32 = 5; pub const NONE: u32 = 0xFFFF_FFFF;-pub const SECTION_COUNT: usize = 23;+pub const SECTION_COUNT: usize = 25; pub const HEADER_LEN: usize = 80;  const MAX_TRANSFER_M: f64 = 400.0;@@ -179,6 +197,11 @@ struct StopTime { /// their GTFS ids are namespaced by feed so they never collide. pub struct FeedInput<'a> {     pub name: String,+    /// Transitous id prefix for this feed (`us-ca-SF-bayarea`), used to compose+    /// MOTIS stop ids on device. Empty when the caller does not know it (the+    /// world build mangles feed names), which writes NONE and makes the device+    /// accessor return `None`.+    pub motis_prefix: String,     pub stops: &'a Csv,     pub routes: &'a Csv,     pub trips: &'a Csv,@@ -290,6 +313,8 @@ pub fn build_index(     let mut stop_lon: Vec<i32> = Vec::new();     let mut stop_name_off: Vec<u32> = Vec::new();     let mut stop_code_off: Vec<u32> = Vec::new();+    // Raw GTFS `stop_id` per stop, for composing MOTIS ids on device (v5).+    let mut stop_gtfs_id_off: Vec<u32> = Vec::new();     let (mut min_lat, mut min_lon) = (i32::MAX, i32::MAX);     let (mut max_lat, mut max_lon) = (i32::MIN, i32::MIN); @@ -302,6 +327,7 @@ pub fn build_index(      let mut feed_name_offs: Vec<u32> = Vec::new();     let mut feed_tz_offs: Vec<u32> = Vec::new();+    let mut feed_motis_prefix_offs: Vec<u32> = Vec::new();     let mut raptor_routes: Vec<RaptorRoute> = Vec::new();     let mut built_trips: Vec<BuiltTrip> = Vec::new();     // `shapes.txt` polylines from every feed, keyed "feed|shape_id" so ids from@@ -318,6 +344,8 @@ pub fn build_index(             .and_then(|a| a.rows.first().map(|row| a.get(row, "agency_timezone").trim()))             .unwrap_or("");         feed_tz_offs.push(pool.intern(tz));+        // Interned once per feed, so every stop's MOTIS id shares this entry.+        feed_motis_prefix_offs.push(pool.intern(feed.motis_prefix.trim()));          // --- Stops (this feed) -> global indices ---         let mut stop_id_to_idx: HashMap<String, u32> = HashMap::new();@@ -341,6 +369,9 @@ pub fn build_index(             stop_lon.push(lon_e7);             stop_name_off.push(pool.intern(name));             stop_code_off.push(pool.intern(if code.is_empty() { id } else { code }));+            // Interned explicitly: `code_off` above falls back to `stop_id` only+            // when `stop_code` is blank, so it cannot stand in for the real id.+            stop_gtfs_id_off.push(pool.intern(id));             min_lat = min_lat.min(lat_e7);             min_lon = min_lon.min(lon_e7);             max_lat = max_lat.max(lat_e7);@@ -874,6 +905,14 @@ pub fn build_index(     for &off in &feed_tz_offs {         append_u32(&mut sec_feed_tz, off);     }+    let mut sec_feed_motis_prefix = Vec::with_capacity(feed_motis_prefix_offs.len() * 4);+    for &off in &feed_motis_prefix_offs {+        append_u32(&mut sec_feed_motis_prefix, off);+    }+    let mut sec_stop_gtfs_id = Vec::with_capacity(stop_gtfs_id_off.len() * 4);+    for &off in &stop_gtfs_id_off {+        append_u32(&mut sec_stop_gtfs_id, off);+    }      // --- Assemble file: header + directory + aligned sections ---     let section_names: [&'static str; SECTION_COUNT] = [@@ -900,6 +939,8 @@ pub fn build_index(         "SHAPE_COORDS",         "ROUTE_SHAPE_IDX",         "ROUTE_STOP_SHAPE",+        "FEED_MOTIS_PREFIX",+        "STOP_GTFS_ID",     ];     let sections: [&[u8]; SECTION_COUNT] = [         &pool.bytes,@@ -925,6 +966,8 @@ pub fn build_index(         &sec_shape_coords,         &sec_route_shape_idx,         &sec_route_stop_shape,+        &sec_feed_motis_prefix,+        &sec_stop_gtfs_id,     ];      let dir_len = SECTION_COUNT * 16;@@ -1122,6 +1165,14 @@ mod tests {             let s = self.sec_bytes(17);             self.read_str(ru32(s, feed_idx as usize * 4))         }+        fn feed_motis_prefix(&self, feed_idx: u32) -> String {+            let s = self.sec_bytes(23);+            self.read_str(ru32(s, feed_idx as usize * 4))+        }+        fn stop_gtfs_id(&self, stop_idx: u32) -> String {+            let s = self.sec_bytes(24);+            self.read_str(ru32(s, stop_idx as usize * 4))+        }         /// (service_idx, date, added) exceptions for one service, via the CSR.         fn service_exceptions(&self, service_idx: u32) -> Vec<(u32, u32, u32)> {             let idx = self.sec_bytes(18);@@ -1361,6 +1412,7 @@ mod tests {         let feeds = vec![             FeedInput {                 name: "sfmuni".to_string(),+                motis_prefix: "us-ca-SFMTA".to_string(),                 stops: &as_,                 routes: &ar,                 trips: &at,@@ -1372,6 +1424,9 @@ mod tests {             },             FeedInput {                 name: "actransit".to_string(),+                // Left empty on purpose: a feed whose MOTIS prefix the build does+                // not know must still produce a valid pack.+                motis_prefix: String::new(),                 stops: &bs,                 routes: &br,                 trips: &bt,@@ -1403,6 +1458,20 @@ mod tests {         // v3: per-feed IANA timezone from agency.txt.         assert_eq!(r.feed_tz(0), "America/Los_Angeles");         assert_eq!(r.feed_tz(1), "America/New_York");+        // v5: the Transitous prefix and raw stop_ids that compose a MOTIS stop id.+        assert_eq!(r.feed_motis_prefix(0), "us-ca-SFMTA");+        assert_eq!(r.feed_motis_prefix(1), "", "a feed with no known prefix writes NONE");+        // Feed A's stops come first, so 0..3 are its stop_ids. These are the raw+        // `stop_id` column, NOT `stop_code` ("A1"), which STOPS.code_off holds.+        assert_eq!(r.stop_gtfs_id(0), "S1");+        assert_eq!(r.stop_gtfs_id(1), "S2");+        assert_eq!(r.stop_gtfs_id(2), "S3");+        assert_ne!(+            r.sec_bytes(23).len(),+            0,+            "FEED_MOTIS_PREFIX must be populated so the manifest proves v5 landed"+        );+        assert_eq!(r.sec_bytes(24).len(), 5 * 4, "STOP_GTFS_ID is u32[stop_count]");          // Route 0 = feed A's N-Judah. Decode its trips + profile.         let rec0 = r.route(0);@@ -1542,6 +1611,7 @@ mod tests {     ) -> Vec<FeedInput<'a>> {         vec![FeedInput {             name: "sfmuni".to_string(),+            motis_prefix: "us-ca-SFMTA".to_string(),             stops: &t.0,             routes: &t.1,             trips: &t.2,
scripts/maps/gtfs_ingest/src/main.rs
diff --git a/scripts/maps/gtfs_ingest/src/main.rs b/scripts/maps/gtfs_ingest/src/main.rsindex 51016fcaf7..e260f40337 100644--- a/scripts/maps/gtfs_ingest/src/main.rs+++ b/scripts/maps/gtfs_ingest/src/main.rs@@ -178,6 +178,9 @@ fn run(out_dir: &Path, pack_name: &str, specs: &[(String, PathBuf)]) -> Result<(         .iter()         .map(|t| FeedInput {             name: t.name.clone(),+            // Phase 3 plumbs the real Transitous source name through the manifest;+            // empty writes NONE, which makes the device accessor return None.+            motis_prefix: String::new(),             stops: &t.stops,             routes: &t.routes,             trips: &t.trips,