⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@Grufoony
Copy link
Collaborator

@Grufoony Grufoony commented Jan 28, 2026

Pull request overview

Adds a RoadStatus concept (OPEN/CLOSED) to streets and integrates it into routing so pathfinding can ignore closed roads.

Changes:

  • Introduces dsf::mobility::RoadStatus and stores per-road status in Road.
  • Adds RoadNetwork::setStreetStatusById/ByName and updates allPathsTo/shortestPath to skip CLOSED roads.
  • Extends C++ tests and exposes RoadStatus + street status/capacity APIs via pybind11.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/mobility/Test_graph.cpp Adds test coverage for status toggling and routing behavior with closed roads.
src/dsf/mobility/RoadNetwork.hpp Declares status setters and updates Dijkstra-based routing to ignore CLOSED streets.
src/dsf/mobility/RoadNetwork.cpp Implements status setters (by id and by name/substring).
src/dsf/mobility/Road.hpp Adds RoadStatus enum and stores default OPEN status on roads.
src/dsf/bindings.cpp Binds RoadStatus and exposes status/capacity mutation methods to Python.
Comments suppressed due to low confidence (2)

src/dsf/mobility/RoadNetwork.hpp:390

  • In allPathsTo, edge(inEdgeId) is now looked up multiple times per iteration (status check, source(), and passing to f(...)). Since this is an unordered_map lookup, consider storing auto const& e = edge(inEdgeId); once and reusing it to avoid repeated lookups and keep the loop easier to read.
        // Skip closed roads
        if (edge(inEdgeId)->roadStatus() == RoadStatus::CLOSED) {
          continue;
        }
        Id neighborId = edge(inEdgeId)->source();

        // Calculate the weight of the edge from neighbor to currentNode using the dynamics function
        double edgeWeight = f(this->edge(inEdgeId));

src/dsf/mobility/RoadNetwork.hpp:500

  • In shortestPath, edge(inEdgeId) is now looked up multiple times per iteration (status check, source(), and passing to f(...)). Consider caching the pointer/reference for the current edge inside the loop to avoid repeated unordered_map lookups and improve readability.
        // Skip closed roads
        if (edge(inEdgeId)->roadStatus() == RoadStatus::CLOSED) {
          continue;
        }
        Id neighborId = edge(inEdgeId)->source();

        // Calculate the weight of the edge from neighbor to currentNode using the dynamics function
        double edgeWeight = f(this->edge(inEdgeId));
        double newDistToTarget = distToTarget[currentNode] + edgeWeight;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 82.42424% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.30%. Comparing base (3604260) to head (80e874d).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/dsf/mobility/RoadNetwork.cpp 41.17% 20 Missing ⚠️
src/dsf/mobility/RoadDynamics.hpp 0.00% 6 Missing ⚠️
src/dsf/mobility/Road.hpp 82.35% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #396      +/-   ##
==========================================
+ Coverage   85.13%   85.30%   +0.17%     
==========================================
  Files          53       53              
  Lines        5784     5941     +157     
  Branches      649      652       +3     
==========================================
+ Hits         4924     5068     +144     
- Misses        849      862      +13     
  Partials       11       11              
Flag Coverage Δ
unittests 85.30% <82.42%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Cppcheck (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a RoadStatus concept (OPEN/CLOSED) to streets and integrates it into routing so pathfinding can ignore closed roads.

Changes:

  • Introduces dsf::mobility::RoadStatus and stores per-road status in Road.
  • Adds RoadNetwork::setStreetStatusById/ByName and updates allPathsTo/shortestPath to skip CLOSED roads.
  • Extends C++ tests and exposes RoadStatus + street status/capacity APIs via pybind11.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/mobility/Test_graph.cpp Adds test coverage for status toggling and routing behavior with closed roads.
src/dsf/mobility/RoadNetwork.hpp Declares status setters and updates Dijkstra-based routing to ignore CLOSED streets.
src/dsf/mobility/RoadNetwork.cpp Implements status setters (by id and by name/substring).
src/dsf/mobility/Road.hpp Adds RoadStatus enum and stores default OPEN status on roads.
src/dsf/bindings.cpp Binds RoadStatus and exposes status/capacity mutation methods to Python.
Comments suppressed due to low confidence (2)

src/dsf/mobility/RoadNetwork.hpp:390

  • In allPathsTo, edge(inEdgeId) is now looked up multiple times per iteration (status check, source(), and passing to f(...)). Since this is an unordered_map lookup, consider storing auto const& e = edge(inEdgeId); once and reusing it to avoid repeated lookups and keep the loop easier to read.
        // Skip closed roads
        if (edge(inEdgeId)->roadStatus() == RoadStatus::CLOSED) {
          continue;
        }
        Id neighborId = edge(inEdgeId)->source();

        // Calculate the weight of the edge from neighbor to currentNode using the dynamics function
        double edgeWeight = f(this->edge(inEdgeId));

src/dsf/mobility/RoadNetwork.hpp:500

  • In shortestPath, edge(inEdgeId) is now looked up multiple times per iteration (status check, source(), and passing to f(...)). Consider caching the pointer/reference for the current edge inside the loop to avoid repeated unordered_map lookups and improve readability.
        // Skip closed roads
        if (edge(inEdgeId)->roadStatus() == RoadStatus::CLOSED) {
          continue;
        }
        Id neighborId = edge(inEdgeId)->source();

        // Calculate the weight of the edge from neighbor to currentNode using the dynamics function
        double edgeWeight = f(this->edge(inEdgeId));
        double newDistToTarget = distToTarget[currentNode] + edgeWeight;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


/// @brief Set the street's status by its id
/// @param streetId The id of the street
/// @param status The status to set
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

setStreetStatusById calls edge(streetId) which uses unordered_map::at and will throw std::out_of_range if the id doesn’t exist (see src/dsf/base/Network.hpp:224-230). Consider either documenting this in the comment or catching it and throwing a more specific exception (e.g., std::invalid_argument) consistent with other public RoadNetwork APIs.

Suggested change
/// @param status The status to set
/// @param status The status to set
/// @throws std::out_of_range if the given street id does not exist in the network

Copilot uses AI. Check for mistakes.
@Grufoony Grufoony merged commit d787e02 into main Jan 28, 2026
41 checks passed
@Grufoony Grufoony deleted the roadstatus branch January 28, 2026 10:21
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