Repository navigation
Enforce lowercase alphanumeric/underscore naming across all metadata APIs - #403
Merged
Merged
Conversation
…erscore
V3 database, table, and alias names now only accept lowercase letters,
digits, and underscores (hyphens and uppercase letters are rejected).
This aligns with HBase table naming conventions and avoids ambiguity
between names used as identifiers in multiple systems.
- V3NameValidator: pattern updated to ^[a-z][a-z0-9_]{0,63}$
- TableCreateRequest: @pattern annotation updated to match
- All E2E and controller tests migrated to underscore-style names
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
1 task done
GET/PUT/DELETE no longer reject existing resources with legacy names. Name validation is enforced only on POST (create) requests, so hyphenated/uppercase resources created before this change remain accessible. Also fixes AliasCreateRequest.alias and .table patterns to match the new policy (lowercase alphanumeric/underscore only). Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Add Constants.Name with PATTERN, MESSAGE, MAX_LENGTH as the single
source of truth for the ^[a-z][a-z0-9_]{0,63}$ naming rule.
V3NameValidator and all @pattern annotations in request classes
(AliasCreateRequest, AliasUpdateRequest, TableCreateRequest) now
reference Constants.Name instead of inline literals. TableCreateRequest
storage URL regex also updated to disallow uppercase in namespace/table
segments.
Fix missing validation on AliasUpdateRequest.table (was still allowing
hyphens and uppercase). Add update-path validation tests to
AliasControllerTest.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Add NameValidator (server/util) as the shared enforcement point for Constants.Name.PATTERN. V3NameValidator now delegates to it. Apply NameValidator.validate() to all V2 create/update path variables: - ServiceController: service name - ServiceLabelController: service + label names, copy target - ServiceAliasController: service + alias names - StorageController: storage name Read/delete paths are unaffected — existing legacy names remain accessible. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Validate the table name qualifier against Constants.Name.PATTERN in DatastoreHBaseService.createTable. Existing table operations (get/update/enable/disable/delete) are unaffected. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Move the datastore:// URI regex into Constants.Name.STORAGE_URI_PATTERN and STORAGE_URI_MESSAGE. TableCreateRequest.storage @pattern now references the constant. DatastoreUri exposes URI_PATTERN from the same source. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
V2 update path variables accept any name so existing resources with legacy names remain accessible — consistent with V3 policy. copy target (a new name being created) is still validated. Also fix Constants.Name.STORAGE_URI_PATTERN to require each segment to start with a lowercase letter, matching Name.PATTERN. Remove dead DatastoreUri.URI_PATTERN. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Add COMMENT_MAX_LENGTH and COMMENT_SIZE_MESSAGE to Constants.Name. All @SiZe annotations on comment fields now reference these constants. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
Author
|
Deploy prerequisites Before upgrading, confirm no existing resource violates the new policy — run via the Actionbase CLI: actionbase -e "doctor names"Expected: Two things
Existing legacy-named resources remain readable, updatable, and deletable — only creation is restricted. |
Contributor
Author
|
Merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enforces a uniform naming policy —
^[a-z][a-z0-9_]{0,63}$— across all Actionbase metadata create paths: V3 (database, table, alias) and V2 (service, label, alias, storage). Names containing hyphens or uppercase letters are rejected with 400 Bad Request on create. Read, update, and delete paths are unaffected. Note: creating a new table/alias under a legacy-named parent database is rejected, since the parent name is validated on create — intentional, as it also stops new resources accreting under non-conforming databases.Why this naming policy
Two constraints that apply simultaneously drove the choice of
^[a-z][a-z0-9_]{0,63}$:The intersection of these two constraint sets is: lowercase letters, digits, and underscores only, starting with a letter, max 64 characters.
Changes
Single source of truth
core/Constants.Name—PATTERN,MESSAGE,COMMENT_MAX_LENGTH,COMMENT_SIZE_MESSAGE,STORAGE_URI_PATTERN,STORAGE_URI_MESSAGEasconst valserver/util/NameValidator— shared validator used by all controllers; throwsResponseStatusException(400)on mismatchV3NameValidator— now delegates toNameValidatorV3 — create paths
DatabaseController,TableController,AliasController: name validation on POST onlyTableCreateRequest,AliasCreateRequest,AliasUpdateRequest:@Patternand@Sizeannotations referenceConstants.NameTableCreateRequest.storage: datastore URI regex updated to disallow uppercaseAliasUpdateRequest.tablewas still using the old regex (allowed hyphens/uppercase)V2 — create paths only
ServiceController,ServiceLabelController,ServiceAliasController,StorageController: path variable validated on POST onlyServiceLabelController.copy: new target name validated; existing source names are notHBase
DatastoreHBaseService.createTable: table name qualifier validated viaNameValidatorTests
hyphen returns 400anduppercase returns 400test cases added per resource typeAliasControllerTest: update-path validation tests fortablefield addedV3NameValidatorTest:my-db,MyDB,Amoved to invalid casesHow to Test
Create with a hyphenated name → 400:
Read an existing legacy resource → 200:
This PR is a breaking change for any code that creates metadata resources.
Before deploying, all clients and pipelines that automatically create metadata (services, labels, aliases, databases, tables, storages) must be audited and updated to ensure they only submit names matching
^[a-z][a-z0-9_]{0,63}$. Any pipeline submitting names with hyphens or uppercase will receive 400 after this lands.Existing legacy-named resources remain readable, updatable, and deletable. Only creation is restricted — including new child resources under a legacy-named parent, which now return 400.
Reviewer Notes
Constants.Nameis in thecoremodule, which is already a dependency of bothengineandserver. No new module dependencies introduced.StorageControllerchanges here will be superseded by its deletion in Block v2 Storage creation #399.Checklist
AI Assistance