Repository navigation
[UI] ui-new: migrate the web UI to typed RPC services and implement the UI components - #2190
Conversation
|
FYI @roeap these are the second half of the changes to add the RPC contract for client<>server. These two need to be merged in order to remove the original axum proxy and add more intelligent RPC. |
1f5918c to
725377d
Compare
725377d to
600065e
Compare
## 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]>
Signed-off-by: Scott Haines <[email protected]>
tsconfig.tsbuildinfo is tsc's incremental build cache. `tsc -b` rewrites it on every typecheck or build, so it showed up as noise in unrelated commits. Stop tracking it and ignore *.tsbuildinfo in ui-new/web; the Docker builds already exclude it via .dockerignore. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Every list hook repeated the same merge callback that combined the items and reset `page.nextPageToken`, so a paging fix had to land in eight places. collectAllPages now takes the response's item key and does the merge itself. This moves the change down from the follow-up "Harden and simplify typed RPC services" commit so it lands with the hooks it simplifies. Add unit tests for the multi-page merge, a single empty page, and the repeated-token guard that stops an endless page loop. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Address review findings on the auth flows: - Clear the query cache when the identity changes (provider login, pasted token, and logout). A pasted token was rejected on the first attempt because `fetchQuery` returned the cached anonymous user under the five-minute staleTime, and logout kept the previous user's data cached. This moves the cache clearing down from the follow-up "Harden and simplify typed RPC services" commit, with its identity-change test. - Drop a leftover pasted token before a provider login. UC prefers a Bearer header over the session cookie, so an expired token made the new session fail verification and was never cleared. - Show an error when sign-out fails instead of dropping the rejection, since the UC session may still be active. - Build the app and test query clients from one createQueryClient, so tests run with production caching. The existing pasted-token test now fails without the cache clear. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Delete hooks only refreshed the list, and a rename skipped the old detail entirely, so going back to a deleted or renamed object showed its cached page for up to the five-minute staleTime instead of not found. useInvalidateMethod gains `refetch: false`, which marks cached results stale without fetching them now (the old name would fail to load while the page navigates away). Delete and rename use it for the old detail; a plain update still refetches the detail on screen. Tests now cover the refetch on edit, the stale-without-refetch mark on rename and delete, and that every update, finalize, and delete hook marks its detail query stale, which was previously unasserted. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
The function and view create tests only checked that a request was sent, and the table case skipped columns and format, so a swapped field or a dropped dependency still passed. Each create case now asserts the exact typed request, with non-default selections so the test proves the form reads every field. OwnerDeleteAction tests now cover who sees the action (auth disabled, owner, another user, unknown owner, signed out) and both outcomes: a successful delete closes the dialog and calls onDeleted, and a failure shows the error and keeps the dialog open. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Review cleanups: - Move ColumnsTable out of TableDetails and use it on the metric view page, which had its own column list with a different empty state. - Add splitFullName for the catalog.schema.object parsing that eight detail hooks repeated. - Remove formatEpoch, which no page calls since the move to protobuf Timestamps, and point the MetaGrid comment at formatTimestamp. - Describe the typed services in the README as they work now, instead of as a two-PR plan. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
600065e to
a69d41c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Cookie-authenticated write requests are blocked because the required X-Requested-With header is missing from the browser transport and both bridge paths.
4 open issues
What changed in this PR
Migrates ui-new to the typed RPC services introduced in #2189, restoring domain data access through the Rust bridge and adding catalog-management actions. Changes remain within ui-new; the UC REST API is unchanged.
Changes:
- Replaces domain passthrough calls with typed hooks, pagination, and cache invalidation.
- Adds create, edit, delete, model-version finalization, and metric-view navigation.
- Updates authentication handling, tests, protobuf checks, and architecture documentation.
| File | Description |
|---|---|
ui-new/web/tsconfig.tsbuildinfo |
Removes the tracked incremental build cache. |
ui-new/web/src/test/providers.tsx |
Adds in-memory typed services and shared cache configuration. |
ui-new/web/src/routes/_authed/catalog/$catalog/$schema/view/$view.tsx |
Adds the metric-view detail route. |
ui-new/web/src/pages/VolumeDetails.tsx |
Uses typed volume data and adds edit/delete actions. |
ui-new/web/src/pages/TableDetails.tsx |
Uses typed table data, shared columns, and deletion. |
ui-new/web/src/pages/SchemaDetails.tsx |
Adds schema actions and metric-view listings. |
ui-new/web/src/pages/pages.test.tsx |
Updates fixtures and covers metric views and invalid versions. |
ui-new/web/src/pages/ModelVersionDetails.tsx |
Adds comment editing, finalization, deletion, and version validation. |
ui-new/web/src/pages/ModelDetails.tsx |
Adds model editing, deletion, and version creation. |
ui-new/web/src/pages/MetricViewDetails.tsx |
Displays metric-view columns, definition, metadata, and permissions. |
ui-new/web/src/pages/Login.tsx |
Waits for verified identity and displays authentication progress/errors. |
ui-new/web/src/pages/Login.test.tsx |
Tests verification progress, failures, and navigation timing. |
ui-new/web/src/pages/FunctionDetails.tsx |
Uses typed function data and adds deletion. |
ui-new/web/src/pages/CatalogsList.tsx |
Uses typed catalog listings and adds creation. |
ui-new/web/src/pages/CatalogDetails.tsx |
Adds catalog editing/deletion and schema creation. |
ui-new/web/src/main.tsx |
Initializes the shared query-client configuration. |
ui-new/web/src/lib/uc.ts |
Adds full-name parsing and protobuf timestamp formatting. |
ui-new/web/src/lib/uc.test.ts |
Updates helper and passthrough tests. |
ui-new/web/src/lib/transport.ts |
Adds bearer headers and explicit cookie credentials. |
ui-new/web/src/lib/queryClient.ts |
Centralizes query and mutation cache defaults. |
ui-new/web/src/hooks/volumes.ts |
Adds typed volume reads, pagination, and mutations. |
ui-new/web/src/hooks/views.ts |
Adds typed metric-view reads, creation, and deletion. |
ui-new/web/src/hooks/user.ts |
Extracts identity fetching and improves login errors. |
ui-new/web/src/hooks/user.test.tsx |
Updates authentication request and error assertions. |
ui-new/web/src/hooks/tables.ts |
Adds typed table reads, pagination, and mutations. |
ui-new/web/src/hooks/schemas.ts |
Adds typed schema reads, pagination, and mutations. |
ui-new/web/src/hooks/query.ts |
Adds pagination collection and method-level invalidation helpers. |
ui-new/web/src/hooks/query.test.ts |
Tests pagination completion and repeated-token detection. |
ui-new/web/src/hooks/mutations.test.tsx |
Tests typed mutations and cache invalidation behavior. |
ui-new/web/src/hooks/models.ts |
Adds typed model/version operations and version parsing. |
ui-new/web/src/hooks/functions.ts |
Adds typed function reads, pagination, and mutations. |
ui-new/web/src/hooks/domain.test.tsx |
Updates typed-read assertions and adds pagination/view coverage. |
ui-new/web/src/hooks/catalog.ts |
Adds typed catalog reads, pagination, and mutations. |
ui-new/web/src/context/auth-context.tsx |
Verifies sign-in and clears caches during session changes. |
ui-new/web/src/context/auth-context.test.tsx |
Tests identity verification, cache clearing, and logout failures. |
ui-new/web/src/components/OwnerDeleteAction.tsx |
Adds owner-gated deletion with name confirmation. |
ui-new/web/src/components/OwnerDeleteAction.test.tsx |
Tests visibility, confirmation, cancellation, and deletion outcomes. |
ui-new/web/src/components/MetaGrid.tsx |
Updates a comment to name the timestamp formatter. |
ui-new/web/src/components/Layout.tsx |
Reports sign-out failures through notifications. |
ui-new/web/src/components/Layout.test.tsx |
Adds sign-out failure coverage. |
ui-new/web/src/components/FormField.tsx |
Adds a reusable labeled field wrapper. |
ui-new/web/src/components/EntityFormDialog.tsx |
Adds shared create/edit dialog submission handling. |
ui-new/web/src/components/EditMetadataAction.tsx |
Submits changed names/comments, including comment clearing. |
ui-new/web/src/components/EditMetadataAction.test.tsx |
Tests changed, unchanged, and cleared metadata. |
ui-new/web/src/components/data-components.test.tsx |
Updates fixtures and tests active metric-view navigation. |
ui-new/web/src/components/CreateSchemaObjectAction.tsx |
Adds creation forms for schema-level objects. |
ui-new/web/src/components/CreateSchemaObjectAction.test.tsx |
Tests creation request fields for each object type. |
ui-new/web/src/components/ColumnsTable.tsx |
Shares typed column rendering between tables and views. |
ui-new/web/src/components/CatalogTree.tsx |
Uses typed hooks and adds metric-view navigation/highlighting. |
ui-new/web/package.json |
Adds the protobuf lint/build command. |
ui-new/web/.gitignore |
Ignores TypeScript incremental build caches. |
ui-new/README.md |
Documents typed hooks and protobuf checks. |
ui-new/AGENTS.md |
Updates architecture, generation, and test-harness guidance. |
Review effort: Balanced
UC's CSRF check rejects cookie-authenticated requests other than GET, HEAD, and OPTIONS without X-Requested-With: XMLHttpRequest, and the cookie token exchange and logout require it too. Neither the browser transport nor the bridge sent it, so Google sign-in, sign-out, and every create, edit, and delete on a cookie session failed with 403. - The web transport sets the header on every Connect request. - The typed services and the Call passthrough forward it to UC, from one shared list next to Cookie and Authorization. - The CORS layer allows it, so a cross-origin bridge still passes preflight. Tests check that the header reaches UC on a cookie-session DeleteCatalog and on the cookie token exchange, that preflight allows it, and that the browser sends it. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
EntityFormDialog and OwnerDeleteAction drew their own overlay with aria-modal="true" but left focus on the trigger, let Tab reach the page behind the overlay, ignored Escape, and dropped focus when they closed. Both now use a vendored shadcn Dialog on radix-ui, which is already a dependency. It moves focus into the dialog, keeps it there, closes on Escape, and returns focus to the trigger. The delete prompt's text becomes the dialog description, and the shared close button replaces each modal's own. New tests open each dialog, tab past its last control, and press Escape, then check where focus lands. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Renaming a catalog, schema, or model marked only its own detail stale. Pages under it that were visited before, such as a schema, table, or model version, and their permissions panels kept serving cached data at URLs that no longer resolve, for the five-minute freshness window. useMarkDescendantsStale marks every cached result of the given services or methods, plus every cached permissions read, stale without refetching: - Catalog rename: schemas and every schema-object service. - Schema rename: tables, views, volumes, functions, and models. - Model rename: model version lists and details. This marks more than the renamed parent's own pages. Renames are rare, and a stale mark costs only a refetch on the next visit. Tests cover each rename: descendants and grants are marked stale, while unrelated queries and the current-user read are not. An edit without a new name leaves descendants cached. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Finalize had no error handler, so a failed request just re-enabled the button. That case is common: every viewer of a pending version sees the button, but UC lets only its creator finalize it. A failure now shows a toast with UC's message, like the create, edit, and delete actions. A page test fails the finalize RPC and checks the toast and that the button is enabled again. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
|
/review |
1 similar comment
|
/review |
Sign-in and sign-out called queryClient.clear(), which also dropped the ["app-config"] query. Until /config came back, authEnabled read false and the config showed as loading. The authenticated layout fell back to its skeleton on every identity change, and the login page could briefly say no auth providers were enabled. Each change also cost an extra GET /config. Runtime config does not depend on who is signed in. The auth context now removes every query except the config. A test signs in and out and checks that /config was fetched once. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Pressing Enter in the token field started a sign-in even while one was being verified; only the button was disabled. The second attempt removed the cached queries, which cancelled the first attempt's current-user fetch. The first attempt's catch block then cleared the second attempt's token and cache, so both could fail with a valid token. - The login page ignores a submit while a verification is in flight. - The auth context counts sign-ins and sign-outs in a ref. A token verification that a newer one superseded returns without touching the token or cache. Tests run two overlapping token sign-ins with deferred replies and check that the newer one signs in. Another test presses Enter during a verification and checks that only one sign-in starts. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Renames of catalogs, schemas, and models marked permission reads stale, but deleting a catalog, schema, table, view, volume, function, or registered model did not, and neither did renaming a volume. Permission reads use the default five-minute staleTime. If a user deleted an object and created another under the same name, the permissions panel could show the old object's grants. UC still enforced the real grants. - hooks/permissions.ts holds the permissions read (usePermissions) and useMarkPermissionsStale, which marks one securable's cached grants stale, or every securable's, without refetching. The /permissions/ path rule moved here from hooks/query.ts, so the typed cache helpers no longer depend on the Call URL scheme. - Leaf deletes, and volume renames, mark the old name's grants stale. - Catalog and schema deletes mark descendants and grants stale, as renames already did, because a force delete removes the children too. - The duplicate branches in useMarkDescendantsStale get a comment: each createConnectQueryKey overload takes only a service or only a method. For each delete and for volume rename, a test reads the grants, performs the mutation, reads again, and checks that UC's permissions endpoint was called a second time. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
The metric view form took arbitrary YAML but always sent one column, built from a single name and type field. The bridge requires every column to appear in the YAML and every dimension and measure to have a matching column. A definition with both a dimension and a measure could therefore never be created. The old test passed only because it mocked the hook; its "version: 1.1" definition declares no fields, so the bridge would reject it. The dialog now has a repeatable column editor with a name and type per row, plus add and remove buttons. The rows are read back in order with FormData.getAll. External tables use the same editor, so they can also have more than one column. The metric view test now goes through the real useCreateView hook and an in-memory ViewService. It pastes a definition with a dimension and a measure, adds and removes rows, and checks the CreateViewRequest the service receives. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] Thanks for the fixes to the Copilot items and the catalog and schema delete staleness. Still open: the provider sign-in and sign-out races, the model delete cache gap, the duplicated Authorization header, and the bridge's X-Requested-With invariant test. The inline comments carry the details.
Not anchorable to this diff:
- ui-new/web/src/pages/SchemaDetails.tsx:147: A failed list request renders as an empty section. ObjectSection receives only a count and children, so tables.error is never read, and the section shows "None" while loading too. The catalog schema list and the model versions table do the same. CatalogTree already shows error.message for these lists. Could we pass each query's error through, or wrap the sections with QueryState?
- ui-new/server/src/lib.rs:103: Entries that fail to parse are dropped without a warning. A typo in ALLOWED_ORIGINS would look like a working config that rejects every cross-origin call. Could we log the rejected values with tracing::warn?
Two AI-review points I did not carry over: the create dialog offers all five object kinds, and AGENTS.md already lists proto:check. README still does not mention metric views or write actions (nit).
A pasted token reached UC twice on Call requests. The transport set it as an Authorization header, which the bridge forwards, and ucCall also sent it in the request body's token field. The bridge then appended a second Authorization header from that field, because reqwest appends headers rather than replacing them. The header is now the only source: - `CallRequest.token` is deprecated. The bridge rejects non-empty values, as it already does for `server_url`. - ucCall and useUcQuery stop sending the token. Permission queries no longer use it in their cache key; every identity change already removes those queries. - The test harness and the auth tests read the active token with getToken() instead of from the request body. Bridge tests check that a body token is rejected and that UC receives exactly one Authorization value. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
UC's CSRF check relies on X-Requested-With coming only from the browser, and no test pinned that the bridge never adds the header itself: a change that always set it would have passed every test. The CORS test also checked only the allowed origin, not that others are refused. - The typed services and the Call passthrough each get a test that sends a request without the header and fails if UC receives one. - A preflight from an unlisted origin must get no Access-Control-Allow-Origin header. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
The CORS layer dropped entries that failed HeaderValue parsing without a warning. Almost nothing fails that parse, though. A typo such as a trailing slash or a default port parsed fine and then never matched, because browsers send a bare serialized origin. That config looked correct but rejected every cross-origin call. The bridge now accepts only entries that equal their own URL origin, and logs every other entry with tracing::warn. Those entries could never match, so requests behave the same; the warning makes the typo visible. A unit test covers bare origins, trailing slashes, default ports, missing schemes, and wildcards. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Three auth races remained after the token sign-in fix: - Sign-out cleared the pasted token before POST /auth/logout, so the request reached UC without an Authorization header. With auth enabled, UC rejected it and the user saw "Sign out failed". Logout is now sent first, and local state is cleared once it finishes, even if UC could not end the session. - A provider sign-in had no supersession check. If a sign-out ran during the token exchange, the late response still cleared the cache and verified whatever session the browser held. Provider sign-in now checks the same counter after the exchange and after verification. When a sign-out superseded it, it sends a best-effort logout to end the session cookie the late exchange may have set. - An older sign-out that finished after a newer sign-in removed the new session's cached queries. It now leaves them alone. Tests use deferred UC replies for each race: a slow exchange followed by a sign-out, and a slow sign-out followed by a token sign-in. Another test has UC refuse logout without the bearer token. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Renaming a model marked its cached versions stale, but deleting it marked only the detail and the grants. If a model was deleted and another created under the same name, the old versions could still be served from cache for the five-minute staleTime. Model delete now marks the version lists and details stale, like rename, through a shared MODEL_DESCENDANTS list. That also marks every cached grant stale, so the narrower per-model permissions mark is gone. The descendant tests now cover deleting a catalog, schema, or model as well as renaming one. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
Marking a query stale with refetchType "none" does not stop a read that is already in flight. If such a read started before a delete or rename and finished after the mark, it cleared the mark and cached the old data as fresh for five minutes. markStale in lib/queryClient.ts replaces the three separate invalidations: useInvalidateMethod with refetch false, useMarkDescendantsStale, and useMarkPermissionsStale. It still marks idle queries without fetching them. For a read in flight, it cancels the read and sends it again. Cancelling alone would leave a first load that is on screen, such as a sidebar list, pending forever, because nothing would fetch it again. TanStack's cancelRefetch option does not help either, since it reuses an in-flight first load instead of replacing it. A deferred-reply test starts a catalog read, deletes the catalog, and releases the pre-delete reply. That reply is dropped, and the cache holds the reply to the read sent after the delete. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
The delete action appeared only when the signed-in user owned the object. UC lets more principals delete: catalog deletes also accept MANAGE on the catalog and OWNER on the metastore, and table deletes accept OWNER or MANAGE on the catalog or schema. Metastore admins, and members of a group that owns an object, never saw the button. Edit and Create were already shown to everyone. OwnerDeleteAction becomes DeleteAction without the owner check, and the pages stop passing an owner. The typed-name confirmation still guards against accidents, and UC's refusal shows in the error toast. The model version page no longer loads the parent model, which it needed only for the owner. The owner-visibility tests are gone; the rest cover confirmation, success, failure, and focus. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
With authorization enabled, UC lets only a version's creator finalize it. The page showed the button to every viewer of a pending version, so most viewers saw a button that always failed. The button now appears only when auth is disabled or the signed-in user created the version, and the error toast stays as a fallback. Unlike delete, UC's finalize rule is an exact match on the creator, so the UI can apply it without hiding the action from anyone UC would allow. A test covers auth disabled, the creator, and another user. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
A failed list request looked like an empty list. The schema page's object sections got only a count, so they showed "None" when the tables request failed, and while it was still loading. The catalog's schema list and the model's versions table did the same. CatalogTree already showed these errors. ObjectSection now takes its list query and wraps its contents in QueryState, and so do the schema list and the versions table. The count in each title appears once the list has loaded. A page test fails each of the three lists and checks that the error is shown. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
- parseModelVersion accepts only a canonical positive number. BigInt also took "0x2", " 2", "+2", and "02", so one version was reachable under several URLs. - The metric view page labels its ID "Metric view ID", not "Table ID". - Saving the edit dialog with no changes now says "No changes to save." instead of doing nothing. - The login page trims a pasted token once and signs in with the trimmed value. setToken already trimmed it, so the header was never affected; this keeps the check and the value in one place. Tests cover the version parsing table, the no-changes toast, and trimming. Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
The ui-new README described a read-only browser. It now covers: - the create, edit, and delete actions, and that UC, not the UI, decides who may perform them; finalize is the one creator-only exception - metric views - when CORS applies, and the X-Requested-With header the bridge forwards for UC's CSRF check - the bare-origin format ALLOWED_ORIGINS expects Co-authored-by: Isaac <[email protected]> Signed-off-by: Scott Haines <[email protected]>
|
Following up on the review's points that weren't anchored to the diff:
|
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] The fixes for the first review are in and verified, with the replies on the pushback points noted. Still open: the overlapping provider sign-in race, the refetch cache race, and the dialog reopen race. The inline comments carry the details.
Not anchorable to this diff:
- ui-new/web/src/lib/session.ts:4: the comment describes the pasted value going into every Call as the body field. The bridge rejects that field now, and the interceptor sets the header. Could we describe the header path?
- ui-new/web/src/lib/uc.ts:9: LIST_TABLES_QUERY and withListTablesQuery are used only by their own test now. Could we delete them with that test?
- README's ALLOWED_ORIGINS row should say entries must match the browser's serialized origin, which also rejects an explicit default port. AGENTS.md has no guidance on the write actions or the finalize rule.
- ui-new/web/src/lib/transport.test.ts: no case checks that a pasted value becomes Authorization: Bearer.
- EntityFormDialog: no failed-submit test.
Serialize session changes, restart stale reads after mutations, abort pagination, and protect reopened dialogs. Add regression coverage and apply the documentation and unused-code cleanup requested in PR unitycatalog#2190. Signed-off-by: Scott Haines <[email protected]> Co-authored-by: Isaac <[email protected]>
|
Review-summary items are also addressed in 8a26d99: corrected header-path docs, removed unused table-list helpers/tests, clarified CORS and write/finalize guidance, and added bearer-header and failed-submit tests. All 188 web tests, typecheck, protobuf checks, and build passed. |
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] Approve-worthy. The round-3 items are fixed and the replies hold up. The remaining items are nits, plus one small highlight bug in the catalog tree (inline). Not anchorable to this diff:
- ui-new/web/src/test/providers.tsx:35: the harness comment still describes only the Call method; it also provides the typed domain services.
- ui-new/server/src/proxy.rs:61: the call_handler comment mentions only cookie forwarding; it should name the forwarded header list and the rejected body field.
- ui-new/AGENTS.md: the shared components (EntityFormDialog, DeleteAction) are not listed.
- PR description: "UC's exact rule" should say the creator check is necessary but not sufficient, since UC also checks CREATE_MODEL_VERSION.
| catalog={catalog} | ||
| schema={schema} | ||
| name={it.name ?? ""} | ||
| active={activeName === it.name} |
There was a problem hiding this comment.
[AI Assisted] active compares only the leaf name, so with two expanded schemas that each hold a table named events, both rows highlight. routeOpen already checks the catalog and schema, so active={routeOpen && activeName === it.name} would fix it.
| await onDelete(); | ||
| toast.success(`${entityType} deleted`); | ||
| setDialogOpen(false); | ||
| onDeleted?.(); |
There was a problem hiding this comment.
[AI Assisted] onDeleted runs when the request resolves, even if the user has already moved to another entity, so a late success navigates them away from their current page. The rename paths navigate after mutateAsync in the same way. Could we navigate only when the current route still points at the entity this action started from?
| // changes queued before it left behind. | ||
| const logout = useCallback(() => { | ||
| setAuthenticating(false); | ||
| return enqueue(async () => { |
There was a problem hiding this comment.
[AI Assisted] logout waits behind any sign-in still in flight, so Log out has no visible effect until that exchange settles. Could the local clear run immediately, with only the server call queued? The sign-in's publish already checks isLatest, so it still cannot publish after a sign-out.
| import { UCError } from "@/lib/uc"; | ||
| import { useToken } from "@/lib/session"; | ||
|
|
||
| // The single generic UC REST proxy RPC. Every scoped fetch flows through it so |
There was a problem hiding this comment.
[AI Assisted] This comment says every scoped fetch flows through the generic proxy. Now only SCIM, auth and permission reads do. Could we say that?
| triggerLabel: string; | ||
| submitLabel?: string; | ||
| children: ReactNode; | ||
| onSubmit: (form: FormData) => Promise<unknown>; |
There was a problem hiding this comment.
[AI Assisted] A resolved false keeps the dialog open with no message from this component. Could the contract be documented on the prop, or typed explicitly?
…2262) **PR Checklist** - [x] 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. (No separate issue; follow-up to #2190.) - [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. (ui-new is documented in `ui-new/README.md`, updated here.) ## Summary Follow-up to #2190. This consolidates the ui-new RPC implementation, reduces duplicated request handling, and rejects malformed upstream responses instead of constructing incomplete objects. The Prettier reformatting it used to carry landed separately in #2292. ### Changes - Share one `UiRpc` implementation across the typed services and register the control-plane proxy through the generated Connect service. - Share one upstream round trip (`Upstream::send`) between the typed services and the proxy: header forwarding, the caller's deadline, and the size-limited read. - Cap client-asserted deadlines at the bridge's 30-second upstream limit. - Use borrowed protobuf request views instead of cloning entire requests. - Validate required object identities, positive model-version numbers, and `table_type` when mapping UC responses. - Bound the table and metric-view RPCs to their own kind. Both share UC's `/tables/{full_name}` resource, so each typed get and delete reads the kind first. - Preserve auth/CSRF header forwarding and propagate multiple `Set-Cookie` headers. - Reject invalid configuration values at startup instead of silently falling back. - Simplify the web test harness around typed service implementations and share query-parameter conversion. ## Compatibility and behavior changes The Java REST API and OpenAPI specifications are unchanged. ui-new has not shipped, so the SPA/bridge contract changes below need no migration, but they do change behavior: - **Protobuf contract:** unused response fields and enums are removed outright, without reservations. A Call body's `serverUrl` or `token` keys are now ignored; `main` rejected them with 400. The bridge always uses its configured `UC_SERVER`, and a bearer token travels only in the Authorization header. - **SPA hosting:** the bridge no longer serves the SPA, and `WEB_DIST` is gone. Vite or a separate web server must serve the SPA, proxy bridge requests, and fall back to `index.html` for client-side routes. - **Definition limits:** function and metric-view definitions are limited to 1 MiB of UTF-8 (`max_bytes`). That narrows `main`'s 16,777,215-character limit, which matches UC's columns, and removes the 128 MiB request-limit overrides on those two routes. Requests use Connect's default 4 MiB limit, so a definition that JSON escaping expands past 4 MiB is rejected by the transport rather than the rule; for example, control characters escape to 6 bytes each. Either way it fails closed. - **Table and metric-view kinds:** - `DeleteTable` and `DeleteView` read the resource before deleting it. The wrong kind returns `FAILED_PRECONDITION` and deletes nothing. - `GetTable` and `GetView` name the actual kind in their `NOT_FOUND`. - A reply with no known `table_type` is `INTERNAL` in list, get, and delete, and nothing is deleted. - UC's delete takes only the name, so the check is best effort against a concurrent drop-and-recreate. - **Delete controls:** on every detail page, the button, dialog title, and success toast name their type (for example, "Delete metric view"). - **Deadlines:** a client's `Connect-Timeout-Ms` is clamped to the bridge's 30-second upstream limit, which also applies when the client sends none. Typed RPCs on `main` honored any client value. - **Error codes:** an oversized UC response is `internal` instead of `resource_exhausted` (HTTP 429). Proxy body-read failures map to `unavailable` or `deadline_exceeded`, as the typed services' do. - **Configuration:** an invalid or empty `PORT` or `*_ENABLED` value, or a non-Unicode `ALLOWED_ORIGINS`, stops the bridge with an error naming the variable. ## Validation Checked on this branch: - `bun run proto:check`, `bun run typecheck`, `bun run test:format`, and `bun run build` passed. - Web coverage passed: 193 tests, 95.4% line coverage. - Rust: `cargo test --locked` passed (50 tests); `cargo fmt --check` passed. - Against a disposable `unitycatalog:v0.8.0-SNAPSHOT` server through this branch's bridge: created a catalog, schema, external table, and metric view; confirmed wrong-kind gets and deletes were refused and both objects survived; deleted each through its own service; and listed catalogs with a 10-minute `Connect-Timeout-Ms`. All 19 checks passed. - Signed-out reads against a remote, auth-enabled UC over HTTPS returned `unauthenticated`, as expected. ## Dependencies Updates rustls from 0.23.43 to 0.23.45, which fixes RUSTSEC-2026-0285. ## Stack This PR targets `main` after #2190 and #2292. Follow-up branches, each depending on the previous one: 1. `feat/add-ui-docker-environments` 2. `chore/add-ui-web-validation-tests` 3. `chore/add-jwt-copy-btn` This pull request and its description were written by Isaac. --------- Signed-off-by: Scott Haines <[email protected]> Co-authored-by: Isaac <[email protected]>


PR Checklist
docsis updated (tracked in [UI] Docs: Document using the New UI console. #1953;ui-new/README.mdandui-new/AGENTS.mdare updated here)Description of changes
Moves the ui-new web app off the generic
Callpassthrough and onto the typeduc.v1services from #2189, and adds create, edit, and delete actions.web/src/hooks/.Callremains only for SCIMMe, auth tokens and logout, and permission reads. Object lists show their loading and error states instead of looking empty when a request fails.MetricViewDetailspage and route.Authorization: Bearerfor pasted tokens. The header is the token's only source.X-Requested-With: XMLHttpRequest, which UC's CSRF check requires for cookie-session writes, the cookie token exchange, and logout. The bridge forwards it, never adds it, and CORS allows it.bun run proto:check; stops trackingweb/tsconfig.tsbuildinfo. The README andAGENTS.mddescribe the typed-service architecture, the write actions and their authorization policy, and CORS.Fixes from a self-review against
CODE_REVIEW.md, the Copilot review, the Unity Catalog AI Code Review blockers, and maintainer review are in separate commits. The paging and cache-clearing changes moved here fromfeat/add-rpc-implementations.Stack
mainnow that [UI] ui-new: implement typed RPC services in the Rust bridge #2189 has merged; all 26 commits belong to this PR.main, theCallallowlist rejects the web's old data requests; this PR moves those requests to the typed services.feat/add-rpc-implementations.Tracking issue: #1888
Tests
web/src/test/providers.tsxprovides in-memory typed services, so hooks and pages run their real query code. Races are tested with deferred replies. Ran:bun run proto:check,typecheck,test:coverage(170 passed; 94.7% lines, 90.2% branches, 85.3% functions),build,cargo test --locked(37 passed), andcargo fmt --check.Compatibility: ui-new only. No changes to the UC server, its REST API, or
api/all.yaml. In the ui-new contracts and bridge:CallRequest.tokeninui-new/proto/uc/v1/proxy.protois deprecated, and the bridge rejects non-empty values likeserver_url. The web client sends the token as anAuthorizationheader instead.X-Requested-Withand allows it in CORS.ALLOWED_ORIGINSentries that are not a barescheme://host[:port]are logged and skipped. Such entries could never match a browser's origin.The typed domain contracts are unchanged.
This pull request and its description were written by Isaac.