Backport: add index for auth creds (#3562) to V5.4#4205
Merged
Conversation
Adds the compound index `index_auth_subject_purpose_resources` (credentialSubject.id + purposeOfUse + resources.path) so POST /internal/vcr/v2/search queries for NutsAuthorizationCredential stop falling back to `index_issuer` and scanning every credential issued by the requesting care organization. Also removes the now-redundant `index_subject` (its parts are a prefix of the new index). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Coverage Impact This PR will not change total coverage. 🚦 See full report on Qlty Cloud »🛟 Help
|
stevenvegt
approved these changes
Apr 17, 2026
Cherry-picked 091684c. The Vault CI runner rejects setcap and the e2e test racing against vault startup caused DID creation to hit a context-deadline-exceeded against vault-adapter. Added service_healthy dependencies and SKIP_SETCAP=true. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Backports #3562 / #3564 ("add index for auth creds") to the V5.4 release branch.
index_auth_subject_purpose_resourcesoncredentialSubject.id+purposeOfUse+resources.pathindex_subject(its single part[credentialSubject]is a prefix of the new index)Why
POST /internal/vcr/v2/searchqueries againstNutsAuthorizationCredentialcurrently fall back toindex_issueron V5.4, because V5.4's index set only has single-part indices that score 1 for this query —findIndextakes the first such match by yaml order, i.e.index_issuer. That forces go-leia to scan every credential issued by the requesting care organization.Reporter case on v5.4.26 shows
documents_scanned=730,documents_matched=2,leia_index_used=index_issuerfor this exact query shape.With the new compound index, the same query scores 3 on
index_auth_subject_purpose_resourcesand wins — scan set collapses from "all issued VCs" to "issued VCs matching (subject, purposeOfUse, path)".Test plan
TestVCR_Startbucket assertionsgo test ./vcr/...passes locallyleia_index_usedswitches toindex_auth_subject_purpose_resourcesand search latency drops