Skip to content

Vehicle location > UUID > fallback to lat/lng if no ID/label - #211

Merged
mmathieum merged 6 commits into
masterfrom
mm/map_issue_marker_disapearing
Oct 28, 2026
Merged

mmathieum merged 6 commits into
masterfrom
mm/map_issue_marker_disapearing

Conversation

@mmathieum

Copy link
Copy Markdown
Member

- Use the vehicle's UUID as the key for the marker map, improving the performance of marker updates.
- Simplify the logic for clearing POI markers.
- Remove the fallback for generating a UUID for vehicles.
- Fix an issue where deselecting a marker did not correctly exit the click handler.
@mmathieum
mmathieum marked this pull request as ready for review October 26, 2026 15:38
@mmathieum
mmathieum requested a review from a team as a code owner October 26, 2026 15:38
@coderabbitai

ghost commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Vehicle location records now always provide a UUID. It is formed using the vehicle ID when available, otherwise the vehicle label, and falls back to the location’s coordinates when neither is available. This gives callers a consistent, non-null identifier across different vehicle data.

VehicleLocation.uuid is now non-null and uses an identifier derived from vehicleId, vehicleLabel, or coordinates. The baseline entry for the renamed backing property was removed. cursorRow was reformatted without changing its values or order.

Changes: Vehicle location UUID

Layer / File(s) Summary
UUID construction and model updates
src/main/java/org/mtransit/android/commons/provider/vehiclelocations/model/VehicleLocation.kt, detekt-baseline-debug.xml
VehicleLocation.uuid is lazily formed from the authority and an identifier. The identifier falls back from vehicleId to vehicleLabel to latitude-longitude. The baseline entry for _uid was removed. cursorRow formatting changed, but its values and order did not.

Priority: Normal

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

Change: Feature

Merge Risk: Low · up to c9f39

Vehicles with neither an ID nor a label get a position-based identifier that changes as they move. The app's map could then show stale or duplicate markers for such vehicles. Most data sources provide an ID or label, and the fallback is the intended behavior. The risk is limited to a narrow edge case and depends on how the app consumes the identifier.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title states the main change: the vehicle location UUID now falls back to latitude/longitude when no ID or label is available. The raw summary confirms that VehicleLocation.uuid uses vehicleId, th…
Description check Passed The description is a single link to mtransit-for-android PR #475. It is brief and gives no detail, but it relates to the changeset. The objectives also reference that linked PR, so the description is …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: the vehicle location UUID now falls back to latitude/longitude when no ID or label is available. The raw summary confirms that VehicleLocation.uuid uses vehicleId, then vehicleLabel, then a latitude-longitude fallback. The objectives describe the same change. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description is a single link to mtransit-for-android PR #475. It is brief and gives no detail, but it relates to the changeset. The objectives also reference that linked PR, so the description is not off-topic. This check is lenient and passes.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

coderabbitai[bot]

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

This comment was marked as resolved.

@mmathieum

This comment was marked as outdated.

gemini-code-assist[bot]

This comment was marked as outdated.

@mmathieum

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

/gemini review

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the VehicleLocation model to improve UUID generation by introducing a fallback mechanism that includes GPS coordinates if identifiers are missing, and reformats the cursorRow property. The reviewer correctly identified a potential issue where blank or empty vehicle identifiers could lead to UUID collisions and suggested using takeIf { it.isNotBlank() } to ensure only valid identifiers are used.

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused UUID fallback matches the intended behavior, with no unresolved correctness or compatibility issues identified.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@mmathieum
mmathieum merged commit f2c46ff into master Oct 28, 2026
@mmathieum
mmathieum deleted the mm/map_issue_marker_disapearing branch October 28, 2026 12:44
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