Skip to content

fix: DH-17599: Fix table name validation#2403

Merged
vbabich merged 4 commits intodeephaven:mainfrom
vbabich:fix_table_name_validation
Apr 2, 2025
Merged

fix: DH-17599: Fix table name validation#2403
vbabich merged 4 commits intodeephaven:mainfrom
vbabich:fix_table_name_validation

Conversation

@vbabich
Copy link
Copy Markdown
Collaborator

@vbabich vbabich commented Apr 2, 2025

PR #2398 allowed hyphens in namespace and table names. However, I noticed that server-side validation rejects names starting with a hyphen, while these names appear valid on the client-side.

io.deephaven.db.tables.utils.DBNameValidator uses separate regular expressions to sanitize and validate names. This change adds the correct TABLE_NAME_PATTERN for table name validation instead of checking if the name matches its sanitized version.

@vbabich vbabich self-assigned this Apr 2, 2025
@vbabich vbabich requested review from a team and dgodinez-dh and removed request for a team April 2, 2025 20:01
@vbabich vbabich changed the title DH-17599: Fix table name validation fix: DH-17599: Fix table name validation Apr 2, 2025
@vbabich vbabich requested a review from Copilot April 2, 2025 20:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes table name validation by replacing client-side name sanitization with a proper regular expression that matches the server-side validation rules.

  • Introduces TABLE_NAME_PATTERN for table name validation.
  • Updates isValidTableName to use the new regex.
  • Improves the test coverage by iterating over a set of invalid table names.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/utils/src/DbNameValidator.ts Adds TABLE_NAME_PATTERN and updates table name validation
packages/utils/src/DbNameValidator.test.ts Revises tests for invalid table names

Comment thread packages/utils/src/DbNameValidator.ts
Comment thread packages/utils/src/DbNameValidator.ts Outdated
vbabich and others added 2 commits April 2, 2025 14:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@vbabich vbabich enabled auto-merge (squash) April 2, 2025 20:34
@vbabich vbabich merged commit 90ebb08 into deephaven:main Apr 2, 2025
10 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants