control-plane-api: add filter to the liveSpecs GraphQL query and deprecate by - #3383
Draft
GregorShear wants to merge 2 commits into
Draft
control-plane-api: add filter to the liveSpecs GraphQL query and deprecate by#3383GregorShear wants to merge 2 commits into
filter to the liveSpecs GraphQL query and deprecate by#3383GregorShear wants to merge 2 commits into
Conversation
Gives `liveSpecs` the same treatment `storageMappings` received in #3242. The `by` argument is now optional and deprecated, replaced by a composable `filter` with a `catalogName` PrefixFilter: `startsWith` replaces `by.prefix` and `in` replaces `by.names`. The two arguments are mutually exclusive and authorize differently: `by` keeps its exact legacy contract — requiring a `names` or `prefix` selection and failing the entire request on an unauthorized name — while `filter` resolves through `filtered_authorized_prefixes` and only narrows the caller's readable prefixes. Omitting both returns every live spec the caller can read, subject to the same MAX_PREFIXES guard as `storageMappings`. Both paths resolve into one shared SQL query: the filter path adds text[] binds for the caller's read prefixes and the exact `in` set, leaving the legacy predicates untouched.
…as a stable layout rustfmt flip-flops between two layouts of the long tuple-match scrutinee — `cargo fmt` writes one and `cargo fmt --check` demands the other — which failed CI's format check. Matching on `by` alone keeps the scrutinee short enough for a single stable layout.
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.
Gives
liveSpecsthe same treatmentstorageMappingsreceived in #3242: thebyargument is now optional and deprecated, replaced by a composablefilterargument with acatalogNamefilter backed by the sharedPrefixFilterinput.API changes
liveSpecs(by:)is optional and deprecated. It is retained for existing clients and its behavior is unchanged: it requires anamesorprefixselection, applies its predicates conjunctively, and fails the entire request on an unauthorized name or prefix.liveSpecs(filter: { catalogName: { startsWith | in } }).startsWithreplacesby.prefix(subtree match) andinreplacesby.names(exact set). The filter only narrows: results are scoped to the prefixes where the caller has catalog-read capability, and unauthorized or unknown filter entries are dropped rather than erroring.byandfilterreturns every live spec the caller can read. As withstorageMappings, a caller with more than 20 readable prefixes must narrow with a filter.byandfilterare mutually exclusive.Implementation
Both paths resolve into one shared SQL query. The legacy
bypredicates are untouched; the filter path adds twotext[]binds: the caller's authorized read prefixes (^@ any(...)scoping) and the exactinset. The filter path reusesfiltered_authorized_prefixes, so the narrow-only invariant has the same single owner asstorageMappings,alertConfigs, andinviteLinks.Testing
startsWith/innarrowing, cross-tenant entries dropped, empty-filter forms, mutual exclusions, theMAX_PREFIXESguard, and the preservedbyerror behaviors.filter.catalogNameas two users with different grants.