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

New editoast InfraCache API for accessing objects #6184

Merged
merged 2 commits into from
Dec 22, 2023

Conversation

woshilapin
Copy link
Contributor

These API wrap some of the boilerplate we have to do to access objects in InfraCache. It also hides the panic in a coherent API and expose an API that cannot panic anymore.

@woshilapin woshilapin requested a review from a team as a code owner December 21, 2023 13:47
@woshilapin woshilapin requested review from Erashin and Yohh December 21, 2023 13:47
@woshilapin woshilapin force-pushed the wsl/feat/5856-new-infra-cache-api branch from 005bd77 to 9fa3c91 Compare December 21, 2023 14:45
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (274ec46) 26.69% compared to head (8bcb233) 26.87%.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #6184      +/-   ##
============================================
+ Coverage     26.69%   26.87%   +0.17%     
  Complexity     2139     2139              
============================================
  Files           931      931              
  Lines        123484   123773     +289     
  Branches       2682     2682              
============================================
+ Hits          32968    33259     +291     
+ Misses        88918    88916       -2     
  Partials       1598     1598              
Flag Coverage Δ
core 78.87% <ø> (ø)
editoast 75.34% <100.00%> (+0.35%) ⬆️
front 9.39% <ø> (ø)
gateway 2.55% <ø> (ø)

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.

Copy link
Contributor

@Erashin Erashin left a comment

Choose a reason for hiding this comment

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

You could add some tests to check that the errors are indeed thrown when the objects do not exist.

@flomonster flomonster changed the title editoast(feat): new InfraCache API for accessing objects New editoast InfraCache API for accessing objects Dec 22, 2023
Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

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

LGTM.

Why prefix your commit message with editoast(feat): and not editoast:?

@woshilapin
Copy link
Contributor Author

LGTM.

Why prefix your commit message with editoast(feat): and not editoast:?

@flomonster I'm used to https://www.conventionalcommits.org/en/v1.0.0/. Ideally, I'd prefer to do the opposite feat(editoast): to respect conventional commits. I can edit the commit message if you prefer.

@flomonster
Copy link
Contributor

LGTM.
Why prefix your commit message with editoast(feat): and not editoast:?

@flomonster I'm used to https://www.conventionalcommits.org/en/v1.0.0/. Ideally, I'd prefer to do the opposite feat(editoast): to respect conventional commits. I can edit the commit message if you prefer.

I didn't know about this convention. Our delivery style is described [here] (https://osrd.fr/en/docs/guides/contribute/code/#git-commit-style). I prefer to keep it consistent with other contributions.

@woshilapin woshilapin force-pushed the wsl/feat/5856-new-infra-cache-api branch 2 times, most recently from a893bce to 9575f85 Compare December 22, 2023 14:18
These API wrap some of the boilerplate we have to do to access objects
in `InfraCache`. It also hides the `panic` in a coherent API and expose an
API that cannot `panic` anymore.
This is just good practice to make the API takes `&[]` instead of `&Vec<>`.
@woshilapin woshilapin force-pushed the wsl/feat/5856-new-infra-cache-api branch from 9575f85 to 8bcb233 Compare December 22, 2023 14:19
@woshilapin
Copy link
Contributor Author

You could add some tests to check that the errors are indeed thrown when the objects do not exist.

@Erashin Done in /~https://github.com/osrd-project/osrd/compare/9fa3c912a42c470b4ad5389c91042dd4fd70f258..a893bceb092dc2d870a50d234ac2cb20027e8c69.

@woshilapin woshilapin enabled auto-merge December 22, 2023 14:20
@woshilapin woshilapin removed the request for review from Yohh December 22, 2023 15:37
@woshilapin woshilapin disabled auto-merge December 22, 2023 15:39
@woshilapin woshilapin enabled auto-merge December 22, 2023 15:40
@woshilapin woshilapin requested a review from Yohh December 22, 2023 15:45
@woshilapin woshilapin added this pull request to the merge queue Dec 22, 2023
Merged via the queue into dev with commit c45b7e4 Dec 22, 2023
18 checks passed
@woshilapin woshilapin deleted the wsl/feat/5856-new-infra-cache-api branch December 22, 2023 17:58
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.

3 participants