Repository navigation
feat(dir): add DB-backed SearchService.ListRecordSummaries - #2328
Merged
Merged
Conversation
Contributor
|
The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).
|
There was a problem hiding this comment.
🟡 Changes recommended
Request cancellation is not propagated to database work, and documented OpenShift authorization policies omit the new RPC.
2 open findings
What changed in this PR
Adds fast, database-backed paginated record summaries without OCI pulls.
Changes:
- Adds the
ListRecordSummariesRPC and generated bindings. - Extracts shared filtered paging/counting queries.
- Adds database/controller tests and documentation.
| File | Description |
|---|---|
server/types/search.go |
Defines summary page limits. |
server/types/database.go |
Extends the search database API. |
server/database/gorm/record.go |
Reuses shared count/order helpers. |
server/database/gorm/record_summaries.go |
Maps database records to summaries. |
server/database/gorm/record_summaries_test.go |
Tests summary listing behavior. |
server/database/gorm/record_query.go |
Implements shared paging/counting queries. |
server/database/gorm/record_query_test.go |
Tests shared query behavior. |
server/database/gorm/catalog.go |
Refactors catalog queries onto shared helpers. |
server/controller/search.go |
Implements the RPC controller. |
server/controller/search_test.go |
Tests request translation and errors. |
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 |
Announces the RPC. |
api/search/v1/search_service.pb.go |
Adds generated protobuf types. |
api/search/v1/search_service_grpc.pb.go |
Adds generated gRPC bindings. |
Files not reviewed (2)
- api/search/v1/search_service.pb.go: Generated file
- api/search/v1/search_service_grpc.pb.go: Generated file
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
akijakya
force-pushed
the
feat/list-record-summaries
branch
from
October 13, 2026 14:07
2ec3a0e to
0685de5
Compare
…nt queries Add recordQuery (filters + policy gate), pageRecords (DISTINCT records.* page with caller-supplied ordering, preloads and Limit+1 peek-ahead) and countRecords (distinct CID count with uint32 guard). Rebuild GetCatalogEntries, CountCatalogEntries and CountRecords on them with no behaviour change, so later work can page records straight from the DB. Signed-off-by: András Jáky <[email protected]>
Add a unary RPC returning paginated, database-backed record summaries with has_more and total_count. It never pulls from the store. Generated Go code regenerated via task api:gen. Signed-off-by: András Jáky <[email protected]>
Add SearchDatabaseAPI.ListRecordSummaries, built on the shared record query layer (recordQuery + pageRecords). It defaults the limit to 50 and clamps it to 100 (exported constants in server/types), maps records to RecordSummary using the OASF created_at, and returns sorted, non-nil name lists. Fakes implementing the interface get stubs. Signed-off-by: András Jáky <[email protected]>
Serve record summaries from the database only. The controller applies the default (50) and maximum (100) page size, maps sort mode, and fills total_count via CountRecords using the same filters without paging. Signed-off-by: András Jáky <[email protected]>
…rify ordering docs Map an already-cancelled context to codes.Canceled, document that recency orders by index time rather than created_at, cover the join-filter plus popularity-sort dedupe case, and reuse orderNeedsUsageMetrics. Signed-off-by: András Jáky <[email protected]>
Signed-off-by: András Jáky <[email protected]>
…mples 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]>
Member
|
@akijakya can you fix the conflict ? |
akijakya
force-pushed
the
feat/list-record-summaries
branch
from
October 14, 2026 08:02
0685de5 to
fbb4747
Compare
akijakya
enabled auto-merge
October 14, 2026 08:41
ramizpolic
approved these changes
Oct 14, 2026
This was referenced Oct 18, 2026
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
Adds
SearchService.ListRecordSummaries, a unary RPC that pages through records straight from the database and never pulls from the OCI store, so list-style clients (lazydir, CLIs, scripts) get the same instant paginated listing the AI Catalog UI has. To make that possible without duplicating SQL, the filtered-record query that lived insideGetCatalogEntriesis extracted into a shared layer that the catalog and both counts are now built on.Changes
server/database/gorm/record_query.go):recordQuery(cfg)applies allRecordFilters(including exclusions and the policy gate) viahandleFilterOptions;pageRecords(query, cfg, order, preloads...)addsDISTINCT, preloads, caller-supplied ordering, offset and limit+1 peek-ahead;countRecords(query)counts distinct records.GetCatalogEntries,CountCatalogEntriesandCountRecordsare rebuilt on the shared layer. The catalog-only filters (known modules, media type, tags) live in onecatalogQueryhelper shared by listing and counting. Only two internal error strings changed wording ("query catalog records" → "query records", "count catalog records" → "count records"); nothing matches on them.ListRecordSummaries(ListRecordSummariesRequest) returns (ListRecordSummariesResponse)takingqueries,limit,offset,sort_mode, returningrecords,has_moreandtotal_count.RecordSummarycarries cid, name, version, schema version, description, OASFcreated_at, and sorted authors / skill / domain / module names.ListRecordSummariesmaps preloaded rows to summaries; the controller defaults the page size to 50 and clamps it to 100, takestotal_countfrom the existingCountRecordswith the same filters, and returns gRPC context status on cancellation.SearchRecordsis unchanged for callers that need full records.Why
SearchRecordsresolves a page of CIDs from the database, then pulls each record from the OCI store sequentially before streaming it. Againstads.outshift.iothat is ~200 ms per record (~10–12 s for 50), whileCountRecords/ListFilterValuestake ~165 ms andListAgentsis instant because it answers from the database only. List clients only need fields the database already indexes, so the pulls are pure overhead for them.Testing
created_at, sorted non-nil lists, positive and negated filters, popularity sort, JOIN filter combined with popularity sort, policy gate, limit default/clamp) and the controller (query translation, limits, offset, sort mapping,total_count, error paths, cancelled context).task lint,task lint:bufandtask test:unitpass.has_more/ offset paging, clamping and skill filtering, ~1 ms per warm call.Notes for reviewers
SELECT DISTINCT records.*with preloads as inGetCatalogEntries, and the usage-metricCOALESCEexpressions in the select list for popularity / provider-count ordering as inGetRecordCIDs.SORT_MODE_RECENCYorders by when this registry indexed the record (same asSearchRecords), not by the record's OASFcreated_at; the request field docs say so.ListRecordSummaries.total_countcome from two queries, so the total can drift slightly under concurrent writes, as withListAgents.Closes #2259