Skip to content

[UI] ui-new: add typed RPC protobuf definitions and validation rules - #2040

Merged
roeap merged 2 commits into
unitycatalog:mainfrom
newfront:feat/create-rpc-definitions
Nov 12, 2026
Merged

roeap merged 2 commits into
unitycatalog:mainfrom
newfront:feat/create-rpc-definitions

Conversation

@newfront

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

Description of changes
This PR moves from the client-side typescript service to the client<>server separation of concerns for the new UI. This allows us to protect the calls that go to the Unity Catalog server from this new environment. This PR introduces protovalidate into equation as well. This allows us to add automatic validation for RPC methods across the RPC surfaces.

These changes will not affect any active users of the new UI. There are another 7 PRs before this gets into a stable state.

Tracking Issue
Tracking github issue: #1888

Upstream PR
given I can't stack PRs in this environment, the ideal case is that PR 1902 is merged first, and then this PR can be rebased off of main to create a better "stack-like" experience.
#1902

Tests
This PR introduces a config test for the routes exposed by the main UI. There is a full suite of tests coming with this branch's PR (https://github.com/newfront/unitycatalog/tree/chore/add-ui-web-validation-tests)

Docs
The docs issue is tracked here #1953

@newfront

newfront commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

This PR introduces RPC definitions for the code UC apis, and implementations for the server/web services in the new ui architecture. These will be useful for driving agentic UIs and interesting ways of working in the future as well.

FYI - @roeap

@newfront
newfront force-pushed the feat/create-rpc-definitions branch from 3a41e07 to 08bb20f Compare November 4, 2026 20:31
@yili-db

yili-db commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

/review

@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.

just a couple of question on some validation rules.

Comment thread ui-new/proto/uc/v1/catalog.proto Resolved
Comment thread ui-new/proto/uc/v1/catalog.proto Resolved
Comment thread ui-new/proto/uc/v1/common.proto Resolved
Comment thread ui-new/proto/uc/v1/table.proto Resolved
newfront and others added 2 commits November 11, 2026 11:50
Address review feedback on the uc.v1 validation rules by using
protovalidate's standard rules and CEL extension functions instead of
hand-written regular expressions.

- Add uc/v1/predefined_string_rules.proto with two predefined rules that
  mirror the UC Java server:
  - securable_name: ValidationUtils.validateSqlObjectName (1-255 of
    letters, digits, '_', '-', '@'; a leading '_' is legal).
  - storage_path: isUriRef() plus the UriScheme allowlist (s3, gs, abfs,
    abfss, file, or a scheme-less local path) and a non-empty bucket.
    http(s) stays rejected because UC does not support it.
- Apply securable_name to every ref, create name, and new_name field, and
  storage_path to storage_root and ExternalStorageLocation.
- Express the ExternalStorageLocation hardening as named CEL rules
  (no '.'/'..' segments; no '?', '#', '%'). The bucket-root check is left
  to UC, which already rejects it for tables and volumes.
- Keep the standard pattern rule on the Dependency oneof members:
  protovalidate-buffa 0.8 cannot apply CEL or predefined rules to oneof
  members.
- Replace internal "Branch 2" wording with "the bridge" and document that
  per-request max_results caps match each endpoint's maximum in
  api/all.yaml.

Verified with buf lint/build, @bufbuild/protovalidate 1.3.0, and the Rust
bridge (cargo test plus a 55-case rule probe) at the stack tip.

Restacking requires two downstream follow-ups: pass a registry with
file_uc_v1_predefined_string_rules to createValidator() in
web/src/lib/validation.ts, and add a direct regex dependency to the
bridge (or upgrade protoc-gen-protovalidate-buffa to >= 0.10.1).

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront
newfront requested a review from roeap November 11, 2026 20:16
@newfront
newfront force-pushed the feat/create-rpc-definitions branch from 35b3077 to 66b508e Compare November 11, 2026 20:16
@newfront newfront changed the title [UI] ui-new: create rpc definitions, and implementations for client and server rpc exchange [UI] ui-new: add typed RPC protobuf definitions and validation rules Nov 11, 2026

@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.

LGTM - once we worked through the stack, we'll have to do some more exploratory testing as well :).

@roeap
roeap merged commit ba36438 into unitycatalog:main Nov 12, 2026
17 checks passed
newfront added a commit that referenced this pull request Nov 12, 2026
## PR Checklist

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [x] 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 #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

- Based on `main`, which includes the #2040 protobuf contracts. All 9
commits here belong to this PR.
- Next: #2190 moves the web UI onto these services. Until it lands, the
web UI's data requests through `Call` are rejected; ui-new has no active
users yet.

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.

---------

Signed-off-by: Scott Haines <[email protected]>
Co-authored-by: Isaac <[email protected]>
@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/create-rpc-definitions 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

3 participants