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

editoast: add stdcm search environment model and endpoints #8257

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

Castavo
Copy link
Contributor

@Castavo Castavo commented Jul 30, 2024

close #8168

@Castavo Castavo requested a review from a team as a code owner July 30, 2024 12:58
@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2024

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

Codecov Report

Attention: Patch coverage is 87.00565% with 23 lines in your changes missing coverage. Please review.

Project coverage is 27.48%. Comparing base (4388f9d) to head (da38382).
Report is 28 commits behind head on dev.

Files Patch % Lines
editoast/src/tables.rs 22.22% 14 Missing ⚠️
...itoast/src/views/stdcm/stdcm_search_environment.rs 94.28% 4 Missing ⚠️
front/src/common/api/generatedEditoastApi.ts 90.69% 4 Missing ⚠️
editoast/src/modelsv2/stdcm_search_environment.rs 97.43% 1 Missing ⚠️

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

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #8257      +/-   ##
============================================
+ Coverage     27.18%   27.48%   +0.29%     
- Complexity     2127     2155      +28     
============================================
  Files          1310     1316       +6     
  Lines        157758   158158     +400     
  Branches       3256     3262       +6     
============================================
+ Hits          42887    43467     +580     
+ Misses       112891   112708     -183     
- Partials       1980     1983       +3     
Flag Coverage Δ
core 75.53% <ø> (+0.03%) ⬆️
editoast 64.64% <85.82%> (+0.39%) ⬆️
front 10.45% <90.69%> (+0.06%) ⬆️
gateway 2.03% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 72.98% <ø> (-0.20%) ⬇️

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.

@Castavo Castavo force-pushed the bpt/stdcm-sim-env branch 2 times, most recently from b9c2767 to cc387d6 Compare July 30, 2024 13:22
Copy link
Contributor

@woshilapin woshilapin left a comment

Choose a reason for hiding this comment

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

I'm not sure that I understand completely how it will be used. In the description of the migration, it's mentioned that the object will almost be a singleton. And most of the code does seems to reflect that. But the name of the function retrieve_latest almost gives you a hint that there might be other instances of the object ("if there is a latest, it's relative to others"). It might just be a naming problem.

Apart from that, very clean PR with lot of tests, thank you 🎉

@Castavo
Copy link
Contributor Author

Castavo commented Jul 30, 2024

@woshilapin when designing this implem with @flomonster we considered making the sql table an actual singleton.
However, there is no builtin in way to achieve this, the most commonly found way is to add a column, add a UNIQUE constraint on it, and a value constraint so it can take only one value.

So we opted to not enforce the singleton-ness.

Thus, if by some manual manipulation, the database has several rows, the "retrieve" function handles it gracefully.

What do you think ?
If we stay with this current model, I can add a clearer docstring on why retrieve_latest isn't called retrieve

@Khoyo
Copy link
Contributor

Khoyo commented Jul 31, 2024

From the original goal of https://github.com/osrd-project/osrd-confidential/issues/481, don't we want to support multiple environments and select the correct one based on the requested date ? This seems to override all the envs every time a POST is made

@Castavo
Copy link
Contributor Author

Castavo commented Jul 31, 2024

@Khoyo with @flomonster we discussed that there actually probably wasn't a need to keep history. We could decide to actually keep history and add indexes on the time windows fields.

However, given that there are no "ON DELETE" clauses on the fields (so the env can't be accidentally deleted), all objects referenced by the history wouldn't be deletable.

@younesschrifi younesschrifi removed their request for review August 1, 2024 10:12
@younesschrifi younesschrifi enabled auto-merge August 1, 2024 11:56
@younesschrifi younesschrifi added this pull request to the merge queue Aug 1, 2024
Merged via the queue into dev with commit cbe752b Aug 1, 2024
20 checks passed
@younesschrifi younesschrifi deleted the bpt/stdcm-sim-env branch August 1, 2024 12:19
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.

editoast: create STDCM search env data model and CRUD
5 participants