Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [$250] Subscription size value not trim able to add spaces before the value #43069

Closed
5 of 6 tasks
m-natarajan opened this issue Jun 4, 2024 · 34 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.

Comments

@m-natarajan
Copy link

m-natarajan commented Jun 4, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Issue found when validating the PR #42683
Version Number: 1.4.79-2
Reproducible in staging?: y
Reproducible in production?: New feature
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

  1. Go to /settings/subscription/subscription-size
  2. Enter spaces and then a values click next
  3. Notice spaces showing on next page

Expected Result:

Spaces should not displayed with value

Actual Result:

Subscription size value not trim able to add spaces before the value

Workaround:

unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6501964_1717527964130.2024-06-04_23-59-06.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0110dce96b3114bcdc
  • Upwork Job ID: 1798096545497235456
  • Last Price Increase: 2024-06-04
  • Automatic offers:
    • bernhardoj | Contributor | 102646806
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @Christinadobrzyn
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

Triggered auto assignment to @Christinadobrzyn (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.

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Jun 4, 2024
Copy link
Contributor

github-actions bot commented Jun 4, 2024

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@m-natarajan
Copy link
Author

@Christinadobrzyn FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

Copy link

melvin-bot bot commented Jun 4, 2024

Triggered auto assignment to @tylerkaraszewski (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@tylerkaraszewski tylerkaraszewski added the External Added to denote the issue can be worked on by a contributor label Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0110dce96b3114bcdc

@melvin-bot melvin-bot bot changed the title Subscription size value not trim able to add spaces before the value [$250] Subscription size value not trim able to add spaces before the value Jun 4, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

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

@neonbhai
Copy link
Contributor

neonbhai commented Jun 4, 2024

Proposal

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

Subscription size value not trim able to add spaces before the value

What is the root cause of that problem?

We display the original data when showing the entered subscription size here:

title={translate('subscription.subscriptionSize.activeMembers', {size: subscriptionSizeFormDraft ? subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE] : 0})}

We should trim the data before we display it.

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

Change this line

title={translate('subscription.subscriptionSize.activeMembers', {size: subscriptionSizeFormDraft ? subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE] : 0})}

to

title={translate('subscription.subscriptionSize.activeMembers', {size: subscriptionSizeFormDraft ? subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE].trim() : 0})}

Alternatively

We may save the size value in a variable to make code simpler.

@amyevans
Copy link
Contributor

amyevans commented Jun 4, 2024

This doesn't need to block deploy since it's a new feature and cannot be accessed yet except via direct link. @tylerkaraszewski I'm happy to take it over if you want, just lmk!

@amyevans amyevans added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 DeployBlocker Indicates it should block deploying the API labels Jun 4, 2024
@Krishna2323
Copy link
Contributor

Krishna2323 commented Jun 4, 2024

Proposal

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

Subscription size value not trim able to add spaces before the value

What is the root cause of that problem?

We are not trimming the value before moving to next step.

<FormProvider
formID={ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM}
submitButtonText={translate('common.next')}
onSubmit={onNext}
validate={validate}
style={[styles.mh5, styles.flexGrow1]}
>

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

We can introduce a new prop (shouldTrimEmptySpaces) inside FormProvider and when passed, we will trim the values before validating, submitting and saving the value to draft , we already have a prop shouldTrimValues inside FormProvider but that only removes invisible characters from a string.

We will trim the value if shouldTrimEmptySpaces is true. We need to trim in all places below.

const trimmedStringValues = shouldTrimValues ? ValidationUtils.prepareValues(values) : values;

const trimmedStringValues = shouldTrimValues ? ValidationUtils.prepareValues(inputValues) : inputValues;

const trimmedStringValues = shouldTrimValues ? ValidationUtils.prepareValues(inputValues) : inputValues;

And also update the code below:

if (inputProps.shouldSaveDraft && !formID.includes('Draft')) {
FormActions.setDraftValues(formID as OnyxFormKey, {[inputKey]: value});
}

To:

if (inputProps.shouldSaveDraft && !formID.includes('Draft')) {
    let trimmedValue = value;
    if (typeof value === 'string' && shouldTrimEmptySpaces) {
        trimmedValue = value.trim();
    }
    FormActions.setDraftValues(formID as OnyxFormKey, {[inputKey]: trimmedValue});
}

What alternative solutions did you explore? (Optional)

We can trim spaces by default and use the same prop shouldTrimValues for disabling trimming.

If we need, we can only trim the draft value instead of all values.

@Krishna2323
Copy link
Contributor

Proposal Updated

  • Updated main solution and added an alternative

@cretadn22
Copy link
Contributor

Proposal

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

Subscription size value not trim

What is the root cause of that problem?

We lack the logic to trim the subscription size value

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

In the FormProvider, we've incorporated a property called shouldTrimValues. If shouldTrimValues is set to true, we'll invoke this function.

function prepareValues(values: ValuesType): ValuesType {

However, currently, this function does not include logic to trim values. I propose that we integrate logic to trim values within this function, if the input value is a string.

code change:

if (typeof inputValue === 'string') {
            trimmedStringValues[inputID] = StringUtils.removeInvisibleCharacters(inputValue).trim();
}

Additionally, before saving the draft, we should also trim the value. We need to verify whether the value is a string; if it is, we should apply a trim function.

FormActions.setDraftValues(formID as OnyxFormKey, {[inputKey]: value});

code change:

FormActions.setDraftValues(formID as OnyxFormKey, {[inputKey]: typeof value === 'string' ? value.trim() : value});

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.

@Christinadobrzyn Christinadobrzyn added the NewFeature Something to build that is a new item. label Jun 5, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @thesahindia

@Christinadobrzyn
Copy link
Contributor

Just a heads up - I'm going to be ooo until June 24th. I'm not going to assign anyone new but if you need a new BZ teammate for any reason please feel free to ask for one to be assigned here.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 17, 2024
@melvin-bot melvin-bot bot changed the title [$250] Subscription size value not trim able to add spaces before the value [HOLD for payment 2024-06-24] [$250] Subscription size value not trim able to add spaces before the value Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.84-3 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 2024-06-24. 🎊

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

Copy link

melvin-bot bot commented Jun 17, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@thesahindia] The PR that introduced the bug has been identified. Link to the PR:
  • [@thesahindia] 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:
  • [@thesahindia] A discussion in #expensify-bugs 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:
  • [@thesahindia] Determine if we should create a regression test for this bug.
  • [@thesahindia] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 21, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-24] [$250] Subscription size value not trim able to add spaces before the value [HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [$250] Subscription size value not trim able to add spaces before the value Jun 21, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.85-7 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 2024-06-28. 🎊

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

Copy link

melvin-bot bot commented Jun 21, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@thesahindia] The PR that introduced the bug has been identified. Link to the PR:
  • [@thesahindia] 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:
  • [@thesahindia] A discussion in #expensify-bugs 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:
  • [@thesahindia] Determine if we should create a regression test for this bug.
  • [@thesahindia] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 24, 2024
@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Jun 25, 2024

Payouts due:

Upwork job is here.

@thesahindia let us know about a regression test!

@Christinadobrzyn
Copy link
Contributor

still have a few days till payment!

@thesahindia
Copy link
Member

This bug was present since the implementation of this page. It was a minor issue that got missed in #42683. I don't think we need a test case for this.

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Jun 27, 2024

Sounds good - no regression test for this. Thanks @thesahindia!

@Christinadobrzyn
Copy link
Contributor

Awesome! Payment summary is here - #43069 (comment)

This is good to close. Feel free to reach out if I missed anything.

@JmillsExpensify
Copy link

$250 approved for @thesahindia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.
Projects
No open projects
Archived in project
Development

No branches or pull requests