MILAB-XXXX: admin panel SDK — regen pl-client gRPC bindings (PF-0) [partial]#1698
MILAB-XXXX: admin panel SDK — regen pl-client gRPC bindings (PF-0) [partial]#1698vgpopov wants to merge 5 commits into
Conversation
…and CommandAPI types Add Command/CmdError/CommandResult messages plus Query and Mutation RPCs to service Platform in api.proto. Regenerate proto-grpc/* via generate-grpc.sh. PlatformClient and IPlatformClient now expose query()/mutation() methods.
…anonical state Revert google/rpc/error_details.ts, google/api/http.ts, google/rpc/code.ts, google/rpc/status.ts to their pre-PF-0 (HEAD~1) content. The previous commit accidentally regenerated them from a different cached googleapis .proto vintage (Copyright 2025 vs 2020), violating PF-0's "pure codegen / clean base" requirement. Also add a TRACKING comment to api.proto's Command bus RPCs noting that once PL-0 lands on pl/main, pnpm update-proto should be re-run to confirm the hand-written proto matches the canonical upstream version.
Regenerates the TS gRPC bindings for service Platform from the pl admin-panel proto, adding the Query/Mutation command-bus RPCs and CommandAPI types to PlatformClient. Partial: PF-1 (pl-client query/mutation passthrough), PF-2 (AdminDriver), PF-3 (middle-layer registration) still pending.
|
There was a problem hiding this comment.
Code Review
This pull request introduces new administrative and command-bus capabilities to the Platform service, including the ListUsers RPC, transactional ListGrants support, and generic Query and Mutation endpoints. Key feedback on these changes includes adding REST gateway support (google.api.http option) and pagination to the ListUsers endpoint. Additionally, it is recommended to replace the bytes fields in the command bus payloads (Command.payload and CommandResult.data) with google.protobuf.Value or Struct to prevent REST transcoding from forcing base64 encoding instead of raw JSON.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| } | ||
| rpc ListUserResources(AuthAPI.ListUserResources.Request) returns (stream AuthAPI.ListUserResources.Response) {} | ||
|
|
||
| rpc ListUsers(AuthAPI.ListUsers.Request) returns (AuthAPI.ListUsers.Response) {} |
There was a problem hiding this comment.
Unlike other unary RPCs in the Platform service, ListUsers is missing the google.api.http option. If this RPC needs to be accessible via the REST gateway (e.g., for the admin panel or external REST clients), please add the appropriate HTTP option.
Example:
rpc ListUsers(AuthAPI.ListUsers.Request) returns (AuthAPI.ListUsers.Response) {
option (google.api.http) = {
get: "/v1/users"
};
}| rpc ListUsers(AuthAPI.ListUsers.Request) returns (AuthAPI.ListUsers.Response) {} | |
| rpc ListUsers(AuthAPI.ListUsers.Request) returns (AuthAPI.ListUsers.Response) { | |
| option (google.api.http) = { | |
| get: "/v1/users" | |
| }; | |
| } |
| message ListUsers { | ||
| message Request {} | ||
|
|
||
| // Lists users known to the server. A user becomes known on first login; | ||
| // provisioned users who have never logged in do not appear. | ||
| message Response { | ||
| repeated User users = 1; | ||
| } | ||
| } |
There was a problem hiding this comment.
The ListUsers RPC currently returns all users in a single unpaginated list. If the number of users grows large, this can lead to performance bottlenecks, high memory usage, or exceeding gRPC message size limits.
Consider adding pagination fields (such as limit and offset/after or page tokens) to ListUsers.Request and ListUsers.Response to ensure the API scales efficiently.
| // payload is an opaque JSON object passed verbatim to the handler. | ||
| // May be empty when a command takes no arguments. | ||
| bytes payload = 2; |
There was a problem hiding this comment.
Since Query and Mutation are exposed via REST transcoding (google.api.http), using bytes for payload will cause the JSON transcoder to expect a base64-encoded string instead of a raw JSON object. This makes the REST API less intuitive to consume.
To allow clients to pass raw JSON objects directly, consider importing google/protobuf/struct.proto and using google.protobuf.Value or google.protobuf.Struct instead of bytes.
| // data is the JSON-encoded result. Empty when errors is non-empty. | ||
| bytes data = 1; |
There was a problem hiding this comment.
Since Query and Mutation are exposed via REST transcoding (google.api.http), using bytes for data in CommandResult will cause the JSON transcoder to return a base64-encoded string instead of a raw JSON object.
To allow clients to receive raw JSON objects directly, consider importing google/protobuf/struct.proto and using google.protobuf.Value or google.protobuf.Struct instead of bytes.
MILAB-XXXX: admin panel SDK — regen pl-client gRPC bindings (PF-0) [partial]
Bird's-eye
SDK side of the admin panel. The backend exposes a command bus (two frozen RPCs
Query/Mutationonservice Platformcarrying a named command + JSON payload — see the pl PR). The SDK's job is to surface that to blocks through one genericadminDriver, wired once, so that every future admin feature is backend + block only.API design ideas (SDK)
Query/MutationRPCs viaPlClient/LLPlClient(theping/getUserRootpattern), neverPlTransaction.adminDriver.query<T>(name, payload?)/mutation<T>(name, payload?). New admin commands need no new SDK methods.PlClient → pl-drivers AdminDriver → DriverKit → pl-middle-layer → sdk model. After that, extension is backend + block only.What's in this PR (PF-0 only)
service Platformfrom the admin-panel proto:PlatformClientnow carries theQuery/MutationRPCs andCommandAPItypes (lib/node/pl-client/src/proto-grpc/...,proto-rest/plapi.ts).This is the foundation the rest of the SDK chain builds on.
Pending (separate commits/PR updates)
query/mutationpassthrough onLLPlClient+PlClient.AdminDriver(wrapsPlClient) + publicDriverKitinterface.adminDriverinpl-middle-layerinitDriverKit; SDK re-exports.platforma-desktop-v2) + theadmin-panelblock UI are tracked separately.Test plan
pnpm -C lib/node/pl-client build— generated stub compiles;query/mutationpresent onPlatformClient.Dependency
Consumes the proto from the pl admin-panel PR (PL-0). The bindings here were regenerated against that proto.
Draft — partial SDK slice (proto regen). Remaining PF tasks to follow.