Skip to content

[HOLD for payment 2025-02-05] [$250] Task - Task assignee is not assigned when creating task via [] @email <task name> #55564

Description

@lanitochka17

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.0.88-4
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open chat
  3. Type [] @email@email.com
    task title and send it

Expected Result:

Task will be assigned to the tagged user

Actual Result:

Task is not assigned to the tagged user

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6699060_1734622590003.20241219_233101.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021882302358350245599
  • Upwork Job ID: 1882302358350245599
  • Last Price Increase: 2025-01-23
Issue OwnerCurrent Issue Owner: @kadiealexander

Activity

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

    @melvin-bot

    Triggered auto assignment to @kadiealexander (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. Tony-MK commented on Jan 21, 2025

    @Tony-MK
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Task - Task assignee is not assigned when creating task via [] @email

    What is the root cause of that problem?

    The CONST.REGEX.TASK_TITLE_WITH_OPTONAL_SHORT_MENTION regex does not properly match the groups in the text.

    const match = text.match(CONST.REGEX.TASK_TITLE_WITH_OPTONAL_SHORT_MENTION);

    What changes do you think we should make in order to solve the problem?

    Firstly, update the CONST.REGEX.TASK_TITLE_WITH_OPTONAL_SHORT_MENTION regex to the one below.

    TASK_TITLE_WITH_OPTONAL_SHORT_MENTION:
                /^(\[\])\s+(@(?:(?=[\w'#%+-]+(?:\.[\w'#%+-]+)*@?)[\w.'#%+-]{1,64}(?:@(?:(?=[a-z\d]+(?:-+[a-z\d]+)*\.)(?:[a-z\d-]{1,63}\.)+[a-z]{2,63}))?))\s*([\s\S]*)/,
    

    Secondly, retrieve the mentioned text from the third, not the fourth group, and handle the extra @ character.

    const mention = match[1] ? match[1].trim() : '';

    const mention = match[2] ? match[2].trim().slice(1) : '';
    
    

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

    Test CONST.REGEX.TASK_TITLE_WITH_OPTONAL_SHORT_MENTION with some examples of comments that expect a task to be created.

    Image

  4. bernhardoj commented on Jan 22, 2025

    @bernhardoj
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The task regex doesn't work.

    What is the root cause of that problem?

    This starts happening after this PR. In that PR, we want to add the task title length validation, so the PR moves the regex to CONST to make it reusable.

    App/src/CONST.ts

    Line 3127 in 0190b0a

    TASK_TITLE_WITH_OPTONAL_SHORT_MENTION: `^\\[\\]\\s+(?:@(?:${EMAIL_WITH_OPTIONAL_DOMAIN}))?\\s*([\\s\\S]*)`,

    The regex concatenates with the EMAIL_WITH_OPTIONAL_DOMAIN. However, the way it's being concatenated is wrong. If we see the code where the concatenation is first added, we take the regex source and concatenate it into the string instead of the whole regex object.

    Image Image

    Notice from the image above, on the left (which is the current regex) has the /.

    What changes do you think we should make in order to solve the problem?

    Update the regex so it only concatenates with the EMAIL_WITH_OPTIONAL_DOMAIN source.

    App/src/CONST.ts

    Line 3127 in 0190b0a

    TASK_TITLE_WITH_OPTONAL_SHORT_MENTION: `^\\[\\]\\s+(?:@(?:${EMAIL_WITH_OPTIONAL_DOMAIN}))?\\s*([\\s\\S]*)`,

    EMAIL_WITH_OPTIONAL_DOMAIN.source
    

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

    To be able to test it easily, I think we should move this logic to a util and test that util which returns the task title and/or assignee. Since there are a lot of cases, we will just handle the case of task regex with mention and title.

    const match = text.match(CONST.REGEX.TASK_TITLE_WITH_OPTONAL_SHORT_MENTION);
    if (!match) {
    return false;
    }
    let title = match[3] ? match[3].trim().replace(/\n/g, ' ') : undefined;
    if (!title) {
    return false;
    }
    const mention = match[1] ? match[1].trim() : '';
    const mentionWithDomain = ReportUtils.addDomainToShortMention(mention) ?? mention;
    const isValidMention = Str.isValidEmail(mentionWithDomain);
    let assignee: OnyxEntry<OnyxTypes.PersonalDetails>;
    let assigneeChatReport;
    if (mentionWithDomain) {
    if (isValidMention) {
    assignee = Object.values(allPersonalDetails ?? {}).find((value) => value?.login === mentionWithDomain) ?? undefined;
    if (!Object.keys(assignee ?? {}).length) {
    const assigneeAccountID = UserUtils.generateAccountID(mentionWithDomain);
    const optimisticDataForNewAssignee = Task.setNewOptimisticAssignee(mentionWithDomain, assigneeAccountID);
    assignee = optimisticDataForNewAssignee.assignee;
    assigneeChatReport = optimisticDataForNewAssignee.assigneeReport;
    }
    } else {
    // If the mention is not valid, include it on the title.
    // The mention could be invalid if it's a short mention and failed to be converted to a full mention.
    title = `@${mentionWithDomain} ${title}`;
    }
    }

  5. moved this to Bugs and Follow Up Issues in #expensify-bugson Jan 23, 2025
  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 23, 2025
  7. changed the title [-]Task - Task assignee is not assigned when creating task via [] @email <task name>[/-] [+][$250] Task - Task assignee is not assigned when creating task via [] @email <task name>[/+] on Jan 23, 2025
  8. melvin-bot commented on Jan 23, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 23, 2025
  10. melvin-bot commented on Jan 23, 2025

    @melvin-bot

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

  11. eh2077 commented on Jan 23, 2025

    @eh2077
    Contributor

    I think we should go with @bernhardoj 's proposal. I agree with their diagnosis of the issue and the test plan also looks good to me.

    🎀👀🎀 C+ reviewed

  12. 13 remaining items

  13. changed the title [-][$250] Task - Task assignee is not assigned when creating task via [] @email <task name>[/-] [+][HOLD for payment 2025-02-05] [$250] Task - Task assignee is not assigned when creating task via [] @email <task name>[/+] on Jan 29, 2025
  14. melvin-bot commented on Jan 29, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Jan 29, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.90-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-02-05. 🎊

    For reference, here are some details about the assignees on this issue:

    • @bernhardoj requires payment through NewDot Manual Requests
    • @eh2077 requires payment through NewDot Manual Requests
  16. melvin-bot commented on Jan 29, 2025

    @melvin-bot

    @eh2077 @kadiealexander @eh2077 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  17. eh2077 commented on Feb 4, 2025

    @eh2077
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/52941/files#r1941178581

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/467738

    Regression Test Proposal

    Precondition:

    NA

    Test:

    1. Open any chat
    2. Create a regex with assignee from composer (e.g., [] @example@gmail.com title)
    3. Verify the task is created with the correct assignee

    Do we agree 👍 or 👎

  18. moved this from Bugs and Follow Up Issues to Hold for Payment in #expensify-bugson Feb 4, 2025
  19. melvin-bot commented on Feb 5, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@kadiealexander)

    • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1882302358350245599/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  20. moved this from Hold for Payment to Done in #expensify-bugson Feb 5, 2025
  21. bernhardoj commented on Feb 6, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  22. JmillsExpensify commented on Feb 10, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

  23. JmillsExpensify commented on Feb 13, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @eh2077

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