feat(engine): ignore incoming hints during phantom node lookup#7630
Merged
Conversation
Incoming hints are still parsed and accepted (backward compatibility), and hints are still generated in API responses. However, the server no longer uses client-provided hints to short-circuit phantom node lookups — it always performs a fresh nearest-node search instead. This prevents clients from anchoring coordinates to stale or incorrect positions while maintaining full wire-format compatibility.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes the engine’s phantom node lookup behavior to ignore client-provided hints during snapping, while keeping hint parsing and hint generation for backwards compatibility.
Changes:
- Removed hint-based short-circuiting from the
BasePlugin::GetPhantomNodes*overloads so lookups always perform a fresh nearest search. - Dropped now-unneeded hint-distance computation and related includes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
10
to
16
| #include "engine/status.hpp" | ||
|
|
||
| #include "util/coordinate.hpp" | ||
| #include "util/coordinate_calculation.hpp" | ||
| #include "util/format.hpp" | ||
|
|
||
| #include "util/integer_range.hpp" | ||
| #include "util/json_container.hpp" | ||
|
|
Comment on lines
184
to
188
| for (const auto i : util::irange<std::size_t>(0UL, parameters.coordinates.size())) | ||
| { | ||
| if (use_hints && parameters.hints[i] && !parameters.hints[i]->segment_hints.empty() && | ||
| parameters.hints[i]->IsValid(parameters.coordinates[i], facade)) | ||
| { | ||
| for (const auto &seg_hint : parameters.hints[i]->segment_hints) | ||
| { | ||
| phantom_nodes[i].push_back(PhantomNodeWithDistance{ | ||
| seg_hint.phantom, | ||
| util::coordinate_calculation::greatCircleDistance( | ||
| parameters.coordinates[i], seg_hint.phantom.location)}); | ||
| } | ||
| continue; | ||
| } | ||
|
|
||
| phantom_nodes[i] = facade.NearestPhantomNodesInRange( | ||
| parameters.coordinates[i], | ||
| radiuses[i], |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7630 +/- ##
==========================================
+ Coverage 90.82% 94.22% +3.40%
==========================================
Files 484 484
Lines 37816 37790 -26
==========================================
+ Hits 34347 35609 +1262
+ Misses 3469 2181 -1288 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Incoming hints are still parsed and accepted (backward compatibility), and hints are still generated in API responses. However, the server no longer uses client-provided hints to short-circuit phantom node lookups - it always performs a fresh nearest-node search instead. - Removed hint-usage logic from all three GetPhantomNodes overloads - Added explicit #include <format> (previously transitive via util/format.hpp) - Added cucumber regression test for bogus/empty hints
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.
Issue
N/A — this is a behavioral change without a corresponding issue.
Was this change primarily generated using an AI tool?
🤖 Claude Code, Claude Opus 4.8
Tasklist
Requirements / Relations
None.
Description
Incoming hints are still parsed and accepted (backward compatibility), and hints are still generated in API responses. However, the server no longer uses client-provided hints to short-circuit phantom node lookups — it always performs a fresh nearest-node search instead.
This prevents clients from anchoring coordinates to stale or incorrect positions while maintaining full wire-format compatibility.
Changes:
GetPhantomNodesoverloads inplugin_base.hppcoordinate_calculation.hpp,format.hpp)BaseAPI::MakeWaypoint) is unchangedgenerate_hintsparameter still defaults totrue