Skip to content

improvement(knowledge): stop re-probing known indexing providers per access batch - #7968

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/source-overview-indexing-guard
Sep 18, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/source-overview-indexing-guard

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The search source overview iterates access batches; the source_overview.indexing probe ran in full on every batch, while the sibling searchable probe already stopped once its answer was known.
  • The indexing result is only read back as set membership when projecting providers[].isSyncing, so a provider type already found cannot change the outcome. Re-probing it re-paid the query's EXISTS over document — the arm that carries the full ACL predicate — for no new information.
  • Skip the probe entirely once every configured provider type is accounted for, and exclude already-found types from the query on later batches (no predicate emitted when the set is empty).
  • Safe by construction: the provider list and the indexing probe build on the same configured condition, and the probe only adds narrowing predicates, so its result types are a subset of the configured ones. Excluding a found type cannot suppress a type that would otherwise be discovered — the final set, and therefore isSyncing, is identical. hasSearchableDocuments is untouched.

Type of Change

  • Bug fix (performance)

Testing

  • Extended search-source-overview.test.ts: a second access batch no longer re-probes once every configured type is known, and still probes while one is unaccounted for. Verified both new assertions fail when the guard is removed.
  • lib/knowledge/application suite green (878 passing).
  • bun run lint, check:block-registry, bun run check:audits (46), docs-manifest:check, and bun run type-check all pass. No migrations or schema changes.

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)

…access batch

The search source overview loops over access batches and, for each one, ran the
indexing probe in full. That probe's result is only ever read back as set
membership when projecting `isSyncing`, so a provider type already found cannot
change the answer — every later batch re-paid an EXISTS scan over `document`
carrying the full ACL predicate for nothing.

Mirror the searchable probe's existing guard: skip the indexing probe once every
configured provider type is accounted for, and exclude already-found types from
the query on later batches. Both queries build on the same configured condition
and the probe only adds narrowing predicates, so the resulting set is unchanged.
@vercel

vercel Bot commented Sep 18, 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 18, 2026 7:32am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the optimization preserves the final provider syncing state while avoiding redundant queries.

Summary

This PR reduces redundant indexing-status queries while preserving the accumulated provider result.

  • Stops indexing probes after every configured provider type has been found.
  • Excludes provider types already found by earlier access batches.
  • Adds tests covering both early termination and continued probing for unaccounted provider types.

Reviews (1) · Last reviewed commit: "improvement(knowledge): stop re-probing ..."

@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

@waleedlatif1
waleedlatif1 merged commit d0a9497 into staging Sep 18, 2026
34 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/source-overview-indexing-guard branch September 18, 2026 07:39

This branch was previously deployed

1 inactive deployment
Preview 7ccefe20 Deployed Sep 18, 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