Skip to content

feat(policy): add GetRegisteredResources batch RPC proto - #3460

Closed
ronelliott wants to merge 4 commits into
mainfrom
feat/get-registered-resources-proto
Closed

feat(policy): add GetRegisteredResources batch RPC proto#3460
ronelliott wants to merge 4 commits into
mainfrom
feat/get-registered-resources-proto

Conversation

@ronelliott

@ronelliott ronelliott commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add GetRegisteredResourcesRequest and GetRegisteredResourcesResponse messages to the registered resources proto
  • Reuses GetRegisteredResourceRequest as the identifier element type (supports oneof id or name with optional namespace context) to avoid duplicating field definitions; max 250 identifiers per request
  • Add GetRegisteredResources RPC to RegisteredResourcesService for batch lookup intended to support ABAC authorization checks before bulk operations
  • Regenerate protocol/go types, connect handlers, SDK wrappers, and API docs

Notes

  • Service-layer implementation is intentionally excluded; protocol/go must be released first before bumping in service/go.mod and adding the implementation

Test plan

  • buf lint service passes clean
  • Generated types present in protocol/go/policy/registeredresources/
  • CI checks pass

Summary by CodeRabbit

  • New Features

    • Added a batch GetRegisteredResources endpoint to request multiple registered resources in one call.
  • Documentation

    • Updated gRPC and OpenAPI docs to include the new endpoint and request/response schemas; also adjusted example formatting and some description whitespace for clarity.

Review Change Stack

## Summary
- Add GetRegisteredResourcesRequest and GetRegisteredResourcesResponse messages to the registered resources proto
- Reuse GetRegisteredResourceRequest as the identifier element type to avoid duplicating field definitions
- Add GetRegisteredResources RPC to RegisteredResourcesService for batch lookup by id or name
- Regenerate protocol/go types, connect handlers, SDK wrappers, and API docs

Signed-off-by: Ron Elliott <ron.elliott@virtru.com>
Copilot AI review requested due to automatic review settings May 11, 2026 19:28
@ronelliott
ronelliott requested review from a team as code owners May 11, 2026 19:28
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a batch lookup capability for registered resources by adding a new RPC endpoint. This change is intended to facilitate more efficient ABAC authorization checks during bulk operations by allowing multiple resources to be retrieved in a single request, while maintaining compatibility with existing identifier definitions.

Highlights

  • New Batch RPC: Added the GetRegisteredResources RPC to the RegisteredResourcesService to support batch lookups of registered resources.
  • Proto Definitions: Introduced GetRegisteredResourcesRequest and GetRegisteredResourcesResponse messages, reusing existing identifier structures with a limit of 250 items per request.
  • SDK Updates: Updated the Connect client wrapper to include the new batch lookup method, ensuring consistency across the generated SDK.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: docs/openapi/**/* (4)
    • docs/openapi/authorization/authorization.openapi.yaml
    • docs/openapi/policy/objects.openapi.yaml
    • docs/openapi/policy/registeredresources/registered_resources.openapi.yaml
    • docs/openapi/policy/subjectmapping/subject_mapping.openapi.yaml
  • Ignored by pattern: protocol/**/* (5)
    • protocol/go/authorization/authorization.pb.go
    • protocol/go/policy/objects.pb.go
    • protocol/go/policy/registeredresources/registered_resources.pb.go
    • protocol/go/policy/registeredresources/registered_resources_grpc.pb.go
    • protocol/go/policy/registeredresources/registeredresourcesconnect/registered_resources.connect.go
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


A batch of requests we send, / To fetch the resources we tend. / With proto in hand, / Across all the land, / The latency comes to an end.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added comp:policy Policy Configuration ( attributes, subject mappings, resource mappings, kas registry) comp:sdk A software development kit, including library, for client applications and inter-service communicati docs Documentation size/s labels May 11, 2026
@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@ronelliott has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 27 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fd8e24c2-8d94-4d8a-b7fb-57a3726c4a50

📥 Commits

Reviewing files that changed from the base of the PR and between cb48717 and be1e26f.

⛔ Files ignored due to path filters (1)
  • protocol/go/policy/registeredresources/registered_resources.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (1)
  • service/policy/registeredresources/registered_resources.proto
📝 Walkthrough

Walkthrough

This PR adds a bulk GetRegisteredResources RPC to RegisteredResourcesService with protobuf message definitions, generated Connect-Go client/server code, an SDK wrapper, OpenAPI and gRPC documentation updates, and a server handler stub that returns Unimplemented.

Changes

GetRegisteredResources Bulk RPC

Layer / File(s) Summary
Proto Message and RPC Definition
service/policy/registeredresources/registered_resources.proto
Introduces GetRegisteredResourcesRequest with a required repeated identifiers field (1–250 entries, each a GetRegisteredResourceRequest) and GetRegisteredResourcesResponse with repeated resources. Adds GetRegisteredResources RPC to RegisteredResourcesService.
Connect-Go Generated Client/Server Code
protocol/go/policy/registeredresources/registeredresourcesconnect/registered_resources.connect.go
Generates procedure constant RegisteredResourcesServiceGetRegisteredResourcesProcedure, extends RegisteredResourcesServiceClient and RegisteredResourcesServiceHandler interfaces with GetRegisteredResources method, constructs unary client/handler in factory functions, and registers HTTP route for request dispatch.
Server Handler Stub
service/policy/registeredresources/registered_resources.go
Adds RegisteredResourcesService.GetRegisteredResources handler that currently returns connect.CodeUnimplemented.
SDK Wrapper Implementation
sdk/sdkconnect/registeredresources.go
Adds GetRegisteredResources method to RegisteredResourcesServiceClient interface and implements forwarding wrapper in RegisteredResourcesServiceClientConnectWrapper using connect.NewRequest pattern.
API and Reference Documentation
docs/openapi/policy/registeredresources/registered_resources.openapi.yaml, docs/grpc/index.html
OpenAPI spec defines POST /policy.registeredresources.RegisteredResourcesService/GetRegisteredResources endpoint with request/response schemas and Connect protocol headers. gRPC documentation adds message definitions and service method entry to table-of-contents.
Documentation Formatting Cleanup
docs/openapi/authorization/authorization.openapi.yaml, docs/openapi/policy/objects.openapi.yaml, docs/openapi/policy/subjectmapping/subject_mapping.openapi.yaml
Adds blank lines within description blocks for improved readability; no schema, endpoint, or property changes.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant SDK as SDK Wrapper
  participant ConnectClient
  participant Server as RegisteredResourcesService

  Caller->>SDK: GetRegisteredResources(request)
  SDK->>ConnectClient: connect.NewRequest(request) -> Call GetRegisteredResources
  ConnectClient->>Server: HTTP/Connect unary RPC GetRegisteredResources
  Server-->>ConnectClient: 200 OK / GetRegisteredResourcesResponse
  ConnectClient-->>SDK: Connect response
  SDK-->>Caller: returns GetRegisteredResourcesResponse
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/m

Suggested reviewers

  • jakedoublev
  • c-r33d

Poem

🐰 A bulk request hops into view,
GetRegisteredResources—fetch a crew!
One call gathers many with ease,
From proto to SDK, constraints at peace.
Docs aligned and stubs in place—hooray!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a GetRegisteredResources batch RPC to the registered resources proto with new request/response messages.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/get-registered-resources-proto

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new batch retrieval method, GetRegisteredResources, to the RegisteredResourcesService, including updates to the Protobuf definitions, Go SDK, and documentation. Feedback suggests improving the Protobuf design by creating a dedicated identifier message instead of reusing the single-resource request message as a field. Additionally, it is recommended to refine the response structure to allow clients to easily correlate returned resources with their requested identifiers, similar to other batch operations in the service.

Comment thread service/policy/registeredresources/registered_resources.proto Outdated
Comment thread service/policy/registeredresources/registered_resources.proto

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new batch RPC to the Policy RegisteredResources API to support bulk lookups (intended for ABAC prechecks), along with regenerated Go/Connect/gRPC bindings and OpenAPI/HTML docs.

Changes:

  • Added GetRegisteredResourcesRequest/Response messages and GetRegisteredResources RPC to RegisteredResourcesService.
  • Regenerated Go protobuf types plus Connect and gRPC client/server stubs to expose the new RPC.
  • Updated OpenAPI and gRPC HTML documentation outputs to include the new endpoint/messages.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
service/policy/registeredresources/registered_resources.proto Defines new batch request/response messages and adds the batch RPC to the service.
sdk/sdkconnect/registeredresources.go Exposes the new batch RPC on the SDK Connect wrapper interface and implementation.
protocol/go/policy/registeredresources/registeredresourcesconnect/registered_resources.connect.go Regenerated Connect transport client/handler code to include the new RPC.
protocol/go/policy/registeredresources/registered_resources.pb.go Regenerated Go protobuf types for the new messages and updated descriptors.
protocol/go/policy/registeredresources/registered_resources_grpc.pb.go Regenerated gRPC client/server stubs and service descriptor to include the new RPC.
protocol/go/policy/objects.pb.go Regenerated output with minor comment formatting change.
protocol/go/authorization/authorization.pb.go Regenerated output with minor comment formatting changes.
docs/openapi/policy/subjectmapping/subject_mapping.openapi.yaml Regenerated docs with minor formatting change.
docs/openapi/policy/registeredresources/registered_resources.openapi.yaml Adds OpenAPI path + schemas for the new batch RPC.
docs/openapi/policy/objects.openapi.yaml Regenerated docs with minor formatting change.
docs/openapi/authorization/authorization.openapi.yaml Regenerated docs with minor formatting changes.
docs/grpc/index.html Regenerated gRPC HTML docs to include the new messages and RPC.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread service/policy/registeredresources/registered_resources.proto

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/grpc/index.html`:
- Around line 14950-14952: The documentation for the required identifiers field
is missing the maximum batch size; update the identifiers field description to
mention the request cap (max 250 identifiers) and clarify that each identifier
supports the same oneof (id or name) and optional namespace context as
GetRegisteredResourceRequest; locate the identifiers description near the
existing GetRegisteredResourceRequest mention and append a short sentence like
"Maximum 250 identifiers per request" so clients know the limit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 992a6c44-244e-4a3d-b014-5d27ea36bdfc

📥 Commits

Reviewing files that changed from the base of the PR and between 69a6210 and 2cd50e3.

⛔ Files ignored due to path filters (4)
  • protocol/go/authorization/authorization.pb.go is excluded by !**/*.pb.go
  • protocol/go/policy/objects.pb.go is excluded by !**/*.pb.go
  • protocol/go/policy/registeredresources/registered_resources.pb.go is excluded by !**/*.pb.go
  • protocol/go/policy/registeredresources/registered_resources_grpc.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (8)
  • docs/grpc/index.html
  • docs/openapi/authorization/authorization.openapi.yaml
  • docs/openapi/policy/objects.openapi.yaml
  • docs/openapi/policy/registeredresources/registered_resources.openapi.yaml
  • docs/openapi/policy/subjectmapping/subject_mapping.openapi.yaml
  • protocol/go/policy/registeredresources/registeredresourcesconnect/registered_resources.connect.go
  • sdk/sdkconnect/registeredresources.go
  • service/policy/registeredresources/registered_resources.proto

Comment thread docs/grpc/index.html
@github-actions

Copy link
Copy Markdown
Contributor

Remove regeneration drift in authorization.pb.go and objects.pb.go caused
by a local buf version difference. Add unimplemented stub for
GetRegisteredResources so the service compiles against the updated interface.

Signed-off-by: Ron Elliott <ron.elliott@virtru.com>
@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 203.420947ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 103.721732ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 412.442669ms
Throughput 242.46 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.516395222s
Average Latency 433.681692ms
Throughput 114.90 requests/second

Remove the RPC from the service definition and revert all generated
files that changed as a result (connect handler interface, grpc stubs,
SDK wrapper). Only the message types ship in this release of protocol/go
so the service module release job is unaffected. The RPC and service
implementation will follow in a subsequent PR after protocol/go is
released and service/go.mod is bumped.

Signed-off-by: Ron Elliott <ron.elliott@virtru.com>
@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 183.933613ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 94.176106ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 425.429512ms
Throughput 235.06 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.270998495s
Average Latency 430.550236ms
Throughput 115.55 requests/second

…okup

Replace reuse of GetRegisteredResourceRequest with a dedicated
RegisteredResourceIdentifier message in GetRegisteredResourcesRequest.
Produces cleaner Go oneof wrapper names (RegisteredResourceIdentifier_Id
vs GetRegisteredResourceRequest_Id) at the call site.

Signed-off-by: Ron Elliott <ron.elliott@virtru.com>
@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 193.797992ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 103.41226ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 405.252438ms
Throughput 246.76 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 42.133953973s
Average Latency 419.596127ms
Throughput 118.67 requests/second

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • examples
  • otdfctl
  • sdk
  • service
  • lib/fixtures
  • tests-bdd

See the workflow run for details.

@c-r33d
c-r33d self-requested a review May 12, 2026 14:32

@c-r33d c-r33d left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make sure to add tests to:

If you haven't already. Just to make sure your request structure works as expected. You can comment them out to avoid any dep issues with not having released the protos first. Once the protos are released, uncomment.

@ronelliott
ronelliott added this pull request to the merge queue May 12, 2026

message GetRegisteredResourcesRequest {
// Required - maximum 250 identifiers per request
repeated RegisteredResourceIdentifier identifiers = 1 [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any concern with uniqueness? As mentioned in the gemini comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my use case no, but others perhaps. should this be updated to a map structure?

@c-r33d
c-r33d removed this pull request from the merge queue due to a manual request May 12, 2026
@c-r33d
c-r33d self-requested a review May 12, 2026 14:41

@c-r33d c-r33d left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Spoke with Ron about using the GetRegisteredResourceValuesByFQNsRequest, but in their use case they only have the name of the RR, not FQN of the value.

@marythought marythought left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting this out so protocol/go can be released ahead of the service-layer implementation — that's the right sequencing.

A couple of consistency issues caught my eye that I think want to be resolved before this merges, plus some ergonomics follow-ups (one of which c-r33d already raised):

Consistency

  1. The GetRegisteredResources RPC isn't actually declared in the service RegisteredResourcesService { ... } block in service/policy/registeredresources/registered_resources.proto. The messages exist and .pb.go is regenerated for them, but there's no rpc GetRegisteredResources(...) entry, so the PR title ("add … batch RPC") and body ("Add GetRegisteredResources RPC to RegisteredResourcesService") don't match what lands. If the intent is messages-only-now / RPC-later, I'd suggest adjusting the title + description to reflect that ("add proto types for the batch lookup RPC") so future readers and release notes aren't confused. If messages-only is the intent: would also recommend dropping the OpenAPI path additions in this PR so the docs don't promise an endpoint that the proto hasn't registered.
  2. docs/openapi/policy/registeredresources/registered_resources.openapi.yaml is out of sync with the proto — it still advertises a POST .../GetRegisteredResources endpoint and its identifiers.items still $refs GetRegisteredResourceRequest instead of the new RegisteredResourceIdentifier. The gencode CI check only validates .pb.go, which is why this slipped past. Worth regenerating, or dropping the OpenAPI changes from this PR if the RPC is intentionally deferred.
  3. The PR body says "Reuses GetRegisteredResourceRequest as the identifier element type" — the latest revision uses a dedicated RegisteredResourceIdentifier instead, so that line is stale.

Ergonomics — inline comments below on:

  • Uniqueness on identifiers (following c-r33d's open question)
  • Response shape doesn't help callers correlate to inputs or detect partial misses — matters specifically for the ABAC pre-check use case this PR justifies
  • RegisteredResourceIdentifier duplicates GetRegisteredResourceRequest's validation byte-for-byte; the two will drift

Happy to chat through any of these if it's easier than going back and forth in comments.


message GetRegisteredResourcesRequest {
// Required - maximum 250 identifiers per request
repeated RegisteredResourceIdentifier identifiers = 1 [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to c-r33d's question on uniqueness. The sibling GetRegisteredResourceValuesByFQNsRequest.fqns already enforces unique: true, and without it here, callers can submit duplicates (or the same resource referenced once by id and once by name+namespace) — wasted work and ambiguous response interpretation. Recommend unique: true unless duplicates are intentionally allowed, in which case a comment explaining why would help.

];
}
message GetRegisteredResourcesResponse {
repeated policy.RegisteredResource resources = 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on the earlier suggestion about correlation — "callers can correlate using names or ids" works for the happy path, but the use case this PR calls out is ABAC pre-checks before bulk operations, and for that the important question is which of my N inputs were misses. With repeated policy.RegisteredResource resources and no preserved order or "not found" markers, the caller has to diff the request against the response and re-map (which gets messier when a batch mixes id-keyed and name+namespace-keyed identifiers).

Two paths that preserve ergonomics without a big design change:

  1. Document the contract in the proto comment: "order preserved; missing identifiers are omitted" (or whatever you actually want). Right now it's undefined, which is the part I'd most want to fix before this ships.
  2. Return paired results — e.g. repeated GetRegisteredResourceResult where each entry carries the input identifier alongside an optional resource. Cheap now, much harder to add later without breaking callers.

Even (1) alone would be a meaningful improvement.


// Identifier for a single registered resource lookup within a batch request.
// Mirrors the identifier fields of GetRegisteredResourceRequest.
message RegisteredResourceIdentifier {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this is a dedicated message (which I think is the right call), it's a byte-for-byte duplicate of the identifier fields on GetRegisteredResourceRequest — same oneof, same CEL rule, same namespace context. These will drift the next time someone updates one and forgets the other.

Two options:

  • Extract a shared inner message that both wrap (e.g., GetRegisteredResourceRequest becomes { RegisteredResourceIdentifier identifier = 1; }). One source of truth for validation.
  • Accept the duplication and add a // Keep in sync with GetRegisteredResourceRequest comment so the next person knows.

Either is fine — leaving it implicit is the risky path.

application/json:
schema:
$ref: '#/components/schemas/policy.registeredresources.GetRegisteredResourceResponse'
/policy.registeredresources.RegisteredResourcesService/GetRegisteredResources:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This yaml is out of sync with the proto on the current branch:

  • It registers this POST .../GetRegisteredResources endpoint, but the proto's service block has no such RPC.
  • Down in the schema definition, identifiers.items $refs GetRegisteredResourceRequest, but the proto now uses RegisteredResourceIdentifier.

CI's gencode check only validates .pb.go, so the OpenAPI drift slipped through. Re-generate, or drop these OpenAPI changes from this PR if the RPC is being deferred.

@jakedoublev

Copy link
Copy Markdown
Contributor
  • Response shape doesn't help callers correlate to inputs or detect partial misses — matters specifically for the ABAC pre-check use case this PR justifies

This is a big one. Is it better to correlate with guaranteed order from input to output or respond with a map from input name to output name: resource? Also, if any are not found, does the entire request fail?

We also have a pretty solidified Get, Create, Update, Delete, List and maybe GetByFQN or UnsafeXYZ per policy object. I'm pretty sure this will be the only Get RPC that is a bulk lookup not relying on FQNs. Why is it not possible to use FQNs? If it is indeed not possible, can we please name it GetRegisteredResourcesBulk to differentiate?

@c-r33d

c-r33d commented May 12, 2026

Copy link
Copy Markdown
Contributor
  • Response shape doesn't help callers correlate to inputs or detect partial misses — matters specifically for the ABAC pre-check use case this PR justifies

This is a big one. Is it better to correlate with guaranteed order from input to output or respond with a map from input name to output name: resource? Also, if any are not found, does the entire request fail?

We also have a pretty solidified Get, Create, Update, Delete, List and maybe GetByFQN or UnsafeXYZ per policy object. I'm pretty sure this will be the only Get RPC that is a bulk lookup not relying on FQNs. Why is it not possible to use FQNs? If it is indeed not possible, can we please name it GetRegisteredResourcesBulk to differentiate?

I agree with the renaming of the RPC. After speaking with Ron, he mentioned that S4 only has the name of the RR not the namespace. But now that I think about it that might break when namespacing is released. So S4 might need to update their code to start storing the FQN.

@c-r33d
c-r33d self-requested a review May 12, 2026 15:41
@ronelliott

Copy link
Copy Markdown
Contributor Author

@jakedoublev @c-r33d should we maybe change it to GetRegisteredResourcesByName, returning the map structure similar to the ByFQN methods and drop the by ID lookup? this more closely matches our specific use case and broadens the API surface a bit less.

@ronelliott

Copy link
Copy Markdown
Contributor Author

per the discussion we will go a different route so I'm closing this PR

@ronelliott ronelliott closed this May 13, 2026
@ronelliott
ronelliott deleted the feat/get-registered-resources-proto branch May 13, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:policy Policy Configuration ( attributes, subject mappings, resource mappings, kas registry) comp:sdk A software development kit, including library, for client applications and inter-service communicati docs Documentation size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants