Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: stdcm: reorganize step data to make them dynamic #11109

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

eckter
Copy link
Contributor

@eckter eckter commented Mar 12, 2025

Fix #8974

Follow-up of #10989 (which started the wrong way).

May be reviewed commit by commit, but there's been a few changed from earlier commits that have been changed again in later ones. But they're mostly self-contained changes and each commit normally compiles and runs properly (though I've only run unit tests).


The main goal of this refactor was to remove the use of step data as a static thing, so that they can be changed dynamically when implementing overtakes. The main challenge was checking for graph.steps to test for, e.g., stop duration. A few data redundancy have been removed as well (like stop offsets in InfraExplorerWithEnvelope), but they weren't too tangled up.

The main change is the Introduction of a class that keeps track of the steps on the path, StepTracker. It includes both stops and non-stop waypoints, while keeping track of what's in the lookahead section. Eventually it may include stops that aren't part of the input.

This solves two main issues: we don't need to check for the input step list anymore, we can instead rely on StepTracker's step list, which would include extra stops. We also don't need to manually keep track of waypoint indexes in edges/nodes (which again wouldn't match with a more dynamic stop list).

There's some more minor refactoring along the way.

@github-actions github-actions bot added the area:core Work on Core Service label Mar 12, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.88%. Comparing base (4e88804) to head (92ddef5).
Report is 5 commits behind head on dev.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #11109      +/-   ##
==========================================
+ Coverage   80.86%   80.88%   +0.01%     
==========================================
  Files        1118     1119       +1     
  Lines      112736   112834      +98     
  Branches      759      759              
==========================================
+ Hits        91164    91262      +98     
  Misses      21517    21517              
  Partials       55       55              
Flag Coverage Δ
editoast 72.61% <ø> (ø)
front 89.90% <ø> (+0.01%) ⬆️
gateway 2.49% <ø> (ø)
osrdyne 2.53% <ø> (ø)
railjson_generator 87.58% <ø> (ø)
tests 88.82% <ø> (ø)

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.

@eckter eckter force-pushed the ech/v2-unify-stops branch from 3ee55cd to 268d4be Compare March 12, 2025 13:36
Comment on lines +287 to +288
* Otherwise, it returns false and the instance is supposed to be dropped. `blockRoutes` is
* updated to keep track of the route used for each block.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having to always keep the current isntance in a consistent state even when it's meant to be discarded was a lot more painful here. We need to update the step tracker to properly handle the following edges.

@eckter eckter force-pushed the ech/v2-unify-stops branch from 268d4be to bd324f4 Compare March 13, 2025 09:02
@eckter eckter marked this pull request as ready for review March 13, 2025 13:17
@eckter eckter requested a review from a team as a code owner March 13, 2025 13:17
@eckter eckter requested review from Khoyo, Erashin and bougue-pe and removed request for Khoyo March 13, 2025 13:17
@eckter
Copy link
Contributor Author

eckter commented Mar 17, 2025

TODO (?)

We still use raw input steps in BlockAvailability

@eckter eckter force-pushed the ech/v2-unify-stops branch from bd324f4 to 1c0b9a0 Compare March 17, 2025 13:55
@@ -55,36 +53,38 @@ data class STDCMEdge(

/** Returns the node at the end of this edge */
fun getEdgeEnd(graph: STDCMGraph): STDCMNode {
var newWaypointIndex = waypointIndex
// TODO: maybe integrate this logic to StepTracker?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
// TODO: maybe integrate this logic to StepTracker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core Work on Core Service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refacto: stdcm: unify stop data
2 participants