Skip to content

[Due for payment 2025-07-04] [$250] Onboarding - Guide message contains "undefined" in #admins room #62262

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


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:

  1. Go to staging.new.expensify.com
  2. Log in with a new Gmail account.
  3. Select Something else during onboarding and complete the flow.
  4. Create a new workspace.
  5. 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:

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021924402673548639965
  • Upwork Job ID: 1924402673548639965
  • Last Price Increase: 2025-06-02
  • Automatic offers:
    • nkdengineer | Contributor | 107658277
Issue OwnerCurrent Issue Owner: @laurenreidexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 19, 2025
  2. melvin-bot commented on May 19, 2025

    @melvin-bot

    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.

  3. nkdengineer commented on May 19, 2025

    @nkdengineer
    Contributor

    🚨 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, onboardingCompanySize doesn't exist

    App/src/CONST.ts

    Lines 5426 to 5427 in 051e86d

    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` : ''}`,
    

    App/src/CONST.ts

    Lines 5426 to 5427 in 051e86d

    message: ({onboardingCompanySize: companySize}) => `Here is a task list I’d recommend for a company of your size with ${companySize} submitters:`,
    tasks: [

    Or we can add a default for companySize param here that can confirm with design team.

    companySize?: OnboardingCompanySize,

    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.

  4. linhvovan29546 commented on May 19, 2025

    @linhvovan29546
    Contributor

    🚨 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 createWorkspace function in:

    App/src/libs/actions/App.ts

    Lines 461 to 463 in 051e86d

    function savePolicyDraftByNewWorkspace(policyID?: string, policyName?: string, policyOwnerEmail = '', makeMeAdmin = false, currency = '', file?: File) {
    createWorkspace(policyOwnerEmail, makeMeAdmin, policyName, policyID, CONST.ONBOARDING_CHOICES.MANAGE_TEAM, currency, file);
    }

    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.
    if (introSelected !== undefined && !introSelected?.createWorkspace && engagementChoice && shouldAddOnboardingTasks) {
    const onboardingData = ReportUtils.prepareOnboardingOnyxData(introSelected, engagementChoice, CONST.ONBOARDING_MESSAGES[engagementChoice], adminsChatReportID, policyID);

    App/src/CONST.ts

    Lines 5425 to 5426 in 051e86d

    [onboardingChoices.MANAGE_TEAM]: {
    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.

    function createWorkspace(
    policyOwnerEmail = '',
    makeMeAdmin = false,
    policyName = '',
    policyID = generatePolicyID(),
    engagementChoice: OnboardingPurpose = CONST.ONBOARDING_CHOICES.MANAGE_TEAM,

    function createWorkspace(
        policyOwnerEmail = '',
        makeMeAdmin = false,
        policyName = '',
        policyID = generatePolicyID(),
        engagementChoice: OnboardingPurpose = introSelected?.choice ?? CONST.ONBOARDING_CHOICES.MANAGE_TEAM,
        currency = '',
        file?: File,
        shouldAddOnboardingTasks = true,
        companySize?: OnboardingCompanySize,
    )

    Then, remove the hardcoded engagementChoice parameter in:

    createWorkspace(policyOwnerEmail, makeMeAdmin, policyName, policyID, CONST.ONBOARDING_CHOICES.MANAGE_TEAM, currency, file);

        createWorkspace(policyOwnerEmail, makeMeAdmin, policyName, policyID, undefined, currency, file);

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We should update PolicyTest to include cases that for createWorkspace to use introSelected

    What 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

    function savePolicyDraftByNewWorkspace(policyID?: string, policyName?: string, policyOwnerEmail = '', makeMeAdmin = false, currency = '', file?: File) {
    createWorkspace(policyOwnerEmail, makeMeAdmin, policyName, policyID, CONST.ONBOARDING_CHOICES.MANAGE_TEAM, currency, file);
    }

    function savePolicyDraftByNewWorkspace(
        policyID?: string,
        policyName?: string,
        policyOwnerEmail = '',
        makeMeAdmin = false,
        currency = '',
        file?: File,
    ) {
        const introSelected = getIntroSelected();
        createWorkspace(policyOwnerEmail, makeMeAdmin, policyName, policyID, introSelected?.choice, currency, file);
    }

    Note: We’ll need to create a new function to export introSelected, like this:

    export const getIntroSelected = () => introSelected;

    For the engagementChoice default value, we should confirm what the BE uses as the default.

    OR
    In buildPolicyData, we can use introSelected?.choice instead of engagementChoice.

  5. changed the title [-]Onboarding - Guide message contains "undefined" in #admins room[/-] [+][$250] Onboarding - Guide message contains "undefined" in #admins room[/+] on May 19, 2025
  6. melvin-bot commented on May 19, 2025

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 19, 2025
  8. melvin-bot commented on May 19, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

  9. rmoise commented on May 19, 2025

    @rmoise

    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 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.

    This occurs in the message template definition:

    App/src/CONST.ts

    Lines 5423 to 5426 in d728dc9

    [onboardingChoices.MANAGE_TEAM]: {
    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:

    App/src/CONST.ts

    Lines 5423 to 5426 in d728dc9

    [onboardingChoices.MANAGE_TEAM]: {
    message: ({onboardingCompanySize: companySize}) => `Here is a task list I’d recommend for a company of your size with ${companySize} submitters:`,
    tasks: [
    createWorkspaceTask,

    Specifically:

    1. In the arrow function parameters, we should add a default value for the renamed companySize parameter (e.g., 'your')
    2. This default value will be used whenever the original onboardingCompanySize is undefined or null
    3. The message text itself should remain the same, only the parameter handling needs to change
    4. 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?

    1. 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
    2. 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
    3. 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)

    1. 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.

    2. 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.

    3. 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.

  10. melvin-bot commented on May 19, 2025

    @melvin-bot

    📣 @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:

    1. Make sure you've read and understood the contributing guidelines.
    2. 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.
    3. 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.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  11. 58 remaining items

  12. abdulrahuman5196 commented on Jul 14, 2025

    @abdulrahuman5196
    Contributor

    @laurenreidexpensify completed the checklist

  13. laurenreidexpensify commented on Jul 15, 2025

    @laurenreidexpensify
    Contributor

    @abdulrahuman5196 is there definitely no regression test needed for this?

  14. melvin-bot commented on Jul 18, 2025

    @melvin-bot

    @laurenreidexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  15. abdulrahuman5196 commented on Jul 20, 2025

    @abdulrahuman5196
    Contributor

    @abdulrahuman5196 is there definitely no regression test needed for this?

    @laurenreidexpensify I have added the regression steps in the checklist here #62262 (comment). Did i miss something?

  16. laurenreidexpensify commented on Jul 22, 2025

    @laurenreidexpensify
    Contributor

    @abdulrahuman5196 I'm not sure I follow - there aren't any regression steps linked above?

  17. abdulrahuman5196 commented on Jul 23, 2025

    @abdulrahuman5196
    Contributor

    This is the regression test i have suggested @laurenreidexpensify

    Image
  18. laurenreidexpensify commented on Jul 25, 2025

    @laurenreidexpensify
    Contributor

    ah @abdulrahuman5196 sorry I didn't expand the text!! Thanks!! All resolved now, closing :)

  19. isabelastisser commented on Aug 5, 2025

    @isabelastisser
    Contributor

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions