-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Reimplement support retrieving workspace of path dependencies in cargo #10629
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil | ||
end | ||
|
||
parent_dirs = current_dir.scan("/").length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously did current_dir.scan("/").length - 1
here which was root cause of error that caused regression, fixed to not do this subtraction
# To avoid accidentally breaking backward compatibility, we don't throw errors | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid any other regressions, relax this to not throw error
# To avoid accidentally breaking backward compatibility, we don't throw errors | ||
nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too
context "with a workspace root containing a path dependency to a member" do | ||
before do | ||
stub_request(:get, url + "?ref=sha") | ||
.with(headers: { "Authorization" => "token token" }) | ||
.to_return( | ||
status: 200, | ||
body: fixture("github", "contents_cargo_without_lockfile.json"), | ||
headers: json_header | ||
) | ||
stub_request(:get, url + "Cargo.toml?ref=sha") | ||
.with(headers: { "Authorization" => "token token" }) | ||
.to_return( | ||
status: 200, | ||
body: fixture("github", "path_dependency_in_workspace_root", | ||
"contents_cargo_manifest_workspace.json"), | ||
headers: json_header | ||
) | ||
stub_request(:get, url + "child/Cargo.toml?ref=sha") | ||
.with(headers: { "Authorization" => "token token" }) | ||
.to_return( | ||
status: 200, | ||
body: fixture("github", "path_dependency_in_workspace_root", | ||
"contents_cargo_manifest_child.json"), | ||
headers: json_header | ||
) | ||
end | ||
|
||
it "fetches the dependencies successfully" do | ||
expect(file_fetcher_instance.files.map(&:name)) | ||
.to match_array(%w(.cargo/config.toml Cargo.toml child/Cargo.toml)) | ||
expect(file_fetcher_instance.files.map(&:path)) | ||
.to match_array(%w(/.cargo/config.toml /Cargo.toml /child/Cargo.toml)) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on https://github.com/Jefffrey/dependabot-cargo-test-2
Where the scenario is having a workspace, where in the workspace root it specifies members via path dependencies. Looks like this test case was absent before, so adding to prevent further regressions
Thanks @Jefffrey , we'll try to get this tested and merged on our end |
What are you trying to accomplish?
Reattempting #10550 after it was reverted in #10599 due to regression, see #10584
Anything you want to highlight for special attention from reviewers?
Changes are largely the same as #10550, with some changes:
How will you know you've accomplished your goal?
Unit tests passed. Also ran dry run against the repos that were listed as affected in #10584
Both executed successfully.
Checklist