-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Check lock file diagnostics in mirror
command
#35322
Conversation
The lock file diagnostic were not being checked in the mirror command, so an incomplete or broken lock file might cause the cli to crash.
This does seem plausible, but since we added support for using the lock file in #32742 it seems like we have created ourselves a bit of a chicken/egg problem that would be exacerbated by this change. The original goal of If we were to merge this change it seems like we'd break that use-case, because any newly-added provider would be absent from the lock file, #32742 already slightly broke that use-case as we saw in #35318, but the change proposed in this PR seems like it would break it entirely. I can think of a couple different compromises that we could take from here:
|
Thanks @apparentlymart, that matches my what I was looking into myself. I was intending this to work like the former of your options, but inspecting more closely it seems that the lock file was not expected to be there or complete. I don't think this patch makes things any worse, the error it's surfacing would happen regardless, it just guards the panic. I guess you could say it might "work" in that the mirror files would be created, but |
Ah yes, I suppose you are right that this is just replacing the panic with an error. I was imagining that the current code would allow you to change the version constraint for a provider that's already tracked in the lock file and then use But of course that doesn't hold because the subsequent logic would still use the selection from the dependency lock file anyway, so you'd end up just populating the mirror with whatever version was previously selected regardless of what's in the configuration. Although that case would now also be an error, the error isn't actually replacing a useful behavior. |
I'm kind of inclined to add an option to use the lock file, rather than add an option to ignore it. Seeing how we've had both behaviors in releases already, either change is breaking in some way. I do think we need to add an option of some sort, so I guess it's just a matter of choosing between reverting to the original intended behavior along with something like |
The providers mirror command was updated to inspect the lock file, however that was not part of the original intent for the command, and it's possible that the command needs to be run without a lock file. Since we have been honoring the lock file for the past few releases, let's keep that consistent and allow disabling the file with `-lock-file=false`.
OK, proposing that we add a |
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.
- Tested this to reproduce the bug, verify that the "diags not panic" change works, and verify that the new flag switches lock behaviors. All looks solid!
- I approve the new flag name, and I think the default makes sense.
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
The lock file diagnostic were not being checked in the mirror command, so an incomplete or broken lock file might cause the cli to crash.
Add
-lock-file
flag toproviders mirror
command, so that a user can proceed to create a mirror with an incomplete lock file when runninginit
is not an option.Fixes #35318