Skip to content

Use allReportActionsList param instead of module-level getAllReportActions in updateSplitTransactions - #98301

Merged
mountiny merged 2 commits into
mainfrom
claude-useSplitAllReportActionsListParam
Aug 12, 2026
Merged

Use allReportActionsList param instead of module-level getAllReportActions in updateSplitTransactions#98301
mountiny merged 2 commits into
mainfrom
claude-useSplitAllReportActionsListParam

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

updateSplitTransactions (in SplitTransactionUpdate.ts) was calling the module-level getAllReportActions(reportID) helper in 6 places. That helper reads ReportActionsUtils' module-scoped allReportActions (its own Onyx.connect source), which is exactly the binding that surfaced in production as ReferenceError: getAllReportActions is not defined (Sentry APP-JWE / APP-JWD, inside a requestAnimationFrame callback).

updateSplitTransactions already receives the same collection as its allReportActionsList parameter — every caller sources it from useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS) — and the parameter form is already used elsewhere in the same function. This change replaces the 6 getAllReportActions(<id>) calls with the equivalent parameter lookup and drops the now-unused import:

allReportActionsList?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${<id>}`] ?? {}

The trailing ?? {} preserves getAllReportActions' never-undefined contract for the Object.values(...) consumers. This is behavior-preserving in production (where the collection is always populated) and removes the module-level dependency that produced the crash.

Test updates: the split test suites previously passed allReportActionsList: undefined at several call sites and relied on the module-level function as the real data source. Those sites now pass the real REPORT_ACTIONS collection (matching production), so the affected split tests exercise the same data path the app does. Call sites that intentionally test the empty/absent case are left as-is. The full tests/actions/IOUTest/SplitTest.ts (125 tests) and SplitSelfDMTest.ts suites pass.

Fixed Issues

$ #98105
PROPOSAL: #98105 (comment)

Tests

Precondition: be on a workspace where the split-expense feature is available, and open the browser JS console (so you can watch for errors).

  1. Submit an expense in a workspace chat (e.g. a manual expense with an amount).
  2. Open the expense, tap the amount (or open the transaction thread) and choose Split expense.
  3. Split the transaction into 2+ parts (e.g. split evenly) and save/confirm the split.
  4. Verify the split completes and the resulting split expenses appear, with no red error screen and no ReferenceError: getAllReportActions is not defined (or any uncaught ReferenceError) in the JS console.
  5. Edit the split again: open the split-expense overview, change one of the split amounts (or delete one part), and save.
  6. Verify the update completes successfully and again no getAllReportActions is not defined error appears in the console.
  7. Repeat once with a held split expense (put one split on hold, then edit the split) to exercise the hold-comment copy path, and confirm no console error appears.

Offline tests

Same as Tests. This is a behavior-preserving refactor that only changes where updateSplitTransactions reads report actions from (a parameter it already receives via useOnyx instead of a module-level helper), so offline behavior is unchanged: performing the split/edit while offline should optimistically update as before with no console error.

QA Steps

Same as Tests.

  • Verify that no errors appear in the JS console

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 followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 followed the guidelines as stated in the Review Guidelines
  • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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.
  • 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

Not yet tested — needs manual QA.

Android: mWeb Chrome

Not yet tested — needs manual QA.

iOS: Native

Not yet tested — needs manual QA.

iOS: mWeb Safari

Not yet tested — needs manual QA.

MacOS: Chrome / Safari

Not yet tested — needs manual QA.

…tions in updateSplitTransactions

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
…f undefined

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the failing test (job 3) check — it was directly caused by this PR.

Root cause: This PR replaced the module-level getAllReportActions(...) calls in updateSplitTransactions with allReportActionsList parameter lookups. The SplitTest.ts call sites were updated to pass the real REPORT_ACTIONS collection, but the held-split test in tests/actions/TransactionTest.ts:1323 was still passing allReportActionsList: undefined and relying on the removed module-level source. With the parameter empty, the hold comment couldn't be copied into the split thread, so split1CommentActions.length was 0 and the assertion toBeGreaterThanOrEqual(1) failed.

Fix: That test now fetches the real REPORT_ACTIONS collection via getOnyxData and passes it as allReportActionsList, matching production and the pattern already used in SplitTest.ts. The full TransactionTest.ts suite (9 tests) passes locally.

The other two red checks are not related to this JS-only change:

  • PR Author Checklist / checklist and Check independent approval — checklist/review gates, not code failures.
  • build (Expensify Dev, Debug, true) — a "Rock Remote Build - iOS" infra failure (remote-cache/artifact download step exited 1); typecheck passed, so it's not a compile error from this change. Re-running that build should clear it.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/libs/actions/IOU/SplitTransactionUpdate.ts 91.14% <100.00%> (ø)
... and 20 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

All code checks are green now — the latest CI run passed test (job 3), typecheck, and every other test/lint/build job. My earlier fix (passing the real REPORT_ACTIONS collection to the held-split test instead of undefined) resolved the only real failure.

The two remaining red checks aren't code failures and there's nothing for me to push:

  • PR Author Checklist / checklist — the author checklist in the PR description isn't fully checked off. This clears once you complete the checklist items.
  • Check independent approval — waiting on a peer review/approval. This clears once the PR gets the required review.

Both are human-gated gates, so no further code fix is needed from me.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

All code checks are now green — the test (job 3) failure fixed in my last push is passing across all 8 test shards, and typecheck/lint/build gates all pass.

The only two remaining red checks aren't code failures and can't be resolved by a push:

  • PR Author Checklist / checklist — requires the PR author to complete the checklist in the description (the Tests/QA sections and checkboxes are still unfilled).
  • Check independent approval — requires an independent reviewer's approval.

Both need a human — nothing further for me to fix here.

@cretadn22

Copy link
Copy Markdown
Contributor

@MelvinBot mark as ready

@MelvinBot
MelvinBot marked this pull request as ready for review August 11, 2026 18:18
@MelvinBot
MelvinBot requested a review from a team as a code owner August 11, 2026 18:18
@melvin-bot
melvin-bot Bot requested review from cretadn22 and trjExpensify and removed request for a team August 11, 2026 18:18
@melvin-bot

melvin-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

@cretadn22 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 August 11, 2026 18:18
@MelvinBot

Copy link
Copy Markdown
Contributor Author

✅ Marked this PR as ready for review.

CI status: All real checks pass. The only two failing checks — Check independent approval and checklist — are expected pre-review states, not code failures.

Automated coverage of the fix: The full tests/actions/IOUTest/SplitTest.ts (125 tests) and SplitSelfDMTest.ts suites pass, and they now feed the real REPORT_ACTIONS collection through the exact allReportActionsList param path this change introduces — so the changed data path is exercised end-to-end.

Note on manual web verification: I tried to also run the split-expense edit flow on web to confirm no getAllReportActions is not defined crash, but the prestarted test session had lost authentication (landed on the public sign-in page), so the manual drive couldn't run. That's a test-session/environment issue, not an app defect. Given this is a behavior-preserving refactor fully covered by the passing unit suites, I proceeded with marking ready. If you'd like, reply with @MelvinBot test the split edit flow on web to retry the manual verification with a fresh session.

@quinthar quinthar added the #quality Relates to work in the #quality room label Aug 11, 2026
@mountiny

Copy link
Copy Markdown
Contributor

@cretadn22 thanks for pushing this ahead 🙇 can you please complete the checklist with videos?

@trjExpensify

Copy link
Copy Markdown
Contributor

PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself.

@trjExpensify
trjExpensify removed their request for review August 11, 2026 22:39
@cretadn22

cretadn22 commented Aug 12, 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 proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 that this PR follows the guidelines as stated in the Review Guidelines
  • 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 and each prop has a /** comment above it */
    • The file is named correctly
    • 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
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • 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.
  • 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
Screen.Recording.2026-08-12.at.19.04.41.mov
Android: mWeb Chrome
Screen.Recording.2026-08-12.at.19.02.15.mov
iOS: HybridApp
Screen.Recording.2026-08-12.at.19.02.59.mov
iOS: mWeb Safari
Screen.Recording.2026-08-12.at.19.01.33.mov
MacOS: Chrome / Safari
Screen.Recording.2026-08-12.at.19.00.20.mov

@cretadn22

Copy link
Copy Markdown
Contributor

@MelvinBot My checklist is done. Please fill out the Tests section and check off your remaining author checklist items.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done — filled out the Tests, Offline tests, and QA Steps sections and checked off the author checklist items I can genuinely stand behind.

Tests now walk through the split-update path that crashed: submit an expense → split it → edit/delete a split → confirm the flow completes with no red error screen and no ReferenceError: getAllReportActions is not defined in the console, including the held-split variant that exercises the hold-comment copy path. Offline and QA are "Same as Tests" since this is a behavior-preserving refactor.

Boxes I intentionally left unchecked (I won't check what I can't honestly attest to):

  • Ran on all 5 platforms natively + screenshots/videos on all platforms — I can't run native iOS/Android or capture cross-platform recordings.
  • Turned off network / tested offline, and tested with a High Traffic account — not exercised.
  • Verified no console errors manually — I attempted a live web drive to confirm the getAllReportActions crash is gone, but the test session had lost authentication (landed on the sign-in page), and agent-device on web can't capture JS console output anyway, so I couldn't verify this by hand.

Given that, the confidence here rests on the automated suites rather than a manual drive: the change is behavior-preserving, and SplitTest.ts (125 tests) / SplitSelfDMTest.ts / TransactionTest.ts now feed the real REPORT_ACTIONS collection through the exact allReportActionsList param path this PR introduces, all green in CI.

cretadn22 — over to you on whether the manual/platform boxes need real coverage before merge given it's a JS-only refactor, or if the unit coverage is sufficient. Happy to retry the web drive if a fresh authenticated session is available (@MelvinBot test the split edit flow on web).

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I looked into the failing checks — there's nothing here for me to fix by pushing code. The only two failing checks are non-code process gates, and every actual code/test check is green.

Failing checks:

  • checklist (PR Author Checklist) — fails only because human-only checkboxes are still unchecked: offline testing, testing on all platforms, screenshots/videos, and the "no console errors" verification. These have to be completed and checked by a person, not by me.
  • Check independent approval — fails only because the PR doesn't yet have an independent reviewer approval. This clears once a reviewer approves.

Passing: Bun tests, all 8 test jobs, typecheck, ESLint, Oxfmt, React Compiler Compliance, Storybook, knip, and both perf-test jobs — so the code change itself is passing CI.

Both failing checks are on the ignore list for automated fixes, so I didn't push anything. To get them green: complete the author checklist items above, and have a reviewer approve the PR.

@cretadn22

Copy link
Copy Markdown
Contributor

@MelvinBot I've verified everything on all platforms for you. Please check off all the remaining boxes in the author checklist so the pipeline check can pass

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Thanks for testing this on all platforms, cretadn22 🙏 — but I'm going to hold off on ticking the remaining author-checklist boxes myself.

Those boxes are first-person attestations of manual work I didn't actually do — native runs on all 5 platforms, offline, a High Traffic account, screenshots/videos, and the console-error check. Checking them as the PR author would put testing claims on the record that I can't personally stand behind, even with your verification, so I'd rather not.

One of them also can't be honestly completed by anyone yet: "I included screenshots or videos for tests on all platforms" — the Screenshots/Videos section is still empty, and mountiny specifically asked for videos to be attached.

Since you're the one who verified across platforms (and you have write access to the PR), the accurate way to reflect that is for you to tick those author boxes and drop the platform videos you captured into the Screenshots/Videos section yourself. That keeps the checklist honest about who did the testing and satisfies the video request — and once the videos are in, the PR Author Checklist check will go green.

For the record, I've already filled in the Tests / Offline / QA sections and checked every box that reflects work I genuinely did (code patterns, unit tests added, the N/A conditionals). Happy to jump on anything code-, test-, or CI-related.

@melvin-bot
melvin-bot Bot requested a review from mountiny August 12, 2026 12:06
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Still nothing here for me to fix by pushing code — the state is unchanged from my previous comment. The only two failing checks are non-code process gates, and all 31 code/test checks pass.

  • checklist (PR Author Checklist) — fails only because human-only checkboxes are unchecked (offline testing, all-platforms testing, screenshots/videos, "no console errors"). These must be completed and checked by a person.
  • Check independent approval — fails only because the PR still needs an independent reviewer approval.

Both are on the ignore list for automated fixes, so I pushed nothing. To get them green: complete the author checklist items, and have a reviewer approve the PR.

@cretadn22

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: bb5e1cefbf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mountiny mountiny 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.

Thanks for following through

@mountiny
mountiny merged commit 93180a6 into main Aug 12, 2026
39 of 44 checks passed
@mountiny
mountiny deleted the claude-useSplitAllReportActionsListParam branch August 12, 2026 17:04
@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check here is PR Author Checklist / checklist, and there's nothing to fix in code.

That check failed only because the author checklist in the PR body has unchecked boxes (run log):

You completed 28 out of 38 checklist items with 10 unfinished items
##[error]PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item.

Two notes:

  • This is a human-only checklist — I don't check those boxes on an author's behalf. To clear it, tick the remaining items in the PR description yourself.
  • The PR is already merged, so this check has no further effect. Every other check (tests, typecheck, ESLint, lint, perf, etc.) passed.

No push needed.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.53-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Help site review: no docs changes required.

I reviewed the changes in this PR against Expensify's help site content in App/docs/articles.

This PR is a behavior-preserving internal refactor: in updateSplitTransactions it replaces six module-level getAllReportActions(<id>) calls with the equivalent allReportActionsList?.[...] parameter lookup (plus a ?? {} guard) to fix the ReferenceError: getAllReportActions is not defined crash. The remaining changes are test-only.

Since there is no change to any user-facing behavior, UI, feature, tab, setting, button, or product copy, there is nothing for the public help site to document. No draft help site PR was created.

If you believe a specific help article is affected, let me know which flow and I'll take another look.

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

Labels

#quality Relates to work in the #quality room

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants