Repository navigation
Storage name validation - #4881
Merged
Merged
Conversation
Contributor
|
Lightbeam link |
…/storage-name-validation
Contributor
|
Lightbeam link |
gabrielbeamable
commented
Oct 7, 2026
| public override async Task Handle(NewStorageCommandArgs args) | ||
| { | ||
| await args.CreateConfigIfNeeded(_initCommand); | ||
| StorageNameValidator.ValidateNewStorage(args.AppContext.Cid, await ResolveTargetScope(args), args.ProjectName, |
Contributor
Author
There was a problem hiding this comment.
move the storageNameValidator to live along the CreateNewStorage instead of having its own class
Contributor
|
Lightbeam link |
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
A storage's MongoDB database is named
{cid}{pid|zid}_{storageName}, and MongoDB rejects database names longer than 63 characters, both locally and on Atlas. Until now nothing checked this, so a long storage name only failed on its first database call, with a bareInvalidNamespaceerror. This PR adds CLI and runtime checks that report the problem earlier, with a clear message (phase 1; server-side validation in BeamableAPI follows separately).Changes
StorageDatabaseName(inStorageObjectConnectionProvider.cs): the database-name rule (63 max, compose, budget, message), shared by the microservice runtime and the CLIGetDatabaseByStorageNamethrowsStorageNameTooLongExceptionbefore the first database callStorageNameValidator:FindTooLong/ThrowIfAny(local storages only, all offenders reported at once), andValidateNewStoragebeam project new storage: fails before creating files when the name doesn't fit the current realm/zone; warns (worst-case budget) when the target is unknownBeamoLocalSystem.InitManifest): offline check against cid + pid, or the localzidfor zone storages; catches storages renamed by hand and blocksproject runCliRequester.GetEffectiveScopeIds(): shared parse of the{cid}.{zid}scope override;ServiceUploadUtilnow uses itCliExceptionmessage is repeated in red as the last line of output (skipped for pipe/raw output)Example error: