Repository navigation
feat(api): search service to list filter values - #2121
Merged
Merged
Conversation
Contributor
|
The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
akijakya
force-pushed
the
feat/searchservice-listrecordvalues
branch
from
September 8, 2026 11:21
ad5f08e to
cb7d61a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The author round-trip bug, unbounded response, and duplicate-field amplification must be resolved.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds registry-wide filter-value discovery to SearchService and limits catalog tag discovery to OASF skills and domains.
Changes:
- Adds the
ListFilterValuesRPC and generated bindings. - Implements distinct-value queries for five record fields.
- Removes annotations from catalog tag discovery.
- Adds controller and database coverage.
Required fixes:
- Critical (2 votes): Author values containing JSON-escaped characters do not round-trip into record queries.
- Moderate (1 vote): The unbounded response may exceed the server’s 4 MiB message limit; add pagination, continuation, or streaming.
- Moderate (1 vote): Duplicate requested fields cause repeated registry scans and duplicated response data; reject or deduplicate them.
File summaries
| File | Description |
|---|---|
server/types/search.go |
Defines supported fields and result types. |
server/types/database.go |
Extends the database interface. |
server/database/gorm/filter_values.go |
Implements distinct-value queries and author flattening. |
server/database/gorm/catalog.go |
Reuses distinct queries and excludes annotations. |
server/database/database_test.go |
Tests database behavior. |
server/database/catalog_test.go |
Updates catalog-tag expectations. |
server/controller/search.go |
Implements and validates the RPC. |
server/controller/search_test.go |
Tests controller behavior. |
server/controller/ai_finder_test.go |
Updates catalog response tests. |
reconciler/tasks/signature/task_test.go |
Updates the database test double. |
proto/agntcy/dir/search/v1/search_service.proto |
Defines the new RPC and messages. |
CHANGELOG.md |
Documents API and behavior changes. |
api/search/v1/search_service.pb.go |
Updates generated protobuf messages. |
api/search/v1/search_service_grpc.pb.go |
Updates generated gRPC bindings. |
Review details
Files not reviewed (2)
- api/search/v1/search_service.pb.go: Generated file
- api/search/v1/search_service_grpc.pb.go: Generated file
- Files reviewed: 12/14 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ramizpolic
approved these changes
Sep 9, 2026
Signed-off-by: András Jáky <[email protected]>
…tations Signed-off-by: András Jáky <[email protected]>
Signed-off-by: András Jáky <[email protected]>
Signed-off-by: András Jáky <[email protected]>
Signed-off-by: András Jáky <[email protected]>
Authors are stored JSON-encoded, so encoding/json escapes quotes, backslashes and, by default, &, < and >. Two defects meant a value could be listed by ListFilterValues but match no record when fed back into a query. The author filter compared a caller's decoded value against the raw serialized array, so `Jane "JJ" Doe` and `A & B Corp` never matched. The pattern is now JSON-encoded first, against the same representation the column stores. Wildcards survive the encoding untouched, so pattern semantics are unchanged. convertGlobToLike built conditions declaring ESCAPE '\' but never escaped literal backslashes in the pattern, so each escape swallowed the following byte and & degraded to u0026. Fixed there rather than at the call site, which repairs every wildcard filter rather than just authors. Both defects predate ListFilterValues; surfacing values that then match nothing is what made them reachable. Also reject duplicate fields in ListFilterValues with InvalidArgument. Each repeat cost another registry scan and another copy of that field's values, and requesting the same facet twice has no meaning. Refs #2012 Signed-off-by: András Jáky <[email protected]>
akijakya
force-pushed
the
feat/searchservice-listrecordvalues
branch
from
September 9, 2026 09:54
81bcf14 to
2dc0d6f
Compare
akijakya
enabled auto-merge (squash)
September 9, 2026 09:54
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.
SearchServicehad no way to enumerate the distinct values present in the registry for a record field, so a client building a filter panel had to fetch every record and aggregate them itself — exactly what pagination is meant to avoid. The only distinct-values query that existed,AIFinderService.ListTags, sat behind the AI Catalog projection and was shaped for the catalog UI.What this adds
SearchService.ListFilterValues, reusingRecordQueryTypeas the field selector so no new field vocabulary is introduced.Supported fields:
SKILL_NAME,MODULE_NAME,DOMAIN_NAME,AUTHOR,SCHEMA_VERSION. The name variants are used rather than the numeric*_IDtypes so every value is a human-meaningful string.Values are returned verbatim in the form a
RecordQueryaccepts, so they feed straight back intoSearchCIDs,SearchRecords, orCountRecords— a value from a filter panel can never produce an empty result, because it is there only if some record carries it. Values are registry-wide, with no catalog module restriction and no query context.Response entries mirror the order the fields were requested in; an empty request returns every supported field ordered by ascending
RecordQueryTypenumber. Requesting an unsupported type fails withInvalidArgumentnaming the supported set, rather than silently omitting it.Placed on
SearchServicerather than the catalog for the same layering reason asCountRecords(#1939): a general capability belongs on the general API. It is immediately callable by every client, sinceSearchServiceClientis already embedded inclient.Client. No REST endpoint is added — the HTTP gateway registers onlyAIFinderService.Behavior change:
GET /v1/tagsno longer returns annotationsListCatalogTagsnow derives tags from OASF skills and domains only. Record annotations are free-form per-deployment metadata with unbounded cardinality, which makes them noise in a discovery panel.Annotations remain filterable: tag filters still parse annotation tags, and
CatalogEntry.Tagsstill carries per-record annotations, so only the global discovery list is affected. No UI change was needed — the catalog UI renders whatever/v1/tagsreturns.This also completes the consolidation the issue asked for. Rather than growing
ListFilterValuesinto a superset ofListTags, dropping annotations madeListTagsa subset, so both surfaces now share one distinct-values helper and cannot disagree about which values the registry holds.Notes for review
Authors are the one field with no schema support. They are a JSON array on
recordsrather than a child table, so they cannot be plucked with a plainDISTINCT. The array is unnested in Go rather than with SQL JSON functions, keeping one code path across the SQLite and Postgres backends instead ofjson_eachversusjsonb_array_elements_text.DISTINCTstill collapses records sharing an author list before the payloads reach Go. Unparsable payloads are logged and skipped so one malformed record cannot fail the whole call. No migration is required.VERSIONis deliberately unsupported. A record's own version is per-record identity rather than a shared facet, so a registry-wide distinct list grows with the registry and answers no question a filter panel asks. It becomes meaningful only with a query context scoping it to one record, which this RPC does not take. Removing it before release is cheap; removing it after would break callers.LOCATORis deliberately unsupported pending the locator refactor in agntcy/oasf#493.Both omissions are additive to reverse: the request is a repeated enum and the response is keyed by field, so adding a field later breaks nothing.
Response size is bounded only by convention, tracked in #2124.
AUTHORis the one field whose value count grows with the registry, so a large enough registry produces a response no client can receive. It is deferred rather than fixed here because a per-field cap or page tokens are both backward-compatible additions; only a unary-to-streaming switch would be foreclosed, and streaming does not help since the limit is enforced per message andAUTHORis a single message.Author values now round-trip correctly, which required fixing two pre-existing defects surfaced by this RPC. The author filter compared a caller's decoded value against the raw serialized JSON array, so any author containing a character
encoding/jsonescapes — quotes, backslashes, and by default&,<,>— matched nothing. Separately,convertGlobToLikebuilt conditions declaringESCAPE '\'without escaping literal backslashes in the pattern, so each escape swallowed the byte after it. Both are fixed at the filter layer, which repairs every wildcard filter rather than only authors.Testing
Unit tests cover the DB layer (per-field distinct values, dedup across records, author flattening, records missing an optional field, empty registry, unsupported field) and the controller (field pass-through, request-order preservation,
InvalidArgumentbefore the database is touched, error wrapping).Verified manually against a local
dirctl daemon: all five fields return real values, subset requests preserve order, unsupported fields are rejected, returned values round-trip intoCountRecords, and an annotated record confirmsteam=platformis absent fromListTagswhiletags="team=platform"still filtersListAgentsto that record.Closes #2012