Skip to content

fix: hide ineligible move report destinations - #102579

Open
Beamanator wants to merge 8 commits into
mainfrom
codex/418073-filter-ineligible-move-reports
Open

Beamanator wants to merge 8 commits into
mainfrom
codex/418073-filter-ineligible-move-reports

Conversation

@Beamanator

@Beamanator Beamanator commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

The move expense picker excludes an existing expense report when its workspace uses instant submit with Submit & Close and a complete locally loaded set of its transactions is non-reimbursable. The check runs before the policy admin/report manager fallback that can otherwise offer a destination rejected by Auth. Reopened or retracted Open drafts remain available. The filter uses transaction reimbursement flags, since aggregate report totals can be stale or cancel out, and recalculates as destination transactions load. It does not change automatic report reuse or backend validation.

When the complete destination transaction set is not yet in local Onyx, the picker keeps the report available. The client cannot establish that every transaction is non-reimbursable from a partial cache.

The picker uses a selector over the derived report-transaction map because its entries have no individual Onyx keys. The selector checks only the paginated outstanding destinations and returns a small ID map; unrelated transaction updates may rerun this bounded check but do not rerender the picker when its eligible destinations are unchanged.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/418073
PROPOSAL: https://github.com/Expensify/Expensify/issues/418073#issuecomment-5895188493

Tests

  1. In the local NewDot app, sign in to a QA account and create a workspace with manual expense submission. Create three Open Draft reports owned by that submitter: Non-reimbursable destination with only a non-reimbursable expense, Mixed destination with at least one reimbursable expense, and Source report with a reimbursable expense to move. Switch the workspace to instant submission and Submit & Close. Confirm the first report is still Open Draft with its transaction loaded; a newly created report may auto-close and cannot test this regression.
  2. Open and fully load each destination report, then open the Source report expense's More > Move to report picker. Verify Non-reimbursable destination is absent and Mixed destination remains selectable. Search for each exact report name and verify the same results. Capture the destination report, picker, and browser console.
  3. Move the source expense to Mixed destination. Verify the move succeeds, the expense appears on that report, and there is no backend rejection or console error.
  4. As a workspace admin or report manager, repeat the picker check. Verify the admin/manager fallback does not restore Non-reimbursable destination. Repeat with a normal workspace member who owns an Open non-reimbursable Draft and separate source expense.
  5. Create or identify a retracted or reopened Open draft containing only non-reimbursable expenses. Verify it remains in the picker and that moving an expense into it succeeds. Verify a report on a workspace without the instant-submit/Submit & Close combination is not excluded solely for having non-reimbursable expenses.
  6. Repeat with a destination whose transaction list has not finished loading. Verify the picker does not hide it based on summary totals alone; after loading all destination transactions, reopen the picker and verify it is excluded. Do not select the incompletely loaded destination as proof of backend eligibility.
  7. Populate more than 12 outstanding reports so the picker paginates. Search the exact non-reimbursable report name and verify it remains absent; search an eligible report and verify it remains available.
  8. Run npm run test -- --runTestsByPath tests/unit/ReportUtilsTest.ts tests/ui/IOURequestEditReportCommonTest.tsx --runInBand, npm run typecheck, npm run lint-changed, npm run react-compiler-compliance-check check-changed, and npm run spell-changed.
  9. Check the JS console and move API responses; record any pre-existing console errors separately.

Offline tests

  1. While online, fully load the Open Draft Non-reimbursable destination and Mixed destination, then turn the browser network offline. Open the Source expense's More > Move to report picker. Search both names: verify the Open non-reimbursable-only destination stays hidden and Mixed destination stays listed from cached data. Capture the picker and console.
  2. Restore the network. Verify the picker still has the same destinations and that a move to Mixed destination succeeds.

QA Steps

  1. On staging, first use manual expense submission to create three Open Draft reports for one submitter: a non-reimbursable-only destination, a destination with at least one reimbursable expense, and a source expense report. Switch the workspace to instant submit + Submit & Close, and confirm the first destination remains Open Draft. Open both destinations to load all their expenses.
  2. From the source expense, open More > Move to report. Verify the non-reimbursable-only report is absent and the mixed report is present, including in exact-name search results. Capture the destination and picker.
  3. Move to the mixed report and verify the move succeeds and the destination displays the expense. Verify there are no JS console errors or failed move requests.
  4. Repeat the picker check as a workspace admin/report manager and a normal workspace member who owns matching reports; verify the non-reimbursable-only report remains absent. Check a retracted/reopened Open draft and a manual-submit workspace report remain available when applicable.
  5. With the destinations loaded, go offline and repeat the picker check. Restore network and verify a valid move succeeds.
  6. Verify that no errors appear in the JS console.

Local QA Results (2026-11-07)

The full browser matrix tested App head 8a0551dbd53881ee81b3ae02121bdd94510ec727. After main advanced again, it was merged cleanly and pushed at final PR head 7766857ec57e69d3a6cab004e3b1349ae27f489d; the PR's four-file diff against main did not change. Auth and Web-Expensify were refreshed again, Auth/Bedrock and related VM services were rebuilt/restarted, and the core admin, normal member, offline, and valid-move flows passed again on the final head. The fixture uses synthetic local accounts and workspaces.

  • Passed in desktop Chromium and WebKit on macOS: an Open non-reimbursable Draft created under manual submission stayed Open after switching to instant submit + Submit & Close, and was absent from exact-name picker search. The mixed destination remained available. A normal workspace member got the same exclusion for their own Open Draft.
  • Passed in emulated Pixel 7 touch Chromium and iPhone 15 touch WebKit browser profiles: the Open non-reimbursable Draft was excluded, an eligible report was listed, and valid moves persisted in fresh authenticated backend reads. These profiles emulate mobile viewport, touch input, and browser engine on macOS; they are not native or physical-device tests.
  • Passed on desktop: valid moves to the mixed report, a reopened non-reimbursable Open Draft, and a manual-submit non-reimbursable Draft returned HTTP 200 / jsonCode 200 and appeared after reload. Exact-name search worked with more than 12 outstanding reports. With the Open regression fixture fully cached, offline search excluded it and listed the mixed report; reconnect preserved the exclusion. An isolated partial-cache experiment kept the report available until its destination transaction loaded, then excluded it; no invalid move was attempted.
  • Console check did not pass: the local app logged existing React/style/hydration warnings, an unresolved https://burp/ resource, and expected network errors during the deliberate offline test. No failed move API request or new error tied to this change was observed. The no-console-errors checkbox stays unchecked.
  • Local automated checks passed: two focused Jest suites (1,683 tests), typecheck, lint-changed, spell-changed, React Compiler compliance, and formatting.
  • Android and iOS native not tested: the Android emulator booted, but Gradle stopped at HTTP 401 for required Mapbox Maven packages. iOS simulator pod installation stopped at HTTP 401 for MapboxCommon. The same locally configured Mapbox download credential is used for both and needs valid download access. Both native checkboxes remain unchecked until the apps can be installed and exercised.
  • Final-head CI: 41 checks passed, approveAndMerge was skipped, and Check independent approval failed because it requires a human approval. No approval was submitted or bypassed.

Full screenshot evidence, including nine post-merge captures, and test caveats.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

Blocked before install: Gradle receives HTTP 401 for required Mapbox Maven artifacts. The emulator booted, but no PR build was installed, so this platform is unchecked.

Android: mWeb Chrome

Pixel 7 touch Chromium profile emulated on macOS at the full-matrix head; this does not certify a physical Android Chrome run. The final-head diff is unchanged.

Open Draft excluded from Pixel 7 picker

Eligible mixed report listed on Pixel 7 profile

iOS: Native

Blocked before install: CocoaPods receives HTTP 401 for MapboxCommon. No PR build was installed in the iOS simulator, so this platform is unchecked.

iOS: mWeb Safari

iPhone 15 touch WebKit profile emulated on macOS at the full-matrix head; this does not certify a physical iOS Safari run. The final-head diff is unchanged.

Open Draft excluded from iPhone 15 picker

Eligible report listed on iPhone 15 profile

MacOS: Chrome / Safari

Headless Chromium and WebKit browser engines on macOS. The first three screenshots below are from the final PR head after the latest-main merge. Full evidence index above includes search, moves, member role, and partial cache.

Open non-reimbursable Draft after policy flip

Open non-reimbursable Draft excluded from picker

Open Draft excluded while offline

Open Draft excluded in desktop WebKit

🤖 Posted by Codex, an AI coding agent acting for @Beamanator.

@Beamanator
Beamanator requested review from a team as code owners September 29, 2026 19:00
@melvin-bot
melvin-bot Bot requested review from flaviadefaria and linhvovan29546 and removed request for a team September 29, 2026 19:00
@melvin-bot

melvin-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

@linhvovan29546 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team September 29, 2026 19:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T19:41:52.734250Z 512beba Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread src/libs/ReportUtils.ts Resolved
Comment thread src/libs/ReportUtils.ts Resolved
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@Beamanator
Beamanator force-pushed the codex/418073-filter-ineligible-move-reports branch from 6e59b62 to 3aec973 Compare September 29, 2026 19:53
@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Code review

The fix targets the right spot: the new check runs before the policy-admin/report-manager fallback, so admins no longer see a destination that the backend rejects. CI passes on 3aec973. I found one logic issue and two smaller issues.

1. Stale totals can override a complete local transaction set (src/libs/ReportUtils.ts:3075-3086)

The two signals are joined with ||. Suppose every destination transaction is loaded (transactionCount === transactions.length) and at least one is reimbursable. The report is still hidden if the totals report a reimbursable total of 0. That can happen while totals lag behind an optimistic edit, such as toggling an expense to reimbursable. When the local set is complete, treat it as the source of truth, and use the totals only as a fallback:

const hasCompleteLocalTransactions = transactions.length > 0 && moneyRequestReport?.transactionCount === transactions.length;
const hasOnlyNonReimbursable = hasCompleteLocalTransactions
    ? hasOnlyNonReimbursableTransactions(moneyRequestReport?.reportID, transactions)
    : hasOnlyNonReimbursableTransactionsFromReportTotals;

2. canAddTransaction() no longer short-circuits (src/libs/ReportUtils.ts:3109-3111)

hasOnlyNonReimbursableTransactions() now runs for every report, even when the policy is not instant-submit. Before this change, it ran only for instant-submit, Submit & Close policies. The code also checks instant-submit and Submit & Close twice. Because the helper takes a precomputed boolean, the caller has to evaluate that boolean first. Use isInstantSubmitAndClose && hasOnlyNonReimbursableTransactions(...) here, or have the helper take the transactions and evaluate them lazily.

3. The UI test only asserts that a report is absent (tests/ui/IOURequestEditReportCommonTest.tsx:194)

queryByText('Ineligible Report')).not.toBeOnTheScreen() also passes if the picker renders no reports at all. Add an eligible sibling report, for example one with a reimbursable total, and assert with getByText that it appears. That proves the new filter removed the report, not an empty list.

Minor notes (no change required)
  • hasReportBeenReopened and hasReportBeenRetracted get no reportActions, so they rely only on the report fields. If those fields are missing, a retracted draft is hidden. This errs on the safe side.
  • The retracted-draft exemption only helps admins and managers. Submitters still reach canAddTransaction(), which rejects the draft without a retracted check. This behavior predates the PR.
  • I couldn't run Jest in this environment, so this review relies on the passing CI runs.

view run

Comment thread src/libs/ReportUtils.ts Resolved
@Beamanator
Beamanator force-pushed the codex/418073-filter-ineligible-move-reports branch from 3aec973 to df142e9 Compare September 30, 2026 18:46
@Beamanator

Copy link
Copy Markdown
Contributor Author

@MelvinBot re-review

@MelvinBot

Copy link
Copy Markdown
Contributor

Re-review

The new commit (df142e9) adds isInstantSubmitAndClose(policy), so the policy check now exists in one place. That change looks good, and every code check passes. The latest commit doesn't touch the three points from my last review, so they are still open:

  1. Old totals can still hide a report with a reimbursable expense. src/libs/ReportUtils.ts:3082-3093 still combines the transaction check and the totals check with ||. So when every transaction is loaded and one of them is reimbursable, a totals value of 0 still hides the report. When all transactions are loaded, trust them and fall back to the totals only otherwise:
    const hasCompleteLocalTransactions = transactions.length > 0 && moneyRequestReport?.transactionCount === transactions.length;
    const hasOnlyNonReimbursable = hasCompleteLocalTransactions
        ? hasOnlyNonReimbursableTransactions(moneyRequestReport?.reportID, transactions)
        : hasOnlyNonReimbursableTransactionsFromReportTotals;
  2. canAddTransaction() still checks transactions on every call. src/libs/ReportUtils.ts:3116 runs hasOnlyNonReimbursableTransactions() before it checks the policy. Before this PR, it ran only for instant-submit, Submit & Close policies. The fix is isInstantSubmitAndClose(policy) && hasOnlyNonReimbursableTransactions(...).
  3. The UI test would pass even if the picker showed no reports. tests/ui/IOURequestEditReportCommonTest.tsx:194 only checks that the report is missing. Add an eligible report and confirm with getByText that it appears.

I'd fix item 1 before merging. Items 2 and 3 are small follow-ups.


view run

@Beamanator

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 512beba164

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/libs/ReportUtils.ts Resolved
@linhvovan29546

linhvovan29546 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

@Beamanator The new changes in the PR don’t match the “Explanation of Change” in the PR description. Could you please check it?

@linhvovan29546

Copy link
Copy Markdown
Contributor

@Beamanator The new changes in the PR don’t match the “Explanation of Change” in the PR description. Could you please check it?

@Beamanator Could you please check this comment? Thanks!

@linhvovan29546

Copy link
Copy Markdown
Contributor

@Beamanator Could you please take a look at this PR when you have a chance? Thanks!

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/libs/ReportUtils.ts 90.45% <100.00%> (-0.02%) ⬇️
...es/iou/request/step/IOURequestEditReportCommon.tsx 87.39% <91.66%> (+0.23%) ⬆️
... and 11 files with indirect coverage changes

Copy link
Copy Markdown
Contributor Author

🤖 Posted by Codex, an AI coding agent acting for @Beamanator.

Manual QA screenshots for #102579

All 34 saved screenshots are embedded below, grouped by the PR's test steps. The first nine were captured on final App head 7766857ec57e69d3a6cab004e3b1349ae27f489d; the remaining browser matrix was captured on 8a0551dbd53881ee81b3ae02121bdd94510ec727 before the latest main merge. The four-file PR diff was unchanged by that merge. The accounts and workspaces are synthetic local fixtures.

Android/iOS entries below are touch-enabled browser profiles on macOS, not native-app or physical-device results. Native Android and iOS remain unverified because Mapbox dependency downloads returned HTTP 401. The JS console had existing unrelated warnings, so a clean-console result is not claimed.

Final PR head after latest-main merge (`7766857`) — 9 screenshots

Open non-reimbursable Draft and its loaded transaction after policy change

Open non-reimbursable Draft and its loaded transaction after policy change

Admin picker excludes the Open non-reimbursable Draft

Admin picker excludes the Open non-reimbursable Draft

Admin picker lists the mixed destination

Admin picker lists the mixed destination

Offline picker excludes the cached Open Draft

Offline picker excludes the cached Open Draft

Offline picker lists the cached mixed destination

Offline picker lists the cached mixed destination

Valid move succeeds

Valid move succeeds

Moved expense remains in destination after reload

Moved expense remains in destination after reload

Normal member's Open non-reimbursable Draft

Normal member's Open non-reimbursable Draft

Normal member's picker excludes that Draft

Normal member's picker excludes that Draft

Fixture and core picker checks (Tests 1–4, 7; full matrix at `8a0551d`) — 7 screenshots

Open non-reimbursable Draft after switching to instant Submit & Close

Open non-reimbursable Draft after switching to instant Submit & Close

Admin picker excludes the Draft

Admin picker excludes the Draft

Exact-name search excludes the non-reimbursable Draft with more than 12 outstanding reports

Exact-name search excludes the non-reimbursable Draft with more than 12 outstanding reports

Exact-name search lists the mixed destination

Exact-name search lists the mixed destination

Valid move to mixed destination appears after reload

Valid move to mixed destination appears after reload

Normal member's own Open non-reimbursable Draft

Normal member's own Open non-reimbursable Draft

Normal member's picker excludes that Draft

Normal member's picker excludes that Draft

Exception and partial-cache checks (Tests 5–6) — 7 screenshots

Reopened non-reimbursable Open Draft

Reopened non-reimbursable Open Draft

Reopened Draft remains selectable

Reopened Draft remains selectable

Move into reopened Draft succeeds

Move into reopened Draft succeeds

Manual-submit non-reimbursable Draft remains selectable

Manual-submit non-reimbursable Draft remains selectable

Move into manual-submit Draft succeeds

Move into manual-submit Draft succeeds

Partial transaction cache leaves destination visible

Partial transaction cache leaves destination visible

Destination is excluded after its transaction loads

Destination is excluded after its transaction loads

Offline and reconnect checks (Offline tests 1–2) — 5 screenshots

Picker from cached data while offline

Picker from cached data while offline

Open non-reimbursable Draft excluded offline

Open non-reimbursable Draft excluded offline

Mixed destination listed offline

Mixed destination listed offline

Picker after reconnect

Picker after reconnect

Open Draft still excluded after reconnect

Open Draft still excluded after reconnect

Other browser profiles — 6 screenshots

Desktop WebKit excludes the Open Draft

Desktop WebKit excludes the Open Draft

Pixel 7 touch Chromium profile excludes the Open Draft

Pixel 7 touch Chromium profile excludes the Open Draft

Pixel 7 touch Chromium profile lists the mixed destination

Pixel 7 touch Chromium profile lists the mixed destination

Pixel 7 touch Chromium profile shows the move after reload

Pixel 7 touch Chromium profile shows the move after reload

iPhone 15 touch WebKit profile excludes the Open Draft

iPhone 15 touch WebKit profile excludes the Open Draft

iPhone 15 touch WebKit profile lists an eligible destination

iPhone 15 touch WebKit profile lists an eligible destination

Full evidence index and test caveats.

Copy link
Copy Markdown
Contributor Author

🤖 Posted by Codex, an AI coding agent acting for @Beamanator.

Following up on #102579 (comment): the feedback was valid for the earlier PR description. The description has since been rewritten, and I checked it against the current PR head 7766857ec57e69d3a6cab004e3b1349ae27f489d.

The “Explanation of Change” now describes the implemented checks: isReportIneligibleForMoveExpenses() requires instant submit + Submit & Close and a complete locally loaded transaction set whose expenses are all non-reimbursable; it does not infer that result from report totals or a partial cache. It exempts reopened/retracted Open drafts from this new filter. The picker applies that result before its admin/report-manager fallback. The existing eligibility checks still apply to every destination.

Code:

App/src/libs/ReportUtils.ts

Lines 3273 to 3289 in 7766857

function isReportIneligibleForMoveExpenses(moneyRequestReport: OnyxEntry<Report>, policy: OnyxEntry<Policy>, transactionsByID: Record<string, Transaction> | undefined): boolean {
// Auth treats reopened and retracted Open reports as drafts and allows expenses to be moved into them.
if (!isExpenseReport(moneyRequestReport) || (isOpenExpenseReport(moneyRequestReport) && (hasReportBeenReopened(moneyRequestReport) || hasReportBeenRetracted(moneyRequestReport)))) {
return false;
}
if (!isInstantSubmitAndClose(policy)) {
return false;
}
const transactions = Object.values(transactionsByID ?? {});
// A partial local cache cannot prove that every destination transaction is non-reimbursable; report totals can also be stale or cancel out.
const hasCompleteLocalTransactions = transactions.length > 0 && moneyRequestReport?.transactionCount === transactions.length;
const hasOnlyNonReimbursable = hasCompleteLocalTransactions && hasOnlyNonReimbursableTransactions(moneyRequestReport.reportID, transactions);
return hasOnlyNonReimbursable;
}
and
const outstandingReports = useOutstandingReports(selectedReportID, selectedPolicyID, resolvedReportOwnerAccountID, isEditing, reportOwnerLogin);
// The derived transaction map has no per-report keys, so select only eligibility for the currently outstanding destinations.
const [ineligibleReportIDs] = useOnyx(ONYXKEYS.DERIVED.REPORT_TRANSACTIONS_AND_VIOLATIONS, {
selector: (reportTransactionsAndViolations) => {
const ineligibleIDs: Record<string, true> = {};
for (const report of outstandingReports) {
if (!report) {
continue;
}
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
if (isReportIneligibleForMoveExpenses(report, policy, reportTransactionsAndViolations?.[report.reportID]?.transactions)) {
ineligibleIDs[report.reportID] = true;
}
}
return ineligibleIDs;
},
});
// Outstanding reports belong to one owner, so listing them would offer their reports for everyone else's expenses.
const eligibleReports =
outstandingReports.length === 0 || hasMultipleSubmitters
? []
: outstandingReports
.sort((report1, report2) => sortOutstandingReportsBySelected(report1, report2, selectedReportID, localeCompare))
.filter((report): report is NonNullable<typeof report> => report !== undefined)
.filter((report) => {
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
if (isTimeRequest && !isTimeTrackingEnabled(policy)) {
return false;
}
if (isPerDiemRequest && !canSubmitPerDiemExpenseFromWorkspace(policy)) {
return false;
}
if (ineligibleReportIDs?.[report.reportID]) {
return false;
}
if (canAddTransaction(report, rules, undefined, true)) {
return true;
}
const isReportPolicyAdmin = isPolicyAdmin(policy);
const isReportManager = report.managerID === currentUserPersonalDetails.accountID;
return isReportPolicyAdmin || isReportManager;
});
. The PR description also now includes matching test steps and QA results, with screenshot evidence at #102579 (comment).

No additional code change is needed for this description feedback; the current code commit is 7766857ec57e69d3a6cab004e3b1349ae27f489d.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Review

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Web test steps verification results: ⚠️ partial

Fixture setup was blocked: the browser automation reported Create expense covered by its containing dialog. A manual-submit workspace and empty report were created, but no PR behavior was verified.
Add expense dialog where Create expense clicks were rejected as covered

Step Status
Tests 1 — Create regression fixturesManual submission confirmed; expense creation blocked before destinations and source could be populated.
Add expense dialog where Create expense clicks were rejected as covered
⚠️
Tests 2 — Picker filtering and searchBlocked by missing populated fixtures.
⚠️
Tests 3 — Move to mixed destinationNo move attempted.
⚠️
Tests 4 — Admin and member eligibilityAdmin check blocked; member check requires another account.
⚠️
Tests 5 — Reopened/retracted and manual-submit exceptionsNot exercised.
⚠️
Tests 6 — Partial-cache transitionFixture unavailable; no invalid move attempted.
⚠️
Tests 7 — Pagination and exact-name searchMore-than-12-report fixture unavailable.
⚠️
Tests 8 — Automated checksSeparately ran both documented Jest suites: 1,683 tests passed. Other local checks were not rerun; their current CI checks pass. Jest emitted navigation-initialization warnings.
⚠️
Tests 9 — Console and API responsesNo move responses exist. Browser console inspection unavailable.
⚠️
Offline 1 — Cached filteringFixtures unavailable; offline switching unsupported by the available browser tooling.
⚠️
Offline 2 — Reconnect and valid moveNot exercised.
⚠️
QA 1 — Manual-to-instant fixtureOnly an empty manual-submit report was created.
⚠️
QA 2 — Picker and searchBlocked by missing fixtures.
⚠️
QA 3 — Successful move and persistenceNo move attempted.
⚠️
QA 4 — Roles and exceptionsNot exercised.
⚠️
QA 5 — Offline and reconnectNot exercised.
⚠️
QA 6 — Clean browser consoleNot verified; console access unavailable.
⚠️

Code review: No new blocking issue found in the current diff. The three previous findings are addressed: complete transactions replace aggregate-total inference, transaction checking short-circuits on policy, and the UI regression test asserts an eligible sibling remains visible. Human independent approval remains outstanding; this run does not certify browser QA.


view run

@linhvovan29546

linhvovan29546 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Repeat the picker check as a workspace admin/report manager and a normal workspace member who owns matching reports; verify the non-reimbursable-only report remains absent. Check a retracted/reopened Open draft and a manual-submit workspace report remain available when applicable.

@Beamanator I tested this as a normal workspace member who owns a non-reimbursable-only draft. After the admin retracted it, the report isn't listed on the Move to report page. The same happens on main, so this isn't a regression from this PR and should be handled separately so it doesn't block this one. We can update this QA step accordingly, for example by limiting the "retracted/reopened draft remains available" check to admins and report managers.

Screen.Recording.2026-11-09.at.22.19.02.mov

@linhvovan29546

linhvovan29546 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
Screen.Recording.2026-11-09.at.22.23.02.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-11-09.at.22.00.00.mov

@linhvovan29546 linhvovan29546 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB #102579 (comment)

Could you please check all the PR author checklist?

@linhvovan29546

Copy link
Copy Markdown
Contributor

@Beamanator friendly bump, could you take a look when you have a moment?

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants