Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: increase group name limit to 255#15377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 3 commits intomainfrombq/feat-increase-group-name-length
Nov 6, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

Close#15184

{"",false},
{"my-group",true},
{"create",false},
{"new",false},
Copy link
Member

Choose a reason for hiding this comment

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

Why is this invalid?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

To avoid route conflicts.

// Avoid conflicts with routes like /templates/new and /groups/create.ifstr=="new"||str=="create" {returnxerrors.Errorf("cannot use %q as a name",str)}

mafredri reacted with thumbs up emoji
@BrunoQuaresma
Copy link
CollaboratorAuthor

@ethanndickson@code-asher I see you both worked on this group name validation in the past, so I'm just checking if my changes are ok.

Comment on lines 272 to 273
{randomString(255),true},
{randomString(256),false},
Copy link
Member

Choose a reason for hiding this comment

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

Could you usetestutil.GetRandomName(...) ?

Copy link
Member

Choose a reason for hiding this comment

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

I think get random name is limited in length 🤔

Copy link
Member

Choose a reason for hiding this comment

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

oh, then perhapsnamesgenerator.GetRandomName(255)?

Copy link
Member

Choose a reason for hiding this comment

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

GetRandomName only checks if the argument is greater than 0, and if it is, appends a random number between 1 and 10

Copy link
Member

Choose a reason for hiding this comment

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

ok, one last guess:cryptorand.String(...)

ethanndickson, mafredri, and BrunoQuaresma reacted with thumbs up emojiethanndickson reacted with heart emoji
t.Run(testCase.Name,func(t*testing.T) {
t.Parallel()
err:=codersdk.GroupNameValid(testCase.Name)
assert.Equal(t,testCase.Valid,err==nil)
Copy link
Member

Choose a reason for hiding this comment

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

Can you modify this to contain the error if something bad happens:

assert.Equal(t, testCase.Valid, err == nil, "Test case %s failed: expected valid=%t but got error: %v", testCase.Name, testCase.Valid, err)

BrunoQuaresma reacted with thumbs up emoji
Copy link
Member

@ethanndicksonethanndickson left a comment

Choose a reason for hiding this comment

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

LGTM once Marcin's feedback is addressed!

Copy link
Member

@code-ashercode-asher left a comment

Choose a reason for hiding this comment

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

Yup, the 36 char limit was pretty arbitrary so this makes sense to me.

@BrunoQuaresmaBrunoQuaresma changed the titlefeat(coderd): increase group name limit to 255feat(api): increase group name limit to 255Nov 6, 2024
@BrunoQuaresmaBrunoQuaresma changed the titlefeat(api): increase group name limit to 255refactor: increase group name limit to 255Nov 6, 2024
@BrunoQuaresmaBrunoQuaresma merged commit7f51005 intomainNov 6, 2024
32 checks passed
@BrunoQuaresmaBrunoQuaresma deleted the bq/feat-increase-group-name-length branchNovember 6, 2024 17:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mafredrimafredrimafredri approved these changes

@mtojekmtojekmtojek left review comments

@ethanndicksonethanndicksonethanndickson approved these changes

@code-ashercode-ashercode-asher approved these changes

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Support longer group names

5 participants

@BrunoQuaresma@mafredri@mtojek@ethanndickson@code-asher

[8]ページ先頭

©2009-2025 Movatter.jp