Skip to content

builder/stream_builder: validate UC three-part table name format in validate()#332

Open
Dev-X25874 wants to merge 3 commits into
databricks:mainfrom
Dev-X25874:fix/validate-table-name-format
Open

builder/stream_builder: validate UC three-part table name format in validate()#332
Dev-X25874 wants to merge 3 commits into
databricks:mainfrom
Dev-X25874:fix/validate-table-name-format

Conversation

@Dev-X25874

@Dev-X25874 Dev-X25874 commented May 29, 2026

Copy link
Copy Markdown

What changes are proposed in this pull request?

WHAT: StreamBuilder::validate() now checks that the table name follows the
required catalog.schema.table format, returning ZerobusError::InvalidTableName
immediately if it does not.

WHY: validate() previously only checked that the table name was non-empty.
A malformed name like "mytable" or "schema.table" would pass validate() and
build(), only to fail later inside the async OAuth token fetch — far from the
misconfigured builder. The three-part invariant was already enforced in
DefaultTokenFactory::parse_table_name; this PR moves that check to the earliest
possible point so the error fires synchronously, before any I/O occurs.

How is this tested?

Three unit tests added to the existing #[cfg(test)] block in stream_builder.rs:

  • validate_rejects_single_part_table_name
  • validate_rejects_two_part_table_name
  • validate_rejects_table_name_with_empty_part

All three fail on the original code and pass after the fix.

@teodordelibasic-db teodordelibasic-db self-requested a review June 3, 2026 09:43

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

LGTM, thanks for contributing, let's only do this when testing feature is off.

"table name is required: call .table()".into(),
));
}
{

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.

We should guard this block with #[cfg(not(feature = "testing"))] because we use non-three-part table names when testing.

@Dev-X25874

Copy link
Copy Markdown
Author

@teodordelibasic-db Done, guarded the block with #[cfg(not(feature = "testing"))] in the latest commit.

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

LGTM, you just need to rebase to newest main.

@Dev-X25874 Dev-X25874 force-pushed the fix/validate-table-name-format branch from 5bf288d to 6ea9e6f Compare June 4, 2026 12:26
@Dev-X25874

Copy link
Copy Markdown
Author

@teodordelibasic-db Done, rebased onto latest main. Ready for another look!

@Dev-X25874 Dev-X25874 force-pushed the fix/validate-table-name-format branch from 6ea9e6f to cc1dc2e Compare June 5, 2026 05:07
@teodordelibasic-db

Copy link
Copy Markdown
Collaborator

Ah so we are hitting an issue where CI is broken for external contributions from forks because of the need to fetch a JFrog token to access the proxy registry. I have asked internally if there is an established solution for this.

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