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-08-19] [$250] Expense - Receipt thumbnail shows a green receipt placeholder while it is uploading #47050

Closed
6 tasks done
IuliiaHerets opened this issue Aug 8, 2024 · 26 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Aug 8, 2024

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: v9.0.18-1
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4834235
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to FAB > Submit expense > Manual.
  3. Submit a manual expense with receipt to any user.
  4. After submitting the expense, check the receipt thumbnail while it is uploading.

Expected Result:

The receipt thumbnail will show the receipt while it is uploading (production behavior).

Actual Result:

The receipt thumbnail shows a green receipt placeholder while it is uploading.

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

Bug6565240_1723090380276.20240808_120954.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cb9e52d752d2515a
  • Upwork Job ID: 1821642583324627537
  • Last Price Increase: 2024-08-08
Issue OwnerCurrent Issue Owner: @adelekennedy
@IuliiaHerets IuliiaHerets 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 Aug 8, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

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

Copy link

melvin-bot bot commented Aug 8, 2024

Triggered auto assignment to @adelekennedy (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 Aug 8, 2024
Copy link
Contributor

github-actions bot commented Aug 8, 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.

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@madmax330
Copy link
Contributor

Asked in slack here: https://expensify.slack.com/archives/C07CACYRTJS/p1723111960156189

@bernhardoj
Copy link
Contributor

Proposal

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

Reciept image is shown as green receipt placeholder.

What is the root cause of that problem?

In this issue, the receipt image is shown as EReceiptThumbnail because isThumbnail is true.

if (isEReceipt || isThumbnail) {
const props = isThumbnail && {borderRadius: style?.borderRadius, fileExtension, isReceiptThumbnail: true};
return (
<View style={style ?? [styles.w100, styles.h100]}>
<EReceiptThumbnail
transactionID={transactionID ?? '-1'}
iconSize={iconSize}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
/>
</View>
);
}

In ReceiptUtils, we have a logic to return the correct data if it's a receipt image, but in our case, isReceiptImage is false.

if ((isReceiptImage || isReceiptPDF) && typeof path === 'string' && (path.startsWith('blob:') || path.startsWith('file:'))) {
return {image: path, isLocalFile: true, filename};
}
if (isReceiptImage) {
return {thumbnail: `${path}.1024.jpg`, image: path, filename};
}
if (isReceiptPDF && typeof path === 'string') {
return {thumbnail: `${path.substring(0, path.length - 4)}.jpg.1024.jpg`, image: path, filename};
}
const isLocalFile = FileUtils.isLocalFile(path);
const {fileExtension} = FileUtils.splitExtensionFromFileName(filename);
return {isThumbnail: true, fileExtension: Object.values(CONST.IOU.FILE_TYPES).find((type) => type === fileExtension), image: path, isLocalFile, filename};

isReceiptImage checks the extension of the image filename.

const isReceiptImage = Str.isImage(filename);

However, the image filename contains the image source (blob://...). This happens after this commit. In that commit, we move the creating of the optimistic receipt and filename to buildOptimisticTransaction, but we got the logic for the filename wrong.

Previously, if the receipt has the source, then the filename will be set to the receipt name.
image

Now, it will use the source and fallback to receipt name (and then fallback to filename param).

filename: receipt?.source ?? receipt?.name ?? filename,

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

We should change the logic of the optimsitic filename just like before to:

filename: receipt?.source ? receipt?.name : filename,

maybe we can check for the receipt name instead, (receipt?.name ?? filename)

@adelekennedy
Copy link

@madmax330 should we open this external? I saw Ioni respond that he didn't think the instant submit change was related

@marcaaron
Copy link
Contributor

cc @neil-marcellini this looks related to #42302

@neil-marcellini neil-marcellini added the External Added to denote the issue can be worked on by a contributor label Aug 8, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01cb9e52d752d2515a

@melvin-bot melvin-bot bot changed the title Expense - Receipt thumbnail shows a green receipt placeholder while it is uploading [$250] Expense - Receipt thumbnail shows a green receipt placeholder while it is uploading Aug 8, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 8, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 8, 2024
@neil-marcellini
Copy link
Contributor

Ah woops yes I made a mistake in that logic. Sorry! @bernhardoj's proposal looks good. Are you around to fix this ASAP? If not I will implement your solution.

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Aug 8, 2024

If anything, I am available for review a PR !

@neil-marcellini
Copy link
Contributor

Ok, no reply yet so I'm going to put up a PR.

@bernhardoj
Copy link
Contributor

Sorry, I just got online.

@bernhardoj
Copy link
Contributor

@neil-marcellini @adelekennedy hi, do you think I'm eligible for payment 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 Aug 12, 2024
@melvin-bot melvin-bot bot changed the title [$250] Expense - Receipt thumbnail shows a green receipt placeholder while it is uploading [HOLD for payment 2024-08-19] [$250] Expense - Receipt thumbnail shows a green receipt placeholder while it is uploading Aug 12, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 12, 2024
Copy link

melvin-bot bot commented Aug 12, 2024

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

Copy link

melvin-bot bot commented Aug 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.18-10 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-08-19. 🎊

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

  • @bernhardoj requires payment through NewDot Manual Requests

Copy link

melvin-bot bot commented Aug 12, 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:

  • [@madmax330 / @neil-marcellini] The PR that introduced the bug has been identified. Link to the PR:
  • [@madmax330 / @neil-marcellini] 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:
  • [@madmax330 / @neil-marcellini] 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:
  • [@bernhardoj] Determine if we should create a regression test for this bug.
  • [@bernhardoj] 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.
  • [@adelekennedy] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@adelekennedy adelekennedy reopened this Aug 13, 2024
@adelekennedy
Copy link

Hey @bernhardoj I think in this case you're owed 50% of the usual price as we used your solution but @neil-marcellini implemented it. Does that sound fair?

@Beamanator Beamanator removed DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Aug 13, 2024
@Beamanator
Copy link
Contributor

Removing blocker labels since this is def not a new blocker 😬

@adelekennedy
Copy link

🤦‍♀️ I completely missed those labels @Beamanator, thank you

@Beamanator
Copy link
Contributor

No prob! :D

@bernhardoj
Copy link
Contributor

@adelekennedy yes, that make sense for me

@adelekennedy
Copy link

adelekennedy commented Aug 14, 2024

great! Thank you so much for bringing this up

Payouts due:

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$125 approved for @bernhardoj

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. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants