microsoft / DevHomeAzureExtension

Dev Home Azure Extension
MIT License
68 stars 15 forks source link

Pull Request widget can indicate more PRs when they're aren't #70

Open krschau opened 7 months ago

krschau commented 7 months ago

Dev Home Azure Extension version

0.2

Steps to reproduce the bug

If the number of issues returned equals the max number shown, a message is shown saying there are more, but there aren't. Change >= to > in "$when": "${(count(items) >= maxItemsDisplayed)}" https://github.com/microsoft/DevHomeAzureExtension/blob/main/src/AzureExtension/Widgets/Templates/AzurePullRequestsTemplate.json

Query list widget does not have this issue.

dkbennett commented 7 months ago

This was intentional, because we don't actually know the full number of pull request items.

There's an API to tell us the total number of work items in a Query result, but there is no such API for pull request search. As the number of pull requests could be in the thousands or more for a large repository and a broad search, we limit the search to the top N items.

Since we don't know the count, we make an assumption that if we have N results its likely there's more than N, knowing that in the case where result count is actually N, we give the wrong result.

We could work around this by doing a second API call for N+1 items and if that count is N then we know we are in the exact N case to have precisely accurate indicator in the widget. IMO that isn't worth making a second relatively expensive GetPullRequestsAsync call for an unlikely scenario. I would prefer to change the messaging in the widget to indicate "N or more" instead of "more than N".

krschau commented 7 months ago

Thanks for the explanation -- agreed that it's not worth the second API call, but sneaking in a wording change could be good.