Skip to content

[UI] Address follow-up review on #2262 - #2309

Merged
yili-db merged 18 commits into
unitycatalog:mainfrom
newfront:fix/ui-new-2262-followups
Nov 20, 2026
Merged

yili-db merged 18 commits into
unitycatalog:mainfrom
newfront:fix/ui-new-2262-followups

Conversation

@newfront

@newfront newfront commented Nov 19, 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. (No separate issue; follow-up to the review on [UI] Consolidate RPC handlers and tighten bridge response validation #2262.)
  • 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. (No feature change; the ui-new docs touched are updated here.)

Summary

Follow-up to #2262. This addresses the review @yili-db left after #2262 was approved and before it merged. Each topic is its own commit.

Changes

  • Bridge configuration (ui-new/server/src/config.rs):
    • An empty variable is now treated as unset and takes its default. In [UI] Consolidate RPC handlers and tighten bridge response validation #2262, an empty PORT or *_AUTH_ENABLED stopped the bridge, while the string variables already treated empty as unset. Deployment templates often render an unset value as an empty string, so setups that worked before [UI] Consolidate RPC handlers and tighten bridge response validation #2262 failed at startup. A non-empty invalid value is still an error.
    • UC_SERVER and GOOGLE_CLIENT_ID now fail on a value that is not valid Unicode, like the other variables, instead of silently using the default.
    • UC_SERVER is trimmed and parsed at startup. A whitespace-only value, or one that is not an http or https base URL without a query or fragment (such as uc.example.com:8080 or http://uc:8080/?x=1), now stops the bridge instead of starting it and failing every UC call with unavailable. An exactly empty UC_SERVER still takes the default.
    • GOOGLE_CLIENT_ID is trimmed. A blank value (empty or whitespace only) is unset and leaves the Google button off. Any other value must end in .apps.googleusercontent.com, or the bridge stops at startup. An ID with that suffix but not in the usual <number>-<id> shape (the shape of the example in Google's client ID guide) starts the bridge with a warning, because Google documents no grammar to enforce. Before, a whitespace-only or malformed ID turned the button on, and it failed on click.
    • from_env wraps a new private from_lookup, which takes the variable lookup as a closure. The tests cover unset, empty, invalid, and non-Unicode values for every variable without changing the process environment.
  • Table and metric-view lists (ui-new/server/src/services/): a row with a missing or unknown table_type is skipped instead of failing the whole ListTables or ListViews page, and one warning per page names the catalog and schema and gives the count and up to three examples. A page where every row is skipped returns an empty list with the page token passed through. The current UC enum is fully mapped, so no current server sends such a row, but one table type added by a newer server would otherwise make a schema's lists unusable. GetTable, GetView, DeleteTable, and DeleteView stay strict: a resource of no known kind is still internal, and nothing is deleted.
  • Docs:
    • ui-new/README.md describes the new empty-value and non-Unicode startup behavior.
    • The bridge-contract note in ui-new/AGENTS.md no longer describes the removed CallRequest/CallResponse serde structs. Its camelCase hint now says that Connect's JSON encoding uses proto3 JSON camelCase field names.
    • The build_cors doc no longer reads as if the bridge serves the SPA.
    • env_value and kind_mismatch document their contracts.

Compatibility and behavior changes

The Java REST API and the OpenAPI specs are unchanged. ui-new has not shipped. Compared with main, the bridge behaves differently in five cases:

  • An empty PORT, UI_AUTH_ENABLED, OKTA_AUTH_ENABLED, or KEYCLOAK_AUTH_ENABLED now starts the bridge with the default instead of stopping it.
  • A non-Unicode UC_SERVER or GOOGLE_CLIENT_ID now stops the bridge with an error naming the variable. The non-Unicode error message is now "<VAR> is not valid Unicode", without the raw value.
  • A whitespace-only UC_SERVER now stops the bridge with UC_SERVER must not be whitespace only, and one that is not an http or https base URL without a query or fragment stops it with UC_SERVER must be an http or https base URL without a query or fragment, such as http://localhost:8080.
  • A whitespace-only GOOGLE_CLIENT_ID now leaves the Google button off, a non-blank one that does not end in .apps.googleusercontent.com stops the bridge with an error naming the variable, and one in an unusual shape logs a warning.
  • A list page with an unclassified row now returns the other rows instead of internal.

Validation

  • cargo test --locked passed (56 tests); cargo fmt --check and cargo clippy --all-targets are clean.
  • The new list test fails against main's services/ code and passes with this change.
  • No web/ or proto files change.

Stack

This PR is independent of the remaining ui-new branches. chore/add-ui-web-validation-tests adds a UI_RPC_VALIDATION_ENABLED setting in from_env; when it is rebased onto this change, that line moves into from_lookup.

This pull request and its description were written by Isaac.

newfront and others added 3 commits November 19, 2026 14:24
unitycatalog#2262 made the bridge fail at startup on invalid configuration, but two
paths still disagreed with that:

- An empty PORT or *_AUTH_ENABLED stopped the bridge, while the string
  variables treated empty as unset. Deployment templates often render an
  unset value as an empty string, so setups that worked before failed.
  Every variable now treats empty as unset; a non-empty invalid value is
  still an error.
- UC_SERVER and GOOGLE_CLIENT_ID read through `std::env::var(..).ok()`,
  so a non-Unicode value silently fell back to the default. They now go
  through `env_value` and fail like the other variables.

`from_env` now wraps `from_lookup`, which takes the variable lookup as a
closure, so the tests cover unset, empty, invalid, and non-Unicode values
without changing the process environment.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
`rows_of_kind` failed the whole ListTables or ListViews page when one row
had a missing or unknown `table_type`. The current UC enum is fully
mapped, so no current server hits this, but one table type added by a
newer server would make a schema's table and metric-view lists unusable.

List now skips such a row and logs a warning naming it. Get and delete
stay strict: a resource of no known kind is still `internal`, so it is
never read or deleted as a table.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
- ui-new/AGENTS.md: the bridge-contract note still described the removed
  `CallRequest`/`CallResponse` serde structs. `server/src/proxy.rs` is now
  the generated `UnityProxyService` implementation.
- `build_cors`: "Same-origin (prod)" read as if the bridge still serves
  the SPA. Same-origin now comes from a reverse proxy or the Vite dev
  proxy in front of the bridge.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront

Copy link
Copy Markdown
Collaborator Author

/review

newfront and others added 2 commits November 19, 2026 15:14
`rows_of_kind` logged one warning per unclassified row on every list call,
so a table type that a newer UC server uses widely would log a line per
row on each page load. It now logs one warning per page with the count
and up to three examples, each with its name and raw `table_type`.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
- ui-new/README.md still said an empty boolean or `PORT` stops the
  bridge. An unset or empty variable now takes its default; a non-empty
  invalid value, or one that is not valid Unicode, still stops it.
- `env_value`: say that only an exactly empty value counts as unset; a
  whitespace-only value is validated like any other.
- `kind_mismatch`: document its three outcomes.
- ui-new/AGENTS.md: restore the camelCase hint dropped earlier in this
  PR, reworded for the generated Connect service: Connect's JSON encoding
  uses proto3 JSON camelCase field names, as in the bridge tests'
  request bodies.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront

Copy link
Copy Markdown
Collaborator Author

Addressed the AI review in two commits:

  • Blocker 1, stale README: 54a4bf6. ui-new/README.md now says an unset or empty variable takes its default. A non-empty invalid boolean or PORT (including whitespace only), or a value that is not valid Unicode, stops the bridge with an error naming the variable.
  • Nit 1, one warning per row: 502683d. rows_of_kind now logs one warning per page with the count and up to three examples, each with its name and raw table_type.
  • Nit 2, camelCase hint: 54a4bf6. Restored in ui-new/AGENTS.md, reworded for the generated service: Connect's JSON encoding uses proto3 JSON camelCase field names, as in the bridge tests' request bodies.
  • Nit 3, kind_mismatch contract: 54a4bf6. The doc lists its three outcomes.
  • Nit 4, whitespace-only values: 54a4bf6. The env_value doc says only an exactly empty value counts as unset; a whitespace-only value is validated like any other.

The description is updated to match. cargo test --locked (54 tests), cargo fmt --check, and cargo clippy --all-targets pass.

@newfront

Copy link
Copy Markdown
Collaborator Author

/review

newfront and others added 3 commits November 19, 2026 15:35
`rows_of_kind` pushed unclassified rows into a vector from inside a
`filter` predicate. It is now a plain loop that matches each row's kind
once. The warning also names the listed catalog and schema, which the
row examples alone did not identify.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
The shared list test now skips `FOREIGN` and empty `table_type` rows as
well as unknown and missing ones. It also sends a page where every row is
skipped, and checks that both `ListTables` and `ListViews` return an
empty list with the page token passed through.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
- `from_env`: say that an unset or empty variable takes its default, and
  that an invalid `PORT` or boolean, or a non-Unicode value, is an `Err`
  naming the variable.
- `env_value`: "validated like any other" was wrong for the string
  variables. A whitespace-only value is kept; `PORT` and the booleans
  reject it, and `UC_SERVER` and `GOOGLE_CLIENT_ID` use it as given,
  as before this PR.
- ui-new/AGENTS.md: name `server/tests/proxy.rs` as the example of
  camelCase request bodies.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront

Copy link
Copy Markdown
Collaborator Author

Addressed the second AI review in three commits:

  • Nit 1, list test coverage: 811c1fd. The shared list test also skips FOREIGN and empty table_type rows, and sends a page where every row is skipped. Both ListTables and ListViews return an empty list there, and every case checks that nextPageToken is passed through.
  • Nit 2, side effect in filter: a4c6361. rows_of_kind is now a plain loop that matches each row's kind once. The warning names the listed catalog and schema, taken from the request.
  • Nit 3, from_env doc and AGENTS.md: 922c0e3. The from_env doc states the empty-as-unset and error behavior, and AGENTS.md names server/tests/proxy.rs as the example of camelCase request bodies.
  • Nit 4, whitespace-only strings: 922c0e3. The env_value doc was wrong to say every whitespace-only value is validated; it now says PORT and the booleans reject one, and UC_SERVER and GOOGLE_CLIENT_ID use it as given. That behavior predates this PR, so I've left it unchanged here. Rejecting a blank or malformed UC_SERVER at startup would be a separate behavior change.

The description is updated to match. cargo test --locked (54 tests), cargo fmt --check, and cargo clippy --all-targets pass.

A whitespace-only `UC_SERVER` was used as given, so the bridge started
and failed only on its first call to Unity Catalog. It now stops the
bridge at startup with "UC_SERVER must not be whitespace only". An unset
or exactly empty `UC_SERVER` still takes the default, like every other
variable, so deployment templates that render an unset value as "" keep
working.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront

Copy link
Copy Markdown
Collaborator Author

Follow-up on nit 4 from the second AI review: 67cb4c2 now rejects a whitespace-only UC_SERVER at startup with UC_SERVER must not be whitespace only, instead of starting the bridge and failing on the first UC call. An unset or exactly empty UC_SERVER still takes the default, like every other variable. rejects_invalid_values covers " " and "\t\n", and the existing defaults test still covers UC_SERVER="". GOOGLE_CLIENT_ID is unchanged. The README, the from_env and env_value docs, and the PR description are updated.

@newfront

Copy link
Copy Markdown
Collaborator Author

/review

newfront and others added 3 commits November 19, 2026 16:12
A whitespace-only `GOOGLE_CLIENT_ID` was used as given. `/config` returns
it, and the SPA shows the Google button for any non-empty value, so the
button appeared and failed on click with no startup warning. A malformed
ID failed the same way.

`GOOGLE_CLIENT_ID` is now trimmed. A blank value (empty or whitespace
only) is unset and leaves the button off. Any other value must match
Google's published format,
`^[0-9]+-[a-z0-9]+\.apps\.googleusercontent\.com$`, or the bridge stops
at startup with an error naming the variable.

`env_string` has no callers left and is removed.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
`rows_of_kind` took the request's `SchemaRefView` only to label its
warning. It now takes the catalog and schema names as `&str`, so it does
not depend on the generated request type and its unit test can call it
directly.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
Skipped rows no longer appear in the list response, so the warning is the
only sign that a page is incomplete, and nothing asserted it. A unit test
now runs `rows_of_kind` under a scoped `tracing` subscriber. It checks
for exactly one warning per page with the catalog, schema, full count,
and at most three examples, and for no warning when every row is
recognized. Dropping the warning, logging it per row, or logging a
fourth example each fails the test.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>

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

[AI Assisted] Summary: comment. One normal item inline (malformed UC_SERVER), plus nits. Non-Unicode, empty, and whitespace config cases were checked in a scratch run and behave as described.

Addressed from the #2262 review: items 1, 2, 3, 5 and 6 (config errors, empty values, from_lookup tests, skipping unclassified rows with a warning, and the AGENTS.md and build_cors wording).

Left as is: item 4 (splitting the refactor) and item 7 (the Summary wording on table_type validation). Both concern the merged #2262, so they are not raised again here.

Comment thread ui-new/server/src/config.rs Outdated
okta_enabled: env_bool("OKTA_AUTH_ENABLED", false)?,
keycloak_enabled: env_bool("KEYCLOAK_AUTH_ENABLED", false)?,
port: env_port(env, "PORT", 8081)?,
uc_server: env_non_blank(env, "UC_SERVER", "http://localhost:8080")?,

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.

[AI Assisted] A non-blank but malformed UC_SERVER still starts the bridge, for example uc.example.com:8080 or not a url. The request builder fails on each UC call, so every RPC returns unavailable and the startup check does not catch it. The blank check exists for the same reason. Could UC_SERVER be parsed with reqwest::Url at startup, with an error that names the variable?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in ffb34b9. UC_SERVER is now trimmed and parsed with reqwest::Url at startup. A value that does not parse, or whose scheme is not http or https, stops the bridge with UC_SERVER must be an http or https URL, such as http://localhost:8080. The scheme check is needed because a bare uc.example.com:8080 or localhost:8080 parses with the host as its scheme. uc_server_must_be_an_http_url covers those two, a bare host, not a url, ftp://, and http://, plus a padded URL with a base path that is accepted and trimmed.


fn env_port(key: &str, default: u16) -> Result<u16, String> {
env_value(key)?.map_or(Ok(default), |value| parse_port(key, &value))
fn env_port(env: Lookup<'_>, key: &str, default: u16) -> Result<u16, String> {

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.

[AI Assisted] nit: a whitespace-only PORT or boolean still stops the bridge, while an empty value takes the default. The README documents this. Could you confirm that is intended, or treat blank like empty for templated values?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Intended. An exactly empty value is how templates usually render an unset variable, so it takes the default. A whitespace-only PORT or boolean is more likely a mistake than an unset value. For UI_AUTH_ENABLED, defaulting would also silently turn the SPA's login gate off, so the bridge stops at startup and names the variable instead. A whitespace-only UC_SERVER fails the same way. GOOGLE_CLIENT_ID is the one exception: there, blank means unset, because its default (no Google button) is the safe result. The README documents all of this.

Comment thread ui-new/server/src/config.rs Outdated
port: env_port(env, "PORT", 8081)?,
uc_server: env_non_blank(env, "UC_SERVER", "http://localhost:8080")?,
auth_enabled: env_bool(env, "UI_AUTH_ENABLED", false)?,
google_client_id: env_string(env, "GOOGLE_CLIENT_ID", "")?,

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.

[AI Assisted] nit: a whitespace-only GOOGLE_CLIENT_ID is kept as given and returned by /config, so the Google button can appear with an unusable id. Trimming it, or rejecting it as blank like UC_SERVER, would avoid that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in fd9ad6e. GOOGLE_CLIENT_ID is now trimmed, and a blank value is unset, so the Google button stays off. Any other value must match Google's client ID format, ^[0-9]+-[a-z0-9]+\.apps\.googleusercontent\.com$, or the bridge stops at startup. google_client_id_must_match_googles_format covers blank, valid, padded, and malformed values.

.take(3)
.map(|row| describe_row(row))
.collect();
tracing::warn!(

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.

[AI Assisted] nit: no test asserts the per-page warning. A test with a scoped tracing subscriber could check one warning with the catalog, schema, count, and up to three examples, and none when every row is recognized.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in b8a3da2. rows_of_kind_warns_once_per_page_about_unclassified_rows runs rows_of_kind under a scoped tracing subscriber. It checks for exactly one warning with the catalog, schema, full count, and at most three examples, and for none when every row is recognized. Dropping the warning, logging it per row, or logging a fourth example each fails it.

};
let unclassified = vec![
row("future", Some("SOME_NEW_TYPE")),
row("foreign", Some("FOREIGN")),

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.

[AI Assisted] nit: add a comment that FOREIGN is intentionally outside the OSS TableType enum, and include the case index in the assert messages.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 460932c. Both list tests now say that FOREIGN is a Databricks Unity Catalog type outside the OSS TableType enum, and the list test's assert messages include the case index.

/// Keeps the rows of one kind from a UC table list. Rows of no known kind are
/// skipped rather than failing the page, so a table type added by a newer UC
/// server does not break the list; one warning per page counts them.
fn rows_of_kind<'a>(

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.

[AI Assisted] nit: rows_of_kind takes the whole SchemaRefView only for the log line. Passing the catalog and schema names, or logging in the callers, would narrow it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 5e38965. rows_of_kind now takes catalog: &str, schema: &str instead of the SchemaRefView.

- `table_and_view_lists_keep_only_their_own_kind` runs two cases per
  RPC, and its assert messages named only the RPC. They now include the
  case index.
- Both list tests use `FOREIGN` as an unclassified type. A comment says
  it is a Databricks Unity Catalog type outside the OSS `TableType` enum,
  so it is unclassified on purpose.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront

Copy link
Copy Markdown
Collaborator Author

Addressed the third AI review in four commits:

  • Nit 1, whitespace-only GOOGLE_CLIENT_ID: fd9ad6e. The value is trimmed. A blank one (empty or whitespace only) is unset, so the Google button stays off. Any other value must match Google's client ID format, ^[0-9]+-[a-z0-9]+\.apps\.googleusercontent\.com$, or the bridge stops at startup with an error naming the variable. google_client_id_must_match_googles_format covers blank, valid, and padded values, plus eight malformed ones (wrong suffix, letters in the number, uppercase, a missing part, a trailing domain, and punctuation only). The README is updated, and env_string, which had no callers left, is removed.
  • Nit 2, untested warning: b8a3da2. A unit test runs rows_of_kind under a scoped tracing subscriber. It checks for exactly one warning with the catalog, schema, full count, and at most three examples, and for none when every row is recognized. Dropping the warning, logging it per row, or logging a fourth example each fails it.
  • Nit 3, FOREIGN and case labels: 460932c. A comment says FOREIGN is a Databricks Unity Catalog type outside the OSS TableType enum, and the list test's assert messages include the case index.
  • Nit 4, SchemaRefView only for logging: 5e38965. rows_of_kind takes catalog: &str, schema: &str.

The description is updated to match. cargo test --locked (55 tests), cargo fmt --check, and cargo clippy --all-targets pass.

@newfront newfront added this to the 0.8 milestone Nov 20, 2026
A non-blank but malformed `UC_SERVER`, such as `uc.example.com:8080` or
`not a url`, still started the bridge. Every request to UC then failed,
so every RPC returned `unavailable` and nothing at startup said why.

`UC_SERVER` is now trimmed and parsed with `reqwest::Url` at startup.
A value that does not parse, or whose scheme is not `http` or `https`,
stops the bridge with "UC_SERVER must be an http or https URL, such as
http://localhost:8080". The scheme check is needed because a bare
`host:port` parses with the host as its scheme. The whitespace-only
check and an unset or empty value's default are unchanged.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@yili-db

yili-db commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

/review

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

[AI Assisted] Summary: comment. Item A is partly addressed, with the query and fragment gap inline. Items C to F are addressed. The pushback on B is accepted.

Also a nit outside this diff: the comment above regex = "1" in ui-new/server/Cargo.toml (lines 23 to 25) says regex is only for generated CEL validators. config.rs now uses it directly, so the comment should say so. Cargo.toml is not in this PR's diff, so I am noting it here rather than inline.

Comment thread ui-new/server/src/config.rs Outdated
}
// A bare `host:port` parses with `host` as its scheme, so check the scheme.
match reqwest::Url::parse(value) {
Ok(url) if matches!(url.scheme(), "http" | "https") => Ok(value.to_string()),

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.

[AI Assisted] A UC_SERVER with a query or fragment still passes this check, and it misroutes every UC call. Checked with a scratch run: http://uc:8080/?x=1 moves the API path into the query string, and http://uc:8080#frag moves it into the fragment, so requests go to /. Could the check also reject url.query() and url.fragment(), with http://uc?x and http://uc#f added to uc_server_must_be_an_http_url? The error text and README could then say base URL without query or fragment.

Comment thread ui-new/server/src/config.rs Outdated
}

/// Google's published format for an OAuth client ID.
const GOOGLE_CLIENT_ID_FORMAT: &str = r"^[0-9]+-[a-z0-9]+\.apps\.googleusercontent\.com$";

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.

[AI Assisted] Where does this pattern come from? The comment calls it Google's published format, but nothing in the repo defines it. If Google issues a valid client ID outside this pattern, the bridge stops at startup. Would a check on the .apps.googleusercontent.com suffix be enough, or is there a source for the grammar we can link?

Nit: Regex::new runs on every call to env_google_client_id. A LazyLock would compile it once.

The bridge builds each UC URL by appending the request path to
`UC_SERVER`. With `http://uc:8080/?x=1`, the path ended up inside the
query string; with `http://uc:8080#frag`, it ended up in the fragment,
which is never sent. The startup check only tested the scheme, so the
bridge started and every UC call failed.

`UC_SERVER` must now also have no query or fragment, including an empty
one such as a trailing `?` or `#`. Base paths such as `/uc/` are still
accepted. The error and README say it must be a base URL without a query
or fragment.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@yili-db

yili-db commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

/review

newfront and others added 3 commits November 19, 2026 21:13
The `rows_of_kind` warning test carried its own writer and scoped
subscriber. The next commit adds a warning to the config reader that
needs the same capture, so the helper moves to a test-only
`test_logs::capture` module. The `rows_of_kind` test is unchanged
apart from calling it.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
…r shapes

A `GOOGLE_CLIENT_ID` that Google accepts but that did not match the full
`^[0-9]+-[a-z0-9]+\.apps\.googleusercontent\.com$` pattern would have
stopped the bridge, and fixing that would need a bridge release. Google
documents only an example ID, not a grammar.

A non-blank value must still end in `.apps.googleusercontent.com`, with
something before it, or the bridge stops at startup. An ID with that
suffix but not in the usual `<number>-<id>` shape, the shape of the
example in Google's client ID guide, now starts the bridge and logs a
warning. The pattern compiles once in a `LazyLock`. The code and README
no longer call it "Google's published format".

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
The comment above `regex = "1"` said the dependency exists only for the
generated CEL validators, which a codegen upgrade would make unnecessary.
`config.rs` now uses it for the `GOOGLE_CLIENT_ID` shape check, so the
comment says to keep it.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Scott Haines <[email protected]>
@newfront

Copy link
Copy Markdown
Collaborator Author

Addressed the fourth AI review in four commits:

  • Blocker 1, UC_SERVER with a query or fragment: 7e67791. UC_SERVER must now also have no query or fragment, including an empty one such as a trailing ? or #, since the bridge appends each request path to it. Base paths such as /uc/ are still accepted. uc_server_must_be_an_http_url rejects http://uc:8080/?x=1, http://uc:8080?, http://uc:8080#frag, and http://uc:8080/uc#. The error and README say it must be a base URL without a query or fragment.
  • Nit 1, strict client ID pattern: e19539e, with the log-capture helper shared in 824d829. A non-blank GOOGLE_CLIENT_ID must still end in .apps.googleusercontent.com, with something before it, or the bridge stops. An ID with that suffix but not in the usual <number>-<id> shape now starts the bridge and logs a warning. That shape comes from the example in Google's client ID guide, 1234567890-abc123def456.apps.googleusercontent.com; Google documents no grammar, so the code and README no longer call it Google's published format. The pattern compiles once in a LazyLock. google_client_id_needs_the_google_suffix checks that unusual shapes are kept with exactly one warning, that usual IDs log nothing, and that values without the suffix fail.
  • Nit 2, regex dependency comment: 92697f4. The comment now says config.rs also uses regex, so it must stay after the codegen upgrade.
  • Nit 3, splitting rows_of_kind: not taken. The review calls it a preference, and the current shape is already covered by rows_of_kind_warns_once_per_page_about_unclassified_rows.

The description is updated to match. cargo test --locked (56 tests), cargo fmt --check, and cargo clippy --all-targets pass.

@yili-db

yili-db commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

/review

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

[AI Assisted] Approve. The remaining items (the description test count, the unbackticked <VAR>, the ALLOWED_ORIGINS wording, and the pre-existing userinfo logging followup) are small and do not need another round.

@yili-db
yili-db merged commit 0731ed9 into unitycatalog:main Nov 20, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants