Repository navigation
feat(core): resolve routes against the network, and edit them undoably (p8-s3) (#247) - #544
Merged
Merged
Conversation
This was referenced Aug 1, 2026
Merged
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.
The resolver half of #247: the one place the
.xoscand the.xodrare read together. #541 gave routes a model and a writer, #543 a reader; this PR makes them mean something against a live network — and editable, one gesture at a time, on the same undo stack as everything else.What lands
osc::resolve_route(network, route)(core/osc/route.{hpp,cpp}) turns a route's waypoints into the ordered lane legs a car would actually drive. Consecutive waypoints are joined by a breadth-first search over lane links (§9.3), road links (§9.2) andJunctionConnection::lane_links(§12) — so a solved path runs along a junction's connecting roads, the roads its authored maneuvers shape, rather than across it. The search is directed by each lane's own direction of travel: a route that could only be driven against the traffic is reported as unreachable, not solved.osc::validate_routes(network, scenario)re-checks every assigned route and is the cross-document half ofvalidate_scenario, which structurally cannot see a network (aScenarioholds@idstrings, never arena handles — ADR-0014 §5). It citesrouting.route_waypoints_locationsfor a waypoint sitting on a junction's connecting road — the rule #245 deliberately left undeclared because nothing could check it from the.xoscalone.Diagnosticnaming the entity, the route and the waypoint index, and the legs that did resolve are still returned so a caller can draw what it knows and mark the gap. An incomplete resolution always says why; a silentcomplete = falseis the failure mode the module exists to prevent.s_end < s_startwhen the lane travels against +s, which a left-hand lane always does. Pinned by its own test, because a caller assuming an ascending interval draws a left-hand route backwards.assign_route,clear_route,set_route_waypoint,insert_route_waypoint,remove_route_waypoint— with the usual contract: refuse via a non-null command, byte-identicalwrite_xoscacross undo/redo, no clamping. Removing a waypoint that would leave fewer than two is refused: that deletion would produce a documentwrite_xoscrefuses, i.e. a scenario made unsavable by an edit that appeared to succeed.resolve_route,validate_routes,assigned_routesand the five factories, pluspython/examples/scenario_routes.py— which replays GW-6 steps 7 and 8 headlessly: move a road the route runs along and it still resolves; delete a lane it traverses and the route is reported as invalidated.python/linksroadmaker::corealone, so this file is the evidence those steps can be produced without the editor.Notes for review
onward_lanesfalls back to same-@idlane matching across a road boundary whose<lane><link>records are absent — RoadMaker's own authoring path never emits them across a plain weld (only across section splits and inside junctions), so requiring the record would report every road-to-road route as unreachable while the roads are visibly joined. When the record is present it wins, because a foreign file may renumber across the joint. The authoring-side gap is called out in a comment as follow-up material.kMaxRouteSearchLanes = 4096): a malformed junction can make the lane graph cyclic, and a resolver intended to re-run on every topology change must not become the thing that hangs the editor.routing.route_waypoints_locationsis declared inrules.hpponly now, together with its citer, becauseXoscRules.EveryRuleConstantIsCitedBySomeFindingfails on a constant nothing cites.Editor integration (Route tool, rendering, re-validation on
topology_changed) is the sprint's next PR; #247 stays open.Evidence
ctest --preset ci-macos: 3164/3164 passed locally, including 15 newXoscRoutetests and 12 newXoscEditroute-command tests.pytest python/tests: green locally, includingtest_scenario_routes.py.python python/examples/scenario_routes.pyruns clean against the freshly built module.