Skip to content

Conversation

@Grufoony
Copy link
Collaborator

@Grufoony Grufoony commented Feb 2, 2026

No description provided.

@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.55%. Comparing base (53d80bc) to head (f68c6b9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #398   +/-   ##
=======================================
  Coverage   85.55%   85.55%           
=======================================
  Files          53       53           
  Lines        6063     6064    +1     
  Branches      657      657           
=======================================
+ Hits         5187     5188    +1     
  Misses        865      865           
  Partials       11       11           
Flag Coverage Δ
unittests 85.55% <100.00%> (+<0.01%) ⬆️

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.


static void BM_Agent_SetSrcNodeId(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule

static void BM_Agent_SetStreetId(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule

static void BM_Agent_SetNextStreetId(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule

static void BM_Agent_SetSpeed(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule

static void BM_Agent_SetFreeTime(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule

static void BM_Agent_IncrementDistance(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule

static void BM_Agent_Reset(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
// Getter benchmarks - these are inline so very fast
static void BM_Agent_Getters(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule

static void BM_Agent_Itinerary(benchmark::State& state) {
dsf::mobility::Agent agent(0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
dsf::mobility::Agent agent(0, 0, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
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

This PR re-introduces an explicit Agent id by adding it to dsf::mobility::Agent constructors and updating call sites across mobility tests, dynamics, and benchmarks.

Changes:

  • Update Agent to store an Id and require it in constructors.
  • Update RoadDynamics agent-construction helpers to pass an id when creating agents.
  • Update unit tests and benchmarks to use the new Agent constructor signatures.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/dsf/mobility/Agent.hpp Adds m_id and updates constructor signatures to require an id.
src/dsf/mobility/Agent.cpp Implements updated constructors initializing m_id.
src/dsf/mobility/RoadDynamics.hpp Updates templated addAgent/addAgents constraints and construction path to include agent ids.
test/mobility/Test_agent.cpp Updates agent construction in unit tests to include ids.
test/mobility/Test_street.cpp Updates agent construction in street-related tests to include ids.
test/mobility/Test_dynamics.cpp Updates agent construction in dynamics tests to include ids.
test/base/Test_node.cpp Updates agent construction used in intersection/node tests to include ids.
benchmark/Bench_Agent.cpp Updates benchmark agent construction to include ids.
benchmark/Bench_Intersection.cpp Updates benchmark code (currently contains API mismatches requiring fixes).

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

Comment on lines 1569 to 1573
void RoadDynamics<delay_t>::addAgents(std::size_t const nAgents, TArgs&&... args) {
for (size_t i{0}; i < nAgents; ++i) {
addAgent(std::make_unique<Agent>(this->time_step(), std::forward<TArgs>(args)...));
addAgent(std::make_unique<Agent>(
this->m_nAddedAgents, this->time_step(), std::forward<TArgs>(args)...));
}
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

In addAgents, each loop iteration uses this->m_nAddedAgents as the id without incrementing it, so all agents created in the batch will share the same id. Consider reserving a range of ids up-front via fetch_add(nAgents) and using startId + i (or increment per iteration) to guarantee uniqueness.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to 30
auto agent = std::make_unique<dsf::mobility::Agent>(
spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
intersection.addAgent(0.0, std::move(agent));
intersection.addAgent(0, 0.0, std::move(agent));
}
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

This benchmark no longer matches the Agent and Intersection::addAgent APIs: Agent construction here is missing the new leading id parameter, and Intersection::addAgent takes (double angle, std::unique_ptr<Agent>) (no leading id). Update the agent construction to include an id and call intersection.addAgent(0.0, std::move(agent)).

Copilot uses AI. Check for mistakes.
for (auto _ : state) {
dsf::mobility::Agent agent(
spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
0, spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
intersection.setCapacity(100);
auto agent = std::make_unique<dsf::mobility::Agent>(
spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
0, spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
intersection.setCapacity(100);
auto agent = std::make_unique<dsf::mobility::Agent>(
spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
0, spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
roundabout.setCapacity(100);
auto agent = std::make_unique<dsf::mobility::Agent>(
spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);
0, spawnTime++, std::make_shared<dsf::mobility::Itinerary>(1, 1), 0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
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