Repository navigation
bugs-tab - Fix count on repos that use types inconsistently - #10086
Conversation
| return { | ||
| // Label might not be found if the repo uses a non-standard bug label name | ||
| label: label?.name ?? 'bug', | ||
| label: label ? label.name : 'bug', |
There was a problem hiding this comment.
This and the one above are unnecessary and should be reverted
| // Exact counting needs the selected bug label, but it should not delay the tab | ||
| void exactBugs.get(label) | ||
| .then(exactCount => { | ||
| counter.set(exactCount); | ||
| }) | ||
| .catch(() => undefined); |
There was a problem hiding this comment.
This should be moved outside the current try/catch, and use await with try/catch instead of then/catch
| } | ||
|
|
||
| async function countExactBugs(label: string): Promise<number> { | ||
| const query = `repo:${getRepo()!.nameWithOwner} is:issue state:open ${getFullSearchQuery(label)}`; |
There was a problem hiding this comment.
We don't need to create this again here because it's already generated in
refined-github/source/features/bugs-tab.tsx
Lines 112 to 113 in 1338dbe
You can alter that line to:
const {href, query} = new SearchQuery(buildRepoUrl('issues'))
.append(getFullSearchQuery(await getBugsLabel()));and then pass the full query to countExactBugs
bugs-tab - Fix count on repos that use types inconsistently
|
Thanks for the feedback. I addressed all three points:
CI is green on the latest revision. Could you take another look when you have a chance? |
fregante
left a comment
There was a problem hiding this comment.
Should be good to go. Thank you!
|
It seems to me that this was not tested at all, you just let the error through without verifying that the bug was fixed. The API always returned zero |

Closes #8579
The Bugs tab currently approximates the union of bug-labeled issues and
type:Bugissues withMath.max(), which can undercount repositories where the two sets only partially overlap.This keeps the existing first request on the critical path so the tab can appear as quickly as before.
After the tab is added and the approximate count is shown, an exact search runs asynchronously using the same query as the Bugs tab:
is:issue state:open (label:<bug label> OR type:Bug)When that request completes, it updates the counter with the exact
issueCount. The exact result is cached per repository and bug label.If the exact request fails, the existing approximate count remains in place, so the extra request does not block or remove the tab.
Test URLs
https://github.com/microsoft/vscode/issues?q=sort%3Aupdated-desc+is%3Aissue+state%3Aopen+%28label%3Abug+OR+type%3ABug%29
At the time of visual verification:
label:bug: 6,121type:Bug: 106All CI checks pass on the revised implementation: Format, Lint, Types, Vitest, Verify, Security, Ubuntu Build, and Windows Build.
Screenshot