Skip to content

Spend - Move to report option is only shown after loading all unreported expenses #102309

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.94-0
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: #98411
Email or phone of affected tester (no customers): jsdoijnodsdisojo@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Search

Action Performed:

Precondition:

  • Create more than 50 unreported expenses.
  1. Go to staging.new.expensify.com
  2. Go to Account > Troubleshoot > Clear cache and restart > Reset and refresh.
  3. Go to Spend > Expenses.
  4. Bulk select all unreported expenses > Select all.
    → Move to report option is missing.
  5. Scroll down to load all expenses.
    → Move to report option is shown.

Expected Result:

In Step 4, Move to report option will be shown after selecting all unreported expenses.

Actual Result:

In Step 4, Move to report option is not shown after selecting all unreported expenses.
In Step 5, Move to report option is only shown after loading all unreported expenses.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7269353_1790344832905.1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7269353

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 25, 2026
  2. applause-bot commented on Sep 25, 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/8ec7bd5785c0967dbc08505abacd1022729a7e5e015375f2eb95a9dc633bf177

  3. melvin-bot commented on Sep 25, 2026

    @melvin-bot

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

  4. github-actions commented on Sep 25, 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 25, 2026

    @melvin-bot

    @mjasikowski @suneox you have been assigned to this deploy blocker because you reviewed the offending PR: #98411

  6. melvin-bot commented on Sep 25, 2026

    @melvin-bot

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

  7. MelvinBot commented on Sep 25, 2026

    @MelvinBot
    Contributor

    Deploy Blocker Analysis

    Verdict: not a regression. I recommend demoting this, not reverting. Support 'Select all matching' when moving expenses to a report hides the option on purpose when some matching expenses haven't loaded yet. Production never offered "Move to report" after "Select all", so staging is still an improvement.

    Workaround: Filter Status to Unreported (status:unreported). The option then appears right after "Select all", with no scrolling.

    Investigation details

    Mechanism (useSearchBulkActions.ts:1940-1945, useSearchBulkActions.ts:2453-2468):

    • The option shows only if isEmptyObject(excludedTransactions) && (!hasUnloadedMatchingExpenses || isUnreportedOnlyQuery).
    • hasUnloadedMatchingExpenses is hasMoreResults. It is true while fewer than all 50+ expenses are loaded.
    • The default Spend > Expenses query has no status:unreported filter, so isUnreportedOnlyQuery is false.
    • After you scroll to the end, hasMoreResults becomes false and the option appears. This matches the report.

    Why it's intended: The backend rejects the whole move if any matching expense can't be moved. The client can't check expenses it hasn't loaded, so it offers the option only when it can guarantee every match is movable.

    Why it's not a regression: Before this PR, the "Select all" path offered only Pay, Export, and Download PDF. Reverting would remove the whole feature from [$250] "Select all matching" does not allow adding all matching expenses to a report and bring back the original bug.

    Possible follow-ups (not blockers):

    1. Show "Move to report" disabled, with a tooltip suggesting the Unreported filter, when unloaded matches exist. This is a small change to the condition above.
    2. Always show it and rely on the backend's check. This needs a clear, recoverable backend error.
    3. Fetch the remaining pages, or ask the backend whether every match is movable, before enabling it.

    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.

  8. suneox commented on Sep 25, 2026

    @suneox
    Contributor

    I'm not sure this is a regression from the PR, since verification after merging main still works as expected. @MelvinBot let's analyze more related issue update condition to show 'Move to Report Action' action from this commit. I'll double check in an hour.

  9. suneox commented on Sep 25, 2026

    @suneox
    Contributor

    I'm not sure this is a regression from the PR, since verification after merging main still works as expected. @MelvinBot let's analyze more related issue update condition to show 'Move to Report Action' action from this commit. I'll double check in an hour.

    @MelvinBot

  10. MelvinBot commented on Sep 25, 2026

    @MelvinBot
    Contributor

    suneox Agreed. This isn't a regression from the merge. The merge in dc3215e didn't change the "Move to report" condition. Your verification and the QA report differ because of one step:

    • The PR's QA steps apply the Unreported status filter (step 2). The query then includes status:unreported, so the option appears right away.
    • QA skipped that filter and used the default Spend > Expenses query, type:expense with no status. With more than 50 expenses, not all of them load at first. The client can't confirm the unloaded ones are movable, so it hides the option until everything loads.

    Recommendation: close this as expected behavior, or demote it, and point QA at the PR's filtered steps. To show Move on the unfiltered view, relax the gate in a follow-up. The risk is that one expense the backend can't move rejects the entire move.

    Condition history and evidence

    The condition: isEmptyObject(excludedTransactions) && (!hasUnloadedMatchingExpenses || isUnreportedOnlyQuery)

    Commit Date (UTC) What happened to the condition
    90880c4 2026-08-12 Added in the PR's first commit (L1660-L1665, L1945-L1951)
    f38ed17, 67bee6d 2026-08-24, 2026-09-22 Unchanged. Only comments changed, plus a switch from a ternary to push
    dc3215e (merge) 2026-09-24 Byte-identical (L1932-L1937, L2450-L2466)
    33be3a0 (PR merged) 2026-09-25 Unchanged (L1940-L1945, L2454-L2470). Same at 9.4.94-0-staging

    Merge conflict resolution in dc3215e:

    • In useSearchBulkActions.ts, main added downloadPDFOption and the PR added moveExpensesOption. The resolution kept both and didn't change the Move condition.
    • In SearchQueryProvider.tsx:29-42, only how queryJSON is restored changed. Status parsing and hasMoreResults are the same.
    • No later commit on main or staging touches this file.

    Why QA sees the option after scrolling:

    • The default Spend > Expenses query comes from buildCannedSearchQuery() (SearchSuggestionUtils.ts:158) and has no status filter. So isUnreportedOnlyQuery is false.
    • hasUnloadedMatchingExpenses is hasMoreResults. It stays true until every page loads, then becomes false, and Move appears.
    • canMoveExpenses isn't the cause. QA saw Move with all rows loaded, and every row is the same user's unreported expense, so the first 50 pass too.

    Why your check passed: your QA steps, which are also in the PR body, include "Filter expenses by Unreported status filter." That makes isUnreportedOnlyQuery true. I couldn't view the video, so I haven't confirmed the filter chip in it.


    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.

  11. suneox commented on Sep 25, 2026

    @suneox
    Contributor

    From the initial implementation we only support unreported expenses on the BE, as required by the original issue, we must apply the unreported status filter in step 3, and test step 2 from the PR also mentions this filter: Filter expenses by Unreported status filter. Therefore I think this is not a regression bug

  12. suneox commented on Sep 25, 2026

    @suneox
    Contributor
    CleanShot.2026-09-26.at.00.03.00.mp4

    This issue has the same root cause as the raised issue. without the unreported filter, we cannot determine which expenses violate the rule. If we decide to enhance this behavior without the unreported filter I think it should be tracked in a separate issue

    cc: @mjasikowski

  13. mjasikowski commented on Sep 28, 2026

    @mjasikowski
    Contributor

    Working as expected, 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.EngineeringHourlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions