Skip to content

[UI] ui-new: implement typed RPC services in the Rust bridge - #2189

Merged
newfront merged 9 commits into
unitycatalog:mainfrom
newfront:feat/add-rpc-server
Nov 12, 2026
Merged

newfront merged 9 commits into
unitycatalog:mainfrom
newfront:feat/add-rpc-server

Conversation

@newfront

@newfront newfront commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated (tracked in [UI] Docs: Document using the New UI console. #1953)

Description of changes

This PR implements the typed uc.v1 Connect services from #2040 in the ui-new Rust bridge (ui-new/server). The bridge checks every request against the proto's protovalidate rules before calling the Unity Catalog REST API, then converts UC's responses and errors back into Connect responses.

  • Services: Catalog, Schema, Table, Volume, Function, Model, and View services under server/src/services/, served at /uc.v1.<Service>/<Method>.
  • Generated code: build.rs generates the Rust types and validators from ui-new/proto at build time (buffa, connectrpc, protoc-gen-protovalidate-buffa). The build runs Buf, from web/node_modules or PATH, so the README now lists it as a prerequisite.
  • Requests to UC: services/ builds the UC request bodies, including column type metadata and positions for table and view creation, and the fixed fields UC requires for SQL functions. mapping.rs converts UC's JSON responses into proto messages.
  • upstream.rs: a shared UC client that forwards the caller's Cookie and Authorization headers and caps UC responses at 32 MiB. It times out after 30 s, or at the caller's Connect deadline when one is set. It maps UC error codes and HTTP statuses to Connect codes; for example, *_ALREADY_EXISTS becomes already_exists and a timeout becomes deadline_exceeded.
  • Tables vs. metric views: both share UC's tables API. TableService and ViewService each return one UC page filtered to their own table type, so a page can be empty while next_page_token is set. Get and delete return not_found for the other type. Creating a metric view checks its YAML definition and requires the columns to match its fields.
  • Request size: CreateFunction and CreateView accept request bodies up to 128 MiB, because their definitions may be up to 16,777,215 characters.
  • Call passthrough: now limited to the endpoints that have no typed service yet: SCIM Me, auth tokens and logout, and permission reads. It rejects a client-supplied server_url, which is now deprecated. It now forwards Authorization as well as Cookie, and caps responses at 4 MiB.
  • Proto changes: CreateTableRequest rejects column names that differ only by case, and UpdateVolumeRequest.comment can now be set to empty.
  • regex dependency: code generated by protoc-gen-protovalidate-buffa 0.8.0 for CEL matches() needs a direct regex dependency. It can be removed after upgrading the generator to 0.10.1+.
  • Docs: ui-new/README.md and ui-new/AGENTS.md now describe the typed services and the narrowed passthrough.

Stack

Tracking issue: #1888

Tests

  • tests/services.rs (20 tests):
    • validation runs before anything is sent to UC
    • a table of RPCs, each checked against the exact UC method, path, query, and body
    • auth and cookie forwarding, and pagination
    • column metadata derivation and metric-view YAML checks
    • list filtering by table type
    • delete guards that never send the DELETE
    • UC error codes, HTTP statuses, and transport failures (unreachable UC, body-read timeout) mapped to Connect codes
  • tests/proxy.rs (9 tests): the Call allowlist as allowed and denied rows, including method mismatches, a smuggled query, extra or dot segments, and encoded slashes. Also the client-chosen upstream and the forwarded body, content type, and cookies.
  • Ran: cargo test --locked (29 passed), cargo fmt --check, bun run typecheck, bun run test:coverage (79 passed), bun run build.

Compatibility

Affects ui-new only. There are no changes to the UC server, its REST API, or api/all.yaml. CallRequest.server_url is deprecated, and requests that set it are rejected.

newfront and others added 9 commits November 12, 2026 08:53
protoc-gen-protovalidate-buffa 0.8.0 expands CEL `matches()` (used by the
securable_name and storage_path predefined rules) into code that names
`::regex::Regex` directly, while the standard `pattern` rule uses the
`protovalidate_buffa::regex` re-export. Without a direct dependency the
generated validators fail to compile. Codegen 0.10.1+ uses the re-export
for both, so this can be dropped when the generator is upgraded.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
ListTables and ListViews kept requesting upstream pages until one held
a matching table type. A schema dominated by the other type cost one UC
call per page with no bound, and only an immediately repeated token was
caught, so a token cycle could loop until the client deadline.

Return each UC page filtered to the service's table type with its
next_page_token. A page can now be empty while more results remain;
the proto comments say callers follow page tokens.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
The bridge mapped a timeout while sending to deadline_exceeded, but a
timeout or connection error while reading the response body became
internal "Invalid response from Unity Catalog server". Both paths now
share one mapping: timeouts are deadline_exceeded, other transport
failures are unavailable.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
- Map each UC error_code / code key and HTTP status fallback to its
  Connect code, including a non-JSON error body and an unreachable UC.
- Make the delete type-guard test fail if the guard is removed: no
  DELETE may reach UC, and the error names the object.
- Drive the Call allowlist from allowed and denied rows (method
  mismatch, smuggled query, extra or dot segments, encoded slashes,
  unknown securable type) and check denied calls never reach UC.
- Assert Cookie forwarding on typed services and the Call form body
  and content type.
- Test that ListTables omits metric views.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
Most catalog, schema, volume, function, and model RPCs had no test of
the request they translate to. Drive one table of RPC requests through
the router and require the exact UC method, percent-encoded path,
query parameters, and JSON body, including model version paths, the
finalize body, force flags, and an empty volume comment.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
The table, view, volume, function, and model services each defined the
same catalog.schema.name formatter. Keep one object_full_name in
services/mod.rs.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
README.md and AGENTS.md still described the bridge as a single generic
passthrough with contract-only typed services, and told contributors to
add no per-endpoint handlers. Describe the implemented services, the
narrowed Call allowlist, and Cookie/Authorization forwarding. The Rust
build now runs Buf, so list it as a prerequisite and install the web
dependencies before the first cargo run.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
CreateView discarded the YAML parser error, so a user only saw "Invalid
metric view YAML definition". Append the parser's message, which names
the line and column without echoing the definition.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront
newfront force-pushed the feat/add-rpc-server branch from 6ab60fd to c5bb41f Compare November 12, 2026 16:55

@roeap roeap left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

left some minor comments that can be follow ups as well... since most of this is also codegen ... LGTM.

"input_params": { "parameters": parameters },
"data_type": return_type.name,
"full_data_type": return_type.text,
"routine_body": "SQL",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i this correct to always do SQL, or could thos be a python body as well?

Ok(Response::new(ListFunctionsResponse {
functions,
page: mapping::page(&value).into(),
..Default::default()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this just for the __buffa system fields? It might not be too critical, but somehow i was worried that this can swallow fields we need? But its perobably fine?

let large_request_limits = Limits::default()
.with_max_request_body_size(128 * 1024 * 1024)
.with_max_message_size(80 * 1024 * 1024)
.with_element_memory_limit(96 * 1024 * 1024);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TIL

#[derive(Clone)]
pub(crate) struct Upstream {
state: AppState,
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

once uc-rs is live, we should use the published client.

@newfront
newfront merged commit 1e43c5d into unitycatalog:main Nov 12, 2026
17 checks passed
@newfront newfront added this to the 0.8 milestone Nov 12, 2026
@newfront newfront linked an issue Nov 12, 2026 that may be closed by this pull request
@newfront
newfront deleted the feat/add-rpc-server branch November 13, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants