-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Source priority #6029
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
Source priority #6029
Conversation
| Type = DefaultSourceType, | ||
| TrustLevel = TrustedTrustLevel, | ||
| Explicit = true, | ||
| Priority = 42, |
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 see what you did 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.
On obviously arbitrary number for testing purposes only...
In such a scenario (for a single result as you mentioned), it may be worth checking if one of the sources returned version "Unknown" for the package (common with |
Implements #1488
Change
Adds the concept/value of priority to sources. This is an integer value (default 0) where greater numbers are sorted first. This is an editable value of a source. Priority has been added to the following interfaces:
sourceadd/edit/list/export)sourceresourceSources are sorted by priority in the list of sources, which has minor effects such as changing the order in
source listand the order of available sources when constructing the default composite source. That default composite ordering has always had the effect of making equal match type/field results dependent on the order, but now the priority can affect the third order sorting.The larger effect is when multiple sources return results for an operation targeting available packages (ex.
install). In this case, if there is only one result amongst the sources at the highest returned priority, then that will be used instead of producing an error about multiple results. For example, if all sources return one result and the priorities are { Source A = 2, Source B = 1, Source C = 0 }, then the result from Source A would be installed without any additional user input (although a warning is output to indicate this has happened). But if the priorities are { Source A = 2, Source B = 2, Source C = 0 }, then an error similar to the existing one will be presented with only the A and B source results.REST match criteria
A TODO has also been resolved in the REST source code that evaluates the match criteria of REST results so that they may be sorted properly amongst the winget-pkgs results. Previously they were always using default values (0s) which would cause them to be sorted first.
Validation
Added tests across the spectrum of use.
Microsoft Reviewers: Open in CodeFlow