Skip to content

Spend - Report amount is not converted after changing default currency when merging reports #100599

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.73-3
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #95658
Email or phone of affected tester (no customers): applausetester+sddd1jsods32@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Log in with Expensifail account.
  1. Go to staging.new.expensify.com
  2. Create a workspace.
  3. Go to workspace chat and create an expense.
  4. Go to workspace settings > Overview > Default currency.
  5. Change the default currency to USD.
  6. Go to workspace chat and create a new report with an expense.
  7. Go to Spend > Reports.
  8. Bulk select both reports.
  9. Click dropdown button > Merge reports.

Expected Result:

The report amount from Step 3 (before currency change) will be converted to the correct amount.

Actual Result:

The report amount from Step 3 (before currency change) is not converted to the correct amount.
It shows the new currency with old amount.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7254278_1788873960406.14.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7254278

Issue OwnerCurrent Issue Owner: @situchan

Activity

  1. applause-bot commented on Sep 8, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/08ea42dea99d92eb4f47cb4a5ecab0017a4439f6511f519431dc138a0e9b202f

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 8, 2026
  3. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #95658

  4. github-actions commented on Sep 8, 2026

    @github-actions
    Contributor

    👋 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.
  5. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    @Gonals @situchan you have been assigned to this deploy blocker because you reviewed the offending PR: #95658

  6. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    @dmkt9 you have been assigned to this deploy blocker because you authored the offending PR: #95658

  7. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  8. MelvinBot commented on Sep 8, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug (new display surface) — but the incorrect number originates in backend report data, not in App conversion logic. See "Root Cause" for the honest split.
    Causing PR: #95658 - "feat: implement Merge Reports RHP and action menu" by @dmkt9 (Medium confidence)
    Related Issues: #98985, #98444 (same Onyx-vs-snapshot resolution class in other Search bulk actions), fixed by #99047 / #98760

    Recommendation: DEMOTE

    The affected flow is fully gated behind the reportMerge beta as of #100523 (CP'd to staging on 2026-09-07, before this was filed), so no production user can reach it, and the feature does not exist in production at all. Nothing in #95658 computes or converts amounts — the merge RHP renders the same pre-existing report-amount helper the Reports list already uses — so a revert would remove a beta feature without fixing whatever produced "new currency + old amount".

    Assigned: @dmkt9 (PR author), @Gonals and @situchan (approving reviewers) from #95658 — already assigned by Melvin, left unchanged.
    Labels: No changes. DeployBlockerCash is kept (an App PR introduced the surface, and the issue is not reproducible in production, so removal is not warranted). DeployBlocker was never applied, so there is nothing to remove.

    ⚠️ One check flips this recommendation

    Before merging on this, someone with the staging repro should answer a single question:

    On Spend > Reports (the list itself, and the report page header), does that same pre-currency-change report already show the new currency with the old amount — before opening the Merge reports RHP?

    • Yes, it's wrong there too → this is not a feat: implement Merge Reports RHP and action menu #95658 regression at all. It is either pre-existing workspace-default-currency semantics or a backend report-total recomputation issue, and no App change should be made. Close as not-a-blocker and file it against the backend.
    • No, the list shows the correctly converted amount and only the RHP is wrong → it is the Onyx-vs-snapshot divergence described below, and the fix is the ~3-line targeted change in SearchReportsMergeReports.tsx (ROLL FORWARD, do not revert).
    📋 Detailed Analysis

    Evidence

    Verification

    Files that produce the amount shown in the RHP row, and who owns them:

    File Role Introduced by #95658?
    src/pages/Search/SearchReportsMergeReports.tsx#L111-L132 Builds the row items; resolves each report Onyx-first ✅ yes
    src/hooks/useHydrateReportsFromSnapshot.ts#L52-L54 Copies snapshot reports into Onyx, but skips any key already present ✅ yes
    getExpenseReportRowDisplayValues.ts#L27 convertToDisplayString(totalDisplaySpend, currency) ❌ pre-existing
    ReportUtils.ts#L4805-L4844 getMoneyRequestSpendBreakdown — sums stored report totals, no conversion ❌ pre-existing
    ReportUtils.ts#L4779-L4784 getReimbursableTotal — prefers report.reimbursableTotal, falls back to total - nonReimbursableTotal ❌ pre-existing

    The one genuine App-side defect #95658 did introduce is a data-source divergence, not bad math:

    For completeness, the post-merge total path is safe and pre-existing: when a moved transaction's currency doesn't match the destination report, Transaction.ts#L1457-L1494 calls markReportTotalAsStale and defers to the server rather than summing across currencies. So the merge action itself does not fabricate a bad total.

    Root Cause

    Two candidates, and I want to be explicit that I could not separate them without a live repro:

    (a) Pre-existing workspace-currency semantics / backend report totals — the more likely one. The displayed value is just report.currency + report.total (via reimbursableTotal + nonReimbursableTotal), rendered as-is. App has no code that converts a report total when the policy outputCurrency changes, so a record holding the new currency with the pre-change amount must have come from server data. Note also that getReimbursableTotal prefers report.reimbursableTotal over the stored total column: if a currency-change recomputes total but leaves the older reimbursableTotal untouched, the App will faithfully display the stale field next to the fresh currency — which is exactly the reported symptom. Whether that is a backend bug or intended behavior (existing transactions keep their original currency and amount; only the report's currency label follows the policy) is a backend question. If this is the cause, the fix is not in Expensify/App and no App code change should be proposed. I have no access to the backend repos, so I could not confirm it.

    (b) Merge-reports display divergence — real, but unconfirmed as the cause of this symptom. Because the RHP reads Onyx-first while the list the user just looked at reads the snapshot, the RHP can show a stale or mixed report record that disagrees with the Reports list. This is a legitimate defect in #95658 regardless of this ticket, and worth fixing on its own merits.

    Targeted fix for (b), if the check above shows the list is right and only the RHP is wrong — replace the Onyx-only lookup at SearchReportsMergeReports.tsx#L113 with the existing snapshot-first helper:

    const report = getReportFromSearchSnapshot(reportID, currentSearchResults?.data, allReports);

    That is a ~3-line change with an established precedent (#99047), which is why ROLL FORWARD would beat REVERT if it comes to that. It also makes useHydrateReportsFromSnapshot redundant for this page's display path.

    💡 Suggested AI code review rule

    This bug class has now come up three times in the Search bulk-action area (#98444 → #98760, #98985 → #99047, and now this page), so it looks like a recurring, mechanically detectable pattern worth a coding-standards rule. Proposed for Expensify/App:

    The full rule file, with the ❌/✅ code inline in App's coding-standards format, would go in Expensify/App itself (.claude/skills/coding-standards/rules/consistency-18-*.md plus a SKILL.md index bullet). If it's worth adding, a maintainer can open it there as a draft PR.

  9. 9 remaining items

  10. added
    Skip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.
    on Sep 18, 2026
  11. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. @Gonals, @situchan, @dmkt9 eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  12. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  13. melvin-bot commented on Oct 13, 2026

    @melvin-bot

    @situchan / @dmkt9

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

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  14. Gonals commented on Oct 15, 2026

    @Gonals
    Contributor

    Should be done. Closing

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringSkip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions