Skip to content

Revert case-insensitive stop/route-ID comparisons to exact equality#1923

Merged
bmander merged 1 commit into
mainfrom
fix/1905-stop-id-case-sensitivity
Jul 17, 2026
Merged

Revert case-insensitive stop/route-ID comparisons to exact equality#1923
bmander merged 1 commit into
mainfrom
fix/1905-stop-id-case-sensitivity

Conversation

@bmander

@bmander bmander commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add adjacency-aware stop and route focus to the map #1865 introduced ignoreCase = true at six stop/route-ID comparison sites with no documented rationale, and Focused-trip data layer: stops-for-route fetched via two paths, shapes double-cached, focusedTrips in three copies #1908 later copied the same pattern into a seventh (HomeViewModel.focusedTrips). CLAUDE.md calls out "fuzzy string matching where an exact key exists" as a heuristic that needs human sign-off before merge; none exists here, and there's no wire evidence that OBA stop/route IDs vary in case.
  • It's also internally inconsistent: RouteMapController.focusStop already dedups stop-focus sessions via case-sensitive data-class equality, so a mixed-case ID could pass these gates while defeating that dedup — silent edge-only misbehavior.
  • Reverts all seven call sites to exact (==) equality: MapViewModel.showStopRoutes, HomeViewModel (focusedTrips, onStopFocused, onArrivalsLoaded, restoreMapAfterBack), and RouteRowGroup.resolveSelectedRouteGroupKey.

Fixes #1905

Test plan

  • ./gradlew :onebusaway-android:compileObaGoogleDebugKotlin -PwarningsAsErrors=true — compiles clean
  • ./gradlew :onebusaway-android:testObaGoogleDebugUnitTest --tests "org.onebusaway.android.ui.home.HomeViewModelTest" --tests "org.onebusaway.android.map.MapViewModelTest" --tests "org.onebusaway.android.ui.arrivals.*" — all pass (no test depended on case-insensitive matching)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved stop and route selection accuracy by requiring exact identifier matches.
    • Prevented arrival and trip information from being displayed or restored for similarly named but different stops or routes.
    • Ensured map and arrivals views remain synchronized with the precisely selected stop.

…1905)

#1865 introduced ignoreCase = true at six stop/route-id comparison sites with
no documented rationale, and #1908 copied the same pattern into a seventh
(HomeViewModel.focusedTrips). CLAUDE.md names fuzzy matching where an exact
key exists as a heuristic that needs human sign-off before merge; none exists
here, and there's no wire evidence OBA stop/route IDs vary in case. It's also
internally inconsistent: RouteMapController.focusStop already dedups stop
focus sessions via case-sensitive data-class equality, so a mixed-case ID
could pass these gates while defeating that dedup.

Revert all seven call sites to exact (==) equality: MapViewModel.showStopRoutes,
HomeViewModel (focusedTrips, onStopFocused, onArrivalsLoaded,
restoreMapAfterBack), and RouteRowGroup.resolveSelectedRouteGroupKey.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f5d4c97-8faa-44da-91f2-e4bde70788c9

📥 Commits

Reviewing files that changed from the base of the PR and between 01c0970 and 85c2972.

📒 Files selected for processing (3)
  • onebusaway-android/src/main/java/org/onebusaway/android/map/MapViewModel.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/arrivals/RouteRowGroup.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/HomeViewModel.kt

📝 Walkthrough

Walkthrough

Stop and route identifier comparisons across map, home, arrivals, and route-group state now use case-sensitive equality instead of case-insensitive matching.

Changes

Identity matching

Layer / File(s) Summary
Exact identifier checks
onebusaway-android/src/main/java/org/onebusaway/android/map/MapViewModel.kt, onebusaway-android/src/main/java/org/onebusaway/android/ui/home/HomeViewModel.kt, onebusaway-android/src/main/java/org/onebusaway/android/ui/arrivals/RouteRowGroup.kt
Stop and route matching now requires exact identifier equality for rendering stop routes, validating focused trips and arrivals, detecting repeated focus, restoring map state, and resolving route groups.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reverting case-insensitive ID comparisons to exact equality.
Linked Issues check ✅ Passed The PR matches #1905 by reverting the affected stop and route ID comparisons to exact equality.
Out of Scope Changes check ✅ Passed The changes are confined to the comparison-logic fix described in the linked issue and summary.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1905-stop-id-case-sensitivity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bmander
bmander merged commit 689fd56 into main Jul 17, 2026
3 checks passed
@bmander
bmander deleted the fix/1905-stop-id-case-sensitivity branch July 17, 2026 03:30
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.

Case-insensitive stop-ID comparison at six sites — unsanctioned heuristic, inconsistent with case-sensitive dedup

1 participant