improvement(knowledge): stop re-probing known indexing providers per access batch - #7968
Merged
Merged
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
|
This branch was previously deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
source_overview.indexingprobe ran in full on every batch, while the sibling searchable probe already stopped once its answer was known.providers[].isSyncing, so a provider type already found cannot change the outcome. Re-probing it re-paid the query'sEXISTSoverdocument— the arm that carries the full ACL predicate — for no new information.configuredcondition, 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 thereforeisSyncing, is identical.hasSearchableDocumentsis untouched.Type of Change
Testing
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/applicationsuite green (878 passing).bun run lint,check:block-registry,bun run check:audits(46),docs-manifest:check, andbun run type-checkall pass. No migrations or schema changes.Checklist