Skip to content

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

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/knowledge-list-counts-legacy-default
Sep 28, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/knowledge-list-counts-legacy-default

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • 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

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)

@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 28, 2026 3:25am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[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"]
Loading

Reviews (2) · Last reviewed commit: "test(knowledge): cover the internal list..."

Comment thread apps/sim/lib/api/contracts/knowledge/base.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit a657493 into staging Sep 28, 2026
32 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/knowledge-list-counts-legacy-default branch September 28, 2026 04:00

This branch was previously deployed

1 inactive deployment
Preview — fe9ab3a8 Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant