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
[Due for payment 2025-07-04] [$250] Onboarding - Guide message contains "undefined" in #admins room #62262
Version Number: 9.1.46-5 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: Exp Email or phone of affected tester (no customers):sdjoijndoijdsojosij@gmail.com Issue reported by: Applause Internal Team Device used: Mac 15.4 / Chrome App Component: Other
Action Performed:
Go to staging.new.expensify.com
Log in with a new Gmail account.
Select Something else during onboarding and complete the flow.
Create a new workspace.
Go to #admins.
Expected Result:
The guide message will not contain "undefined" in #admins room.
Actual Result:
The guide message contains "undefined" in #admins room - Here is a task list I’d recommend for a company of your size with undefined submitters:
message: ({onboardingCompanySize: companySize})=>`Here is a task list I’d recommend for a company of your size with ${companySize} submitters:`,
tasks: [
What changes do you think we should make in order to solve the problem?
we can update this message accordingly if onboardingCompanySize is undefined
message: ({onboardingCompanySize: companySize}) => `Here is a task list I’d recommend for a company of your size ${companySize ? `with ${companySize} submitters` : ''}`,
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Update CreateWorkspace test to verify the onboarding message is correctly.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
We always pass CONST.ONBOARDING_CHOICES.MANAGE_TEAM as the engagementChoice. However, in the onboarding flow (from OP), the user select Something else (LOOKING_AROUND), which means there's no onboardingCompanySize. Since we're hardcoding MANAGE_TEAM, we override the user’s actual onboarding selection, leading to incorrect engagementChoice when creating the workspace.
message: ({onboardingCompanySize: companySize})=>`Here is a task list I’d recommend for a company of your size with ${companySize} submitters:`,
What changes do you think we should make in order to solve the problem?
Instead of always using CONST.ONBOARDING_CHOICES.MANAGE_TEAM, we should update createWorkspace to default to introSelected?.choice and fallbackto CONST.ONBOARDING_CHOICES.MANAGE_TEAM.
changed the title [-]Onboarding - Guide message contains "undefined" in #admins room[/-][+][$250] Onboarding - Guide message contains "undefined" in #admins room[/+]on May 19, 2025
Please re-state the problem that we are trying to solve in this issue.
When a new user completes the onboarding flow by selecting "Something else" during onboarding and creates a new workspace, the guide message in the #admins room contains the text "undefined" in a task list recommendation. Specifically, it shows: "Here is a task list I'd recommend for a company of your size with undefined submitters:"
What is the root cause of that problem?
The root cause is in the handling of the onboardingCompanySize parameter when creating the guide message for the #admins room. When a user selects "Something else" during onboarding, the onboardingCompanySize value is not being properly validated or defaulted before being used in the message template.
message: ({onboardingCompanySize: companySize})=>`Here is a task list I’d recommend for a company of your size with ${companySize} submitters:`,
tasks: [
createWorkspaceTask,
The template uses the renamed parameter companySize directly without checking if it's undefined, which causes the "undefined" text to appear in the message.
What changes do you think we should make in order to solve the problem?
We should modify the message template function in CONST.ts to include a default value for the companySize parameter when it's undefined or null:
message: ({onboardingCompanySize: companySize})=>`Here is a task list I’d recommend for a company of your size with ${companySize} submitters:`,
tasks: [
createWorkspaceTask,
Specifically:
In the arrow function parameters, we should add a default value for the renamed companySize parameter (e.g., 'your')
This default value will be used whenever the original onboardingCompanySize is undefined or null
The message text itself should remain the same, only the parameter handling needs to change
The default value "your" is recommended because it reads naturally in the context of the sentence
This solution is minimally invasive, directly addresses the issue at its source, and can be implemented and tested quickly without requiring changes to other parts of the codebase.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Test that the message template handles undefined input correctly:
Test with onboardingCompanySize set to undefined
Test with onboardingCompanySize set to null
Test with onboardingCompanySize set to a valid value
Test the full onboarding flow when selecting "Something else":
Verify the guide message in #admins room never contains "undefined"
Test with various onboarding paths to ensure the message is consistent
Test edge cases:
When onboarding data is partially completed
When a workspace is created with minimal onboarding information
These tests should verify that the guide message always displays correctly regardless of the onboarding data state.
What alternative solutions did you explore? (Optional)
Add validation in prepareOnboardingOnyxData to ensure onboardingCompanySize has a valid value before it's used in the message template. This would catch the issue earlier but requires changes to more complex logic.
Implement error handling to catch and log cases where required onboarding data is missing. This would help identify similar issues in the future but wouldn't directly fix the current problem.
Create a centralized validation system for onboarding data to ensure all required values are present before messages are displayed. This would be a larger refactor that could prevent similar issues in the future but is more complex than needed for this specific issue.
📣 @rmoise! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Activity
melvin-bot commentedon May 19, 2025
Triggered auto assignment to @laurenreidexpensify (
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.nkdengineer commentedon May 19, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-05-19 03:27:05 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
The guide message contains "undefined" in #admins room - Here is a task list I’d recommend for a company of your size with undefined submitters:
What is the root cause of that problem?
When we complete the guide setup by creating a new workspace,
onboardingCompanySizedoesn't existApp/src/CONST.ts
Lines 5426 to 5427 in 051e86d
What changes do you think we should make in order to solve the problem?
we can update this message accordingly if
onboardingCompanySizeis undefinedApp/src/CONST.ts
Lines 5426 to 5427 in 051e86d
Or we can add a default for
companySizeparam here that can confirm with design team.App/src/libs/actions/Policy/Policy.ts
Line 1795 in 051e86d
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Update
CreateWorkspacetest to verify the onboarding message is correctly.What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
linhvovan29546 commentedon May 19, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-05-19 04:21:26 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Onboarding - Guide message contains "undefined" in #admins room
What is the root cause of that problem?
We are creating a workspace using the
createWorkspacefunction in:App/src/libs/actions/App.ts
Lines 461 to 463 in 051e86d
We always pass
CONST.ONBOARDING_CHOICES.MANAGE_TEAMas theengagementChoice. However, in the onboarding flow (from OP), the user selectSomething else(LOOKING_AROUND), which means there's noonboardingCompanySize. Since we're hardcodingMANAGE_TEAM, we override the user’s actual onboarding selection, leading to incorrectengagementChoicewhen creating the workspace.App/src/libs/actions/Policy/Policy.ts
Lines 2082 to 2083 in 051e86d
App/src/CONST.ts
Lines 5425 to 5426 in 051e86d
What changes do you think we should make in order to solve the problem?
Instead of always using
CONST.ONBOARDING_CHOICES.MANAGE_TEAM, we should updatecreateWorkspaceto default tointroSelected?.choiceand fallbacktoCONST.ONBOARDING_CHOICES.MANAGE_TEAM.App/src/libs/actions/Policy/Policy.ts
Lines 2100 to 2105 in 051e86d
Then, remove the hardcoded engagementChoice parameter in:
App/src/libs/actions/App.ts
Line 462 in 051e86d
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We should update
PolicyTestto include cases that forcreateWorkspaceto useintroSelectedWhat alternative solutions did you explore? (Optional)
We can pass
introSelected?.choice directly to createWorkspace here:App/src/libs/actions/App.ts
Lines 461 to 463 in 051e86d
Note: We’ll need to create a new function to export
introSelected, like this:App/src/libs/actions/Policy/Policy.ts
Line 2132 in 051e86d
For the
engagementChoicedefault value, we should confirm what the BE uses as the default.OR
In
buildPolicyData, we can useintroSelected?.choiceinstead ofengagementChoice.[-]Onboarding - Guide message contains "undefined" in #admins room[/-][+][$250] Onboarding - Guide message contains "undefined" in #admins room[/+]melvin-bot commentedon May 19, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021924402673548639965
melvin-bot commentedon May 19, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (
External)rmoise commentedon May 19, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a new user completes the onboarding flow by selecting "Something else" during onboarding and creates a new workspace, the guide message in the #admins room contains the text "undefined" in a task list recommendation. Specifically, it shows: "Here is a task list I'd recommend for a company of your size with undefined submitters:"
What is the root cause of that problem?
The root cause is in the handling of the
onboardingCompanySizeparameter when creating the guide message for the #admins room. When a user selects "Something else" during onboarding, theonboardingCompanySizevalue is not being properly validated or defaulted before being used in the message template.This occurs in the message template definition:
App/src/CONST.ts
Lines 5423 to 5426 in d728dc9
The template uses the renamed parameter
companySizedirectly without checking if it's undefined, which causes the "undefined" text to appear in the message.What changes do you think we should make in order to solve the problem?
We should modify the message template function in CONST.ts to include a default value for the
companySizeparameter when it's undefined or null:App/src/CONST.ts
Lines 5423 to 5426 in d728dc9
Specifically:
companySizeparameter (e.g., 'your')onboardingCompanySizeis undefined or nullThis solution is minimally invasive, directly addresses the issue at its source, and can be implemented and tested quickly without requiring changes to other parts of the codebase.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Test that the message template handles undefined input correctly:
onboardingCompanySizeset to undefinedonboardingCompanySizeset to nullonboardingCompanySizeset to a valid valueTest the full onboarding flow when selecting "Something else":
Test edge cases:
These tests should verify that the guide message always displays correctly regardless of the onboarding data state.
What alternative solutions did you explore? (Optional)
Add validation in
prepareOnboardingOnyxDatato ensureonboardingCompanySizehas a valid value before it's used in the message template. This would catch the issue earlier but requires changes to more complex logic.Implement error handling to catch and log cases where required onboarding data is missing. This would help identify similar issues in the future but wouldn't directly fix the current problem.
Create a centralized validation system for onboarding data to ensure all required values are present before messages are displayed. This would be a larger refactor that could prevent similar issues in the future but is more complex than needed for this specific issue.
melvin-bot commentedon May 19, 2025
📣 @rmoise! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
58 remaining items
abdulrahuman5196 commentedon Jul 14, 2025
@laurenreidexpensify completed the checklist
laurenreidexpensify commentedon Jul 15, 2025
@abdulrahuman5196 is there definitely no regression test needed for this?
melvin-bot commentedon Jul 18, 2025
@laurenreidexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
abdulrahuman5196 commentedon Jul 20, 2025
@laurenreidexpensify I have added the regression steps in the checklist here #62262 (comment). Did i miss something?
laurenreidexpensify commentedon Jul 22, 2025
@abdulrahuman5196 I'm not sure I follow - there aren't any regression steps linked above?
abdulrahuman5196 commentedon Jul 23, 2025
This is the regression test i have suggested @laurenreidexpensify
laurenreidexpensify commentedon Jul 25, 2025
ah @abdulrahuman5196 sorry I didn't expand the text!! Thanks!! All resolved now, closing :)
isabelastisser commentedon Aug 5, 2025
@abdulrahuman5196 has submitted payment for this report on ND [here]
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Vendor found in VML: True. Status: Active
Amount requested: $250.00 (Matches the payment summary here.
I am not already the BZ assignee. I have approved this payment.