builder/stream_builder: validate UC three-part table name format in validate()#332
builder/stream_builder: validate UC three-part table name format in validate()#332Dev-X25874 wants to merge 3 commits into
Conversation
teodordelibasic-db
left a comment
There was a problem hiding this comment.
LGTM, thanks for contributing, let's only do this when testing feature is off.
| "table name is required: call .table()".into(), | ||
| )); | ||
| } | ||
| { |
There was a problem hiding this comment.
We should guard this block with #[cfg(not(feature = "testing"))] because we use non-three-part table names when testing.
|
@teodordelibasic-db Done, guarded the block with #[cfg(not(feature = "testing"))] in the latest commit. |
teodordelibasic-db
left a comment
There was a problem hiding this comment.
LGTM, you just need to rebase to newest main.
5bf288d to
6ea9e6f
Compare
|
@teodordelibasic-db Done, rebased onto latest main. Ready for another look! |
6ea9e6f to
cc1dc2e
Compare
|
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. |
What changes are proposed in this pull request?
WHAT:
StreamBuilder::validate()now checks that the table name follows therequired
catalog.schema.tableformat, returningZerobusError::InvalidTableNameimmediately 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 passvalidate()andbuild(), only to fail later inside the async OAuth token fetch — far from themisconfigured builder. The three-part invariant was already enforced in
DefaultTokenFactory::parse_table_name; this PR moves that check to the earliestpossible 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 instream_builder.rs:validate_rejects_single_part_table_namevalidate_rejects_two_part_table_namevalidate_rejects_table_name_with_empty_partAll three fail on the original code and pass after the fix.