-
Notifications
You must be signed in to change notification settings - Fork 994
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
Improve detection of unsupported cargo toolchains #8181
Conversation
cda4776
to
f51f2a0
Compare
That did the trick and I can see the real culprit now! Original error is:
|
I ended up with three different commits here, but I'm not sure if this is correct:
|
By the way, this flakes seems to be happening consistently right now? At least I'm not being able to get #8174 green by retrying! |
.to raise_error(Dependabot::DependencyFileNotEvaluatable) | ||
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.
Can the test go back in now that it works?
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.
This is me completely removing the detection from lockfile updater, because I believe this should never be triggered. We always go through UpdateChecker
first, and we would detect it there before?
If this is really needed, then I need to duplicate the fix in the updater to get the test to pass.
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.
Maybe move it to the UpdateChecker specs?
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.
It's already there!
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.
Oh ok, then we're good to go!
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.
Actually my assumption was incorrect. I think in the case of security updates, we won't go through VersionResolver
sometimes but pick the lowest fixed version directly from LatestVersionFinder
. So the check in LockfileUpdater
may be still needed. I'll port the fix and restore the test just in case.
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.
I duplicated the fix in LockfileUpdater
at 39bb742, and restored the spec 👍.
false | ||
elsif original_requirements_resolvable == false | ||
true | ||
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.
It's still early here, trying to understand this change. It looks the same as the code it replaces?
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.
The previous code returns always either true
or false
. The new code returns either true
, false
, or nil
if we couldn't find a definitive hint about a resolvability issue.
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.
Satisfying RuboCop requests made it quite unreadable, I'll add a comment.
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.
Not a big deal, I was trying to figure out the significance of the change.
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.
Have a look at e1c8dce, it should be easier to read!
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.
Looks good, would be good to have a test to make sure this doesn't break in the future. I recall it was causing a lot of unknown errors at the time.
Edit: @deivid-rodriguez says there's already a test there so we good!
This is almost the same thing as before, but `raise` without an argument lets the original error instance be raised. However, `raise e` raises a new instance of the same error, resulting in slightly harder to parse backtraces.
e472404
to
579fa9c
Compare
Currently we look for an error when trying to use a flag that's not supported by old toolchains. However, I think cargo downloads the user selected toolchain on the fly and that may fail before even getting the error about the unsupported flag. I think we may also detect that the old version is getting downloaded and error in the same way.
579fa9c
to
39bb742
Compare
We're getting the following flaky in cargo:
https://github.com/dependabot/dependabot-core/actions/runs/6493735738/job/17635263354
It seems confusing to me because we fail to categorize the error as matching
usage of sparse registries requires `-Z sparse-registry`
which is what determines that the cargo version is too old. But still, the command being raised is including that.The problem is that we fail to match the string in the original error, but then when later trying to figure out whether the error was a resolvability issue, we end up running another cargo command to see if the original requirements were resolvable, and in that case, the
usage of sparse registries requires `-Z sparse-registry`
string is in the output.So I'm wondering why the original error did not include the string.
To be able to verify this, we could return "nil" from
original_requirements_resolvable
if this happens, and let the original error be raised in that case.