Repository navigation
fix: force split reimbursable to policy default when field is locked - #99644
Conversation
|
@hoangzinh 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] |
|
@codex review |
| * | ||
| * When the policy locks the reimbursable field (`disabledFields.reimbursable === true`, i.e. one of the two | ||
| * "Always …" cash-expense modes), the split must follow the policy's `defaultReimbursable` regardless of the | ||
| * parent expense's stored value — a pre-rule expense can still carry `reimbursable: true` under an |
There was a problem hiding this comment.
❌ CONSISTENCY-16 (docs)
This newly added JSDoc uses an em dash (—) in its own prose, which makes the comment read less like something a person wrote. Comments should use plain sentences without em dashes.
Split the clause into two sentences (and drop the em dash), for example:
* When the policy locks the reimbursable field (`disabledFields.reimbursable === true`, i.e. one of the two
* "Always …" cash-expense modes), the split must follow the policy's `defaultReimbursable` regardless of the
* parent expense's stored value. A pre-rule expense can still carry `reimbursable: true` under an
* "Always non-reimbursable" workspace. Seeding the locked default also equals the value the
* `shouldShowReimbursable` gate compares against, so the toggle hides automatically.Reviewed at: d59c7d0 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d59c7d0096
ℹ️ 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".
| if (policy?.disabledFields?.reimbursable === true) { | ||
| return policy.defaultReimbursable; |
There was a problem hiding this comment.
Preserve non-reimbursable status for managed-card splits
When a workspace uses the locked “Always reimbursable” cash-expense mode, this returns true even if the parent is a managed-card transaction. Managed-card transactions are explicitly always non-reimbursable (TransactionUtils.getReviewDuplicatesTransactionsData), and the split editor hides the reimbursable control for them, so the user cannot correct the value; SplitTransactionUpdate then submits each child using this seeded value. Pass the transaction/card context into this resolver and retain false for managed cards before applying the cash-expense policy default.
Useful? React with 👍 / 👎.
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-09-01.at.22.42.34.mov |
| * would be submitted as reimbursable with no way for the user to correct it. | ||
| */ | ||
| function getSplitReimbursable(policy: OnyxEntry<OnyxTypes.Policy>, parentReimbursable: boolean | undefined, transaction: OnyxEntry<OnyxTypes.Transaction>): boolean | undefined { | ||
| if (isManagedCardTransaction(transaction)) { |
There was a problem hiding this comment.
can we add tests for this new util? getSplitReimbursable
| /** | ||
| * Resolve the `reimbursable` value to seed a split with. | ||
| * | ||
| * When the policy locks the reimbursable field (`disabledFields.reimbursable === true`, i.e. one of the two | ||
| * "Always …" cash-expense modes), the split must follow the policy's `defaultReimbursable` regardless of the | ||
| * parent expense's stored value. A pre-rule expense can still carry `reimbursable: true` under an | ||
| * "Always non-reimbursable" workspace. Seeding the locked default also equals the value the | ||
| * `shouldShowReimbursable` gate compares against, so the toggle hides automatically. | ||
| * | ||
| * When the field is not locked (the two "default" modes), the split keeps inheriting the parent's value. | ||
| * | ||
| * Managed-card transactions are always non-reimbursable and their reimbursable control is hidden in the split | ||
| * editor, so they must stay `false` even under a locked "Always reimbursable" policy. Otherwise the split | ||
| * would be submitted as reimbursable with no way for the user to correct it. | ||
| */ |
There was a problem hiding this comment.
NAB this comment is very verbose. Please keep it shorter going forward.
|
🚧 luacmartins has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.66-0 🚀
|
|
🤖 Help site changes are required. Draft PR: #100109 This PR makes a split follow the workspace's locked reimbursable value instead of inheriting a stale parent value. The user-visible result — the Reimbursable toggle disappearing from split rows — wasn't documented anywhere, so members hitting it have nothing to read. Two articles updated:
How I verified the labels against the live UIDrove NewDot on web with Rules enabled on a Control workspace:
Written against The docs PR is a draft, labeled @truph01, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.68-0 🚀
|
|
Yes — help site changes are required. Draft PR: #100224 This PR changed user-visible behavior that the help site never documented: splits now take their reimbursable status from the workspace Cash expense default rule, so under Always reimbursable or Always non-reimbursable the Reimbursable toggle is hidden on every split row. Two files updated:
Live UI verification and why these two filesI verified every label against the live web UI rather than reading them out of the code:
No other article needed a change. The Split Expenses FAQ already answers "Will workspace rules apply to split expenses?" generically, but it did not explain the reimbursable field specifically, which is the part members would search for after the toggle disappears. @truph01, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.4.68-1 🚀
Bundle Size Analysis (Sentry): |






Explanation of Change
Problem: Split-seeding sites copied reimbursable unconditionally from the parent transaction, so a pre-rule parent (still reimbursable: true) leaked that value into splits even under "Always non-reimbursable", keeping the toggle visible because the value no longer matched the locked policy default.
Solution: Added getSplitReimbursable(policy, parentReimbursable) — returns policy.defaultReimbursable when the field is locked (disabledFields.reimbursable === true), else the parent value — and applied it at all four seeding sites.
Splits are now initialized to the locked default, and since that equals the policy default the existing shouldShowReimbursable gate hides the toggle automatically; unlocked modes are unchanged.
Fixed Issues
$ #99140
PROPOSAL: #99140 (comment)
Tests
Precondition: Enable Rules.
→ Verify: Reimbursable field isn't present.
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari
output.mp4