@@ -69,7 +69,7 @@ func validateDevelopmentMode(b *bundle.Bundle) diag.Diagnostics {
6969 diags = diags .Extend (diag .Errorf ("%s must start with '~/' or contain the current username to ensure uniqueness when using 'mode: development'" , path ))
7070 }
7171 }
72- if p .NamePrefix != "" && ! strings . Contains (p .NamePrefix , u . ShortName ) && ! strings . Contains ( p . NamePrefix , u . UserName ) {
72+ if p .NamePrefix != "" && ! namePrefixContainsUserIdentifier (p .NamePrefix , u ) {
7373 // Resources such as pipelines require a unique name, e.g. '[dev steve] my_pipeline'.
7474 // For this reason we require the name prefix to contain the current username;
7575 // it's a pitfall for users if they don't include it and later find out that
@@ -83,6 +83,21 @@ func validateDevelopmentMode(b *bundle.Bundle) diag.Diagnostics {
8383 return diags
8484}
8585
86+ // namePrefixContainsUserIdentifier checks if the name prefix contains any user identifier
87+ // (username, short name, or domain friendly name) to ensure uniqueness.
88+ func namePrefixContainsUserIdentifier (prefix string , u * config.User ) bool {
89+ if strings .Contains (prefix , u .UserName ) {
90+ return true
91+ }
92+ if strings .Contains (prefix , u .ShortName ) {
93+ return true
94+ }
95+ if u .DomainFriendlyName != "" && strings .Contains (prefix , u .DomainFriendlyName ) {
96+ return true
97+ }
98+ return false
99+ }
100+
86101// findNonUserPath finds the first workspace path such as root_path that doesn't
87102// contain the current username or current user's shortname.
88103func findNonUserPath (b * bundle.Bundle ) string {
0 commit comments