You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(knowledge): count documents through the reader's access and only where counts are shown #8329 added includeCounts to the internal GET /api/knowledge list, defaulting to false, and made tokenCount optional in the response. A page loaded before that deploy sends no flag, and its contract still requires tokenCount on every row, so every knowledge base list in an open tab (the Knowledge page, KB selector, search modal, mentions, resource tabs) fails contract validation until the tab reloads
A missing flag now means counted. Current clients always send it: fetchKnowledgeBases passes an explicit boolean, and appendQuery serializes false. So only a pre-flag page gets the totals it requires, and the counts still go through the reader's access
The Copilot mention picker omitted the flag and only reads id and name, so it now sends includeCounts: false
No other response shape in the release became optional or dropped a field. I diffed every contract between main and staging
Type of Change
Bug fix
Testing
Parsing the list query: no flag → counted, false → uncounted, true → counted
Lint, all 51 audits, type-check, and the knowledge query/application/page suites (594 tests) pass
[Medium risk] Changes default behavior for knowledge-base list count queries.
The PR appears safe to merge; the legacy count behavior is covered without changing current clients’ explicit choices.
Summary
The PR restores document totals for internal knowledge-base list requests that omit includeCounts, while explicitly disabling counts for the Copilot mention picker. A new route-level integration test covers the omitted-flag and explicit-false cases. The previously reported missing compatibility test is addressed.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A["Internal knowledge list request"] --> B{"includeCounts"}
B -->|"omitted or true"| C["Return access-scoped totals"]
B -->|"false"| D["Return list without totals"]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
includeCountsto the internalGET /api/knowledgelist, defaulting to false, and madetokenCountoptional in the response. A page loaded before that deploy sends no flag, and its contract still requirestokenCounton every row, so every knowledge base list in an open tab (the Knowledge page, KB selector, search modal, mentions, resource tabs) fails contract validation until the tab reloadsfetchKnowledgeBasespasses an explicit boolean, andappendQueryserializesfalse. So only a pre-flag page gets the totals it requires, and the counts still go through the reader's accessincludeCounts: falseType of Change
Testing
false→ uncounted,true→ countedChecklist