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

chore(infra): canonicalize path resolution #2254

Closed
wants to merge 1 commit into from

Conversation

This was referenced Nov 24, 2024
@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

codecov bot commented Nov 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.34%. Comparing base (e3165c4) to head (4d734eb).
Report is 572 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2254       +/-   ##
===========================================
+ Coverage   40.10%   77.34%   +37.23%     
===========================================
  Files          26      385      +359     
  Lines        1895    40296    +38401     
  Branches     1895    40296    +38401     
===========================================
+ Hits          760    31165    +30405     
- Misses       1100     6828     +5728     
- Partials       35     2303     +2268     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Contributor

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r1.
Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on @Itay-Tsabary-Starkware)


crates/infra_utils/src/path.rs line 17 at r1 (raw file):

    #[error(transparent)]
    IoError(#[from] std::io::Error),
}

Should we delete this error variant and use std::io::Error as IOError throughout?

Code quote:

#[derive(Debug, Error)]
pub enum PathResolutionError {
    /// This error is raised when the file path does not exist, or when a non-final component in a
    /// path is not a directory. See [`std::fs::canonicalize`] for more information.
    #[error(transparent)]
    IoError(#[from] std::io::Error),
}

crates/infra_utils/src/path_test.rs line 3 at r1 (raw file):

use crate::path::{path_of_project_root, resolve_project_relative_path};

// TODO: Add a test for PathResolutionError::IoError.

Delete this TODO.

Copy link
Contributor Author

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 5 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware)


crates/infra_utils/src/path.rs line 17 at r1 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

Should we delete this error variant and use std::io::Error as IOError throughout?

Yes. That also enabled the removal of GetPathError הי"ד.


crates/infra_utils/src/path_test.rs line 3 at r1 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

Delete this TODO.

Done.

Copy link

Artifacts upload workflows:

Copy link
Contributor

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware)


crates/infra_utils/src/path_test.rs line 10 at r2 (raw file):

    let result = resolve_project_relative_path(relative_path);

    assert!(result.is_err(), "Expected an non-existent path error, got {:?}", result);

Or is this an overkill?

Suggestion:

assert_eq!(result.unwrap_err().display(), "File not fount", "Expected an non-existent path error, got {:?}", result);

Copy link
Contributor

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 5 files at r2, all commit messages.
Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware)

Copy link

Benchmark movements:
full_committer_flow performance regressed!
full_committer_flow time: [29.851 ms 29.888 ms 29.927 ms]
change: [+1.4321% +1.6171% +1.8100%] (p = 0.00 < 0.05)
Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
3 (3.00%) high mild
1 (1.00%) high severe

Copy link
Contributor

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 5 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Itay-Tsabary-Starkware)

@Itay-Tsabary-Starkware
Copy link
Contributor Author

✓ Commit merged in pull request #2264

@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants