You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BZ check] [$250] Workspace - All workspaces are created with the same name as "my group workspace" #63384
Version Number: v9.1.56-9 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): +917998977868 Issue reported by: Applause Internal Team Device used: Redminote 10s android 13 phone App Component: Workspace Settings
Action Performed:
Go to https://staging.new.expensify.com/home
2. Login with a new phone number ( no expensify account)
3. In onboarding select managey team expenses - 1-10 - none and complete the flow
4. Create a new workspace
5. Go to workspace list
6. Tap add new workspace
7. Repeat step 6
Expected Result:
All workspaces must not be created in same name as "my group workspace".
Actual Result:
All workspaces are created in same name as "my group workspace".
Please re-state the problem that we are trying to solve in this issue.
The issue is that when a user signs up with a phone number (no Expensify account) and creates multiple workspaces, all workspaces are created with the same name "My Group Workspace" instead of having unique names with incrementing numbers like "My Group Workspace 1", "My Group Workspace 2", etc.
When the user has an SMS domain email (i.e., registered with a phone number), the function returns a static string "My Group Workspace" without checking for duplicates.
Unlike the logic for regular email domains — where the function checks existing workspace names and appends a number if needed — the SMS path lacks this check:
What changes do you think we should make in order to solve the problem?
We should update the SMS domain logic in generateDefaultWorkspaceName to follow the same pattern used for regular emails. That is: check for existing workspaces named "My Group Workspace" and append an incremented number if needed.
if(`@${domain}`===CONST.SMS.DOMAIN){constmyGroupWorkspaceName=translateLocal('workspace.new.myGroupWorkspace');if(isEmptyObject(allPolicies)){returnmyGroupWorkspaceName;}// Use the same pattern as for regular email domainsconstescapedName=escapeRegExp(myGroupWorkspaceName);constworkspaceRegex=newRegExp(`^${escapedName}(?:\\s*(\\d+))?$`,'i');constworkspaceNumbers=Object.values(allPolicies).map((policy)=>workspaceRegex.exec(policy?.name??'')).filter(Boolean)// Remove null matches.map((match)=>Number(match?.[1]??'0'));constlastWorkspaceNumber=workspaceNumbers.length>0 ? Math.max(...workspaceNumbers) : undefined;returnlastWorkspaceNumber!==undefined
? `${myGroupWorkspaceName}${lastWorkspaceNumber+1}`
: myGroupWorkspaceName;}
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
A test that verifies SMS domain users get incrementing workspace names:
A test that ensures the fallback to the base name if no matching workspaces exist.
What alternative solutions did you explore? (Optional)
changed the title [-]Workspace - All workspaces are created with the same name as "my group workspace"[/-][+][$250] Workspace - All workspaces are created with the same name as "my group workspace"[/+]on Jun 4, 2025
All workspaces are created with the same name as "my group workspace"
@suneox , the reason we'd want a regression test is to ensure this doesn't happen again. Are you confident that, after the fix, that a version of this can't or won't happen again? IF not, let's err on the side of adding a test. Thx
All workspaces are created with the same name as "my group workspace"
@suneox , the reason we'd want a regression test is to ensure this doesn't happen again. Are you confident that, after the fix, that a version of this can't or won't happen again? IF not, let's err on the side of adding a test. Thx
Agreed! I'll create a regression test to ensure this case is covered
changed the title [-][Due for payment 2025-06-27] [$250] Workspace - All workspaces are created with the same name as "my group workspace"[/-][+][BZ check] [$250] Workspace - All workspaces are created with the same name as "my group workspace"[/+]on Jul 3, 2025
Activity
melvin-bot commentedon Jun 3, 2025
Triggered auto assignment to @mallenexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.ganzz4 commentedon Jun 3, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
The issue is that when a user signs up with a phone number (no Expensify account) and creates multiple workspaces, all workspaces are created with the same name "My Group Workspace" instead of having unique names with incrementing numbers like "My Group Workspace 1", "My Group Workspace 2", etc.
What is the root cause of that problem?
The root cause lies in the
generateDefaultWorkspaceNamefunction insrc/libs/actions/Policy/Policy.ts.When the user has an SMS domain email (i.e., registered with a phone number), the function returns a static string
"My Group Workspace"without checking for duplicates.Unlike the logic for regular email domains — where the function checks existing workspace names and appends a number if needed — the SMS path lacks this check:
App/src/libs/actions/Policy/Policy.ts
Lines 1648 to 1650 in 171045a
Here is how the logic works for regular email domains:
App/src/libs/actions/Policy/Policy.ts
Lines 1652 to 1668 in 171045a
What changes do you think we should make in order to solve the problem?
We should update the SMS domain logic in
generateDefaultWorkspaceNameto follow the same pattern used for regular emails. That is: check for existing workspaces named"My Group Workspace"and append an incremented number if needed.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
ganzz4 commentedon Jun 3, 2025
I've recorded a quick demo video showing the fix in action:
fix.mp4
vishalPwc commentedon Jun 3, 2025
@ganzz4 appreciate your proposal. Can you post what could be the result in one of test case scenario mentioned below
Steps :
Can you provide the Expected Result as per your changes.
Thanks in advance.
ganzz4 commentedon Jun 3, 2025
@vishalPwc thanks for the question! Here's the expected behavior:
Initial workspaces:
The user deletes My Workspace 2 and My Workspace 3.
Remaining:
Now, the user creates a new workspace.
According to the proposed logic (which looks for the highest number used and increments it), the new workspace will be:
My Workspace 6
Even though workspaces 2 and 3 were deleted, the highest number present is 5 - so the next one becomes 6.
ganzz4 commentedon Jun 3, 2025
Here's a quick video showing the behavior in practice:
fix.mp4
[-]Workspace - All workspaces are created with the same name as "my group workspace"[/-][+][$250] Workspace - All workspaces are created with the same name as "my group workspace"[/+]melvin-bot commentedon Jun 4, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021930071819863605009
melvin-bot commentedon Jun 4, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (
External)50 remaining items
mallenexpensify commentedon Jun 30, 2025
@suneox , the reason we'd want a regression test is to ensure this doesn't happen again. Are you confident that, after the fix, that a version of this can't or won't happen again? IF not, let's err on the side of adding a test. Thx
suneox commentedon Jul 1, 2025
Agreed! I'll create a regression test to ensure this case is covered
nkdengineer commentedon Jul 1, 2025
@mallenexpensify Job accepted, thank you!
mallenexpensify commentedon Jul 3, 2025
Contributor: @nkdengineer paid $250 via Upwork
Contributor+: @suneox owed $250 via NewDot (awaiting onboarding)
@suneox plz propose the regression test steps so I can get it created. Thx
[-][Due for payment 2025-06-27] [$250] Workspace - All workspaces are created with the same name as "my group workspace"[/-][+][BZ check] [$250] Workspace - All workspaces are created with the same name as "my group workspace"[/+]suneox commentedon Jul 3, 2025
Regression Test Proposal
Test:
Do we agree 👍 or 👎
melvin-bot commentedon Jul 8, 2025
@mallenexpensify Huh... This is 4 days overdue. Who can take care of this?
mallenexpensify commentedon Jul 8, 2025
Thx @suneox we're all set, test case is here
suneox commentedon Aug 11, 2025
I've requested in ND
JmillsExpensify commentedon Aug 12, 2025
$250 approved for @suneox
trjExpensify commentedon Aug 12, 2025
$250 approved for @suneox