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

Support retrieving workspace of path dependencies in cargo #10550

Conversation

Jefffrey
Copy link
Contributor

@Jefffrey Jefffrey commented Sep 5, 2024

What are you trying to accomplish?

Given a repository like so:

.
├── cli_crate
│   ├── Cargo.toml
└── workspace
    ├── Cargo.toml
    └── nested
        └── Cargo.toml

Where workspace represents a workspace containing only nested, and cli_crate has a path dependency to nested, and nested inherits any property from the root (e.g. edition = { workspace = true }).

If we point dependabot to only cli_crate, it will error out when running cargo update as though it can fetch the path dependency nested, it cannot resolve this as it also needs the workspace due to this inheritance. Fix Cargo file_fetcher to support this logic of locating the root of a workspace member who is a path dependency, and fetching it.

For negative cases, where the root cannot be located or is incorrect, emit an error message (instead of when running cargo update which can be confusing to understand).

Closes #9533

Anything you want to highlight for special attention from reviewers?

How will you know you've accomplished your goal?

Unit tests added (see reference repository: https://github.com/Jefffrey/dependabot-cargo-test/tree/master)

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@Jefffrey Jefffrey requested a review from a team as a code owner September 5, 2024 12:18
@github-actions github-actions bot added the L: rust:cargo Rust crates via cargo label Sep 5, 2024
Comment on lines 679 to +681
stub_request(:get, url + "excluded/Cargo.toml?ref=sha")
.with(headers: { "Authorization" => "token token" })
.to_return(status: 200, body: member_fixture, headers: json_header)
.to_return(status: 200, body: excluded_fixture, headers: json_header)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Small typo (I assume?) I found when looking at #7649 for reference

@RobJellinghaus RobJellinghaus self-assigned this Sep 6, 2024
Copy link
Member

@abdulapopoola abdulapopoola left a comment

Choose a reason for hiding this comment

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

Approving based on @RobJellinghaus ' approval :)

@RobJellinghaus
Copy link
Contributor

Approving based on @RobJellinghaus ' approval :)

Thanks Abdul! Sorry I don't have approver ability myself for some reason, let me know if you can diagnose that. Thanks @Jefffrey for this work! Do you have any other Rust Dependabot issues you are looking at?

@thavaahariharangit thavaahariharangit merged commit f238da5 into dependabot:main Sep 9, 2024
39 checks passed
@abdulapopoola
Copy link
Member

Thanks so much @Jefffrey !

@Jefffrey Jefffrey deleted the cargo-fetch-path-dependency-workspaces branch September 9, 2024 21:29
@Jefffrey
Copy link
Contributor Author

Jefffrey commented Sep 9, 2024

Thanks for the review 👍

Do you have any other Rust Dependabot issues you are looking at?

This was the only one I was looking at

@mistydemeo
Copy link

This led to a regression that causes Dependabot runs to fail in multi-package Cargo workspaces - see #10584. Any chance this could either get reverted or fixed forward?

@Jefffrey
Copy link
Contributor Author

This led to a regression that causes Dependabot runs to fail in multi-package Cargo workspaces - see #10584. Any chance this could either get reverted or fixed forward?

Sorry about this! I've raised a PR to revert these changes: #10599

thavaahariharangit pushed a commit that referenced this pull request Sep 13, 2024
…10550)" (#10599)

This reverts commit f238da5.

Co-authored-by: AbdulFattaah Popoola <abdulapopoola@github.com>
Jefffrey added a commit to Jefffrey/dependabot-core that referenced this pull request Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: rust:cargo Rust crates via cargo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust: failed to find a workspace root for workspace dependency in a non-workspace crate
5 participants