Fix: skip proximity merge when incoming parking has a known source ID#408
Merged
Conversation
Collaborator
Author
|
Here's an example of two nearby parking elements that get mixed up by the importer and |
assadriaz
approved these changes
Jul 16, 2026
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
MergingParkingImporterwhere two distinct parking facilities could be incorrectly merged based on proximity alone when they shared a name and nearby coordinates (e.g., two separate lots at the same station).Type of change
Issue
Motivation: When importing parkings that carry an
originalId(i.e., a known source-system ID), the importer first tries to locate an existing parking by that ID. If none is found, it fell through to proximity-based matching. This meant two new parkings with different IDs but the same name and overlapping coordinates (common at large transport hubs) could be collapsed into one record — silently dropping the second facility.How the code works:
MergingParkingImporter.findNearbyOrExistingParkingnow returnsnullimmediately (signalling "this is a new parking") when the incoming parking has a non-emptyORIGINAL_ID_KEYvalue list and no existing parking was found by ID. Proximity matching is only attempted for parkings that arrived without any source identifier, preserving the original fallback behaviour for those cases.Unit tests
A new integration test
parkingsWithDifferentImportedIdsMustNotBeMergedByProximityinMergingParkingImporterTestcovers the scenario: two parkings with identical names and coordinates but differentimportedIdvalues are imported sequentially and asserted to produce two distinct Tiamat records (differentnetexId, both at version 1).All existing tests continue to pass.
Documentation
The fix and its rationale are documented in a code comment at the insertion point in
MergingParkingImporter.