Skip to content

Conversation

@Grufoony
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 97.05882% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.13%. Comparing base (da1ebc2) to head (b7af18a).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/dsf/mobility/RoadDynamics.hpp 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #395      +/-   ##
==========================================
+ Coverage   85.09%   85.13%   +0.03%     
==========================================
  Files          53       53              
  Lines        5763     5784      +21     
  Branches      649      649              
==========================================
+ Hits         4904     4924      +20     
- Misses        848      849       +1     
  Partials       11       11              
Flag Coverage Δ
unittests 85.13% <97.05%> (+0.03%) ⬆️

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
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 stream-based “print/describe” utilities for mobility components and validates them via new tests.

Changes:

  • Add RoadNetwork::describe(std::ostream&) for emitting a human-readable network description.
  • Add RoadDynamics::summary(std::ostream&) plus new agent lifecycle counters and hook them into the dynamics.
  • Expose describe() / summary() via pybind11 and add doctest coverage asserting expected output substrings.

Reviewed changes

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

Show a summary per file
File Description
test/mobility/Test_graph.cpp Adds doctest assertions for RoadNetwork::describe() output.
test/mobility/Test_dynamics.cpp Adds doctest assertions for FirstOrderDynamics::summary() output.
src/dsf/mobility/RoadNetwork.hpp Declares describe() and adjusts count return types to std::size_t.
src/dsf/mobility/RoadNetwork.cpp Implements RoadNetwork::describe().
src/dsf/mobility/RoadDynamics.hpp Adds counters + summary() and increments counters at runtime.
src/dsf/bindings.cpp Adds Python bindings for RoadNetwork.describe() and FirstOrderDynamics.summary().

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

Comment on lines 54 to 55
std::size_t m_nAgents{0}, m_nAddedAgents{0}, m_nInsertedAgents{0}, m_nKilledAgents{0},
m_nArrivedAgents{0};
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

These counters are updated from within TBB-parallel regions (e.g., m_evolveStreet() is called inside tbb::parallel_for), but they are plain std::size_t. Increment/decrement from multiple threads will cause data races/UB and make summary() unreliable. Use atomics (e.g., std::atomic<std::size_t>) or thread-local reduction (e.g., tbb::combinable) and consolidate after the parallel section.

Copilot uses AI. Check for mistakes.
Comment on lines 743 to 745
this->m_killAgent(pStreet->dequeue(queueIndex));
++m_nKilledAgents;
continue;
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

m_evolveStreet() runs under tbb::parallel_for (see evolve()), so this increment is not thread-safe on a plain std::size_t counter and can race. Make the counter atomic or accumulate per-thread and reduce after the parallel region.

Copilot uses AI. Check for mistakes.
Comment on lines 899 to 901
auto pAgent = this->m_killAgent(pStreet->dequeue(queueIndex));
++m_nArrivedAgents;
if (reinsert_agents) {
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

m_evolveStreet() is executed in parallel; incrementing m_nArrivedAgents here can race (plain std::size_t). Use an atomic counter or a per-thread accumulator reduced after the parallel region.

Copilot uses AI. Check for mistakes.
Comment on lines +399 to +401
/// @brief Print a summary of the dynamics to an output stream
/// @param os The output stream to write to (default is std::cout)
/// @details The summary includes:
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

summary() uses std::ostream and defaults the argument to std::cout, but this header doesn’t include <ostream>/<iostream> directly (it currently relies on transitive includes via RoadNetwork.hpp). Add the appropriate standard header include(s) here to avoid fragile build dependencies.

Copilot uses AI. Check for mistakes.
Grufoony and others added 3 commits January 23, 2026 15:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Grufoony Grufoony merged commit 3604260 into main Jan 23, 2026
46 checks passed
@Grufoony Grufoony deleted the printUtils branch January 23, 2026 15:02
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