fix(knowledge): serve list totals when a request omits the count flag

Merged
WA
1mo ago
+34-5

Summary

  • #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

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)