Conversation
Contributor
Greptile SummaryThis PR ensures tenant ID is consistently retrieved from context via Key Changes:
Architecture Alignment: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant API as API Endpoint
participant VespaIndex as VespaIndex (Old Interface)
participant ContextVar as Context Variable
participant TenantState as TenantState
participant VespaDocIndex as VespaDocumentIndex (New Interface)
API->>ContextVar: Sets CURRENT_TENANT_ID_CONTEXTVAR
API->>VespaIndex: Calls id_based_retrieval(filters)
activate VespaIndex
VespaIndex->>ContextVar: get_current_tenant_id()
ContextVar-->>VespaIndex: tenant_id (from context)
VespaIndex->>TenantState: Create TenantState(tenant_id, multitenant)
alt id_based_retrieval - No Validation (Before PR)
VespaIndex->>TenantState: Uses filters.tenant_id or empty string
VespaIndex-->>VespaIndex: May have mismatched tenant_id
end
alt id_based_retrieval - With Context (After PR)
VespaIndex->>VespaIndex: Validates tenant_id from context
VespaIndex->>VespaDocIndex: Create with validated TenantState
end
VespaIndex->>VespaDocIndex: Create VespaDocumentIndex(tenant_state)
activate VespaDocIndex
VespaDocIndex->>VespaDocIndex: Uses validated tenant_state
VespaDocIndex-->>VespaIndex: Returns InferenceChunk[]
deactivate VespaDocIndex
VespaIndex-->>API: Returns chunks with correct tenant isolation
deactivate VespaIndex
|
yuhongsun96
approved these changes
Jan 17, 2026
rohoswagger
pushed a commit
that referenced
this pull request
Jan 19, 2026
…nal tenant ID checks in the new interface (#7480)
jessicasingh7
pushed a commit
that referenced
this pull request
Jan 21, 2026
…nal tenant ID checks in the new interface (#7480)
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.
Description
We're seeing that tenant ID is not being set for ID retrieval, and this is causing issues with the more restrictive document index interface. This PR gets tenant ID from the context and supplies this for document index endpoints that never supplied it. For endpoints that do supply it, this PR just adds an additional check that the supplied ID matches the context ID.
When we get rid of the old interface entirely all this logic will become simpler.
How Has This Been Tested?
Testing locally now.
Additional Options
Summary by cubic
Ensure all Vespa index operations use the context tenant ID and validate it, fixing ID-based retrieval failures and preventing cross-tenant access with the new interface.
Written for commit 1e0652b. Summary will update on new commits.