You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-07-03] Rules - "Custom rules" section appears separately when rules are sorted by Card #94360
Version Number: 9.4.17-2 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:#93185 Email or phone of affected tester (no customers):applausetester+ssndjois2jd1@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:
Paste Onyx.merge('betas', ['rulesRevamp']); in console.
Invite another member to the workspace.
Enable Expensify card and set it up with bank account.
Enable Rules.
Assign virtual card to yourself and workspace member.
Create separate card spend rule for member's card and your card.
Go to staging.new.expensify.com
Go to workspace settings > Rules.
Go to Card restrictions.
Click Card table header.
Expected Result:
"Custom rules" section will not appear separately when rules are sorted by Card.
Actual Result:
"Custom rules" section appears separately when rules are sorted by Card.
👋 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:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
In the revamped Rules → Card restrictions table, sorting by the Card column header makes the "Custom rules" section header render a second time (a spurious separate section). It should appear only once.
What is the root cause of that problem?
The section headers ("Default" / "Custom rules") are drawn by a boundary-detection scheme that assumes every row sharing the same isDefault value is contiguous. A header is emitted at row 0 and at every row whose isDefault differs from the previous row:
The single built-in default row has cardSummary = "All cards" (PolicyRulesPageRevamp.tsx:158, en.ts:7561). When sorted alphabetically, "All cards" lands in the middle of the custom card names (e.g. Alice → "All cards"(default) → Bob). That makes the isDefault sequence flip twice (false → true → false), so the "Custom rules" header renders both before and after the default row.
Why it's hidden by default and only shows when sorting
The data is built as [defaultSpendRule, ...customSpendRules] (PolicyRulesPageRevamp.tsx:179), so pre-sort there's exactly one boundary → one "Default" header then one "Custom rules" header. Sorting by cardSummary reorders the default row into the custom run and breaks that contiguity. The same latent defect applies to the Type column (index.tsx:47-55), which also doesn't pin isDefault.
What changes do you think we should make in order to solve the problem?
Make isDefault the primary sort key at the top of compareItems so the default row always sorts to one end and the custom rows stay one contiguous run — guaranteeing exactly one "Custom rules" boundary. In WorkspaceSpendRulesTable/index.tsx:44, before the column-specific branches:
Returning a fixed value (not multiplied by orderMultiplier) pins the Default section to the top regardless of sort direction, matching the original layout. This single change also fixes the equivalent issue on the Type column.
What alternative solutions did you explore?
Partition the rows into default vs. custom groups structurally (outside the generic sort) instead of relying on the comparator. This is more robust but a larger change; the primary-sort-key fix is the minimal, lowest-risk option for a deploy blocker.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/94360) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-]Rules - "Custom rules" section appears separately when rules are sorted by Card[/-][+][Due for payment 2026-07-03] Rules - "Custom rules" section appears separately when rules are sorted by Card[/+]on Jun 26, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.20-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@Krishna2323 / @situchan The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]
Activity
applause-bot commentedon Jun 23, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/e9fa9aa834d3bc0517041d35e305f5521ba8de656b21f22b980e0320d48fa85b
melvin-bot commentedon Jun 23, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #93185
melvin-bot commentedon Jun 23, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jun 23, 2026
👋 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:
MelvinBot commentedon Jun 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the revamped Rules → Card restrictions table, sorting by the Card column header makes the "Custom rules" section header render a second time (a spurious separate section). It should appear only once.
What is the root cause of that problem?
The section headers ("Default" / "Custom rules") are drawn by a boundary-detection scheme that assumes every row sharing the same
isDefaultvalue is contiguous. A header is emitted at row 0 and at every row whoseisDefaultdiffers from the previous row:WorkspaceSpendRulesTableRow.tsx:55-57But the sort comparator never sorts by
isDefault— thecardbranch sorts purely onlocaleCompare(a.cardSummary, b.cardSummary):WorkspaceSpendRulesTable/index.tsx:57-59The single built-in default row has
cardSummary = "All cards"(PolicyRulesPageRevamp.tsx:158,en.ts:7561). When sorted alphabetically, "All cards" lands in the middle of the custom card names (e.g.Alice → "All cards"(default) → Bob). That makes theisDefaultsequence flip twice (false → true → false), so the "Custom rules" header renders both before and after the default row.Why it's hidden by default and only shows when sorting
The data is built as
[defaultSpendRule, ...customSpendRules](PolicyRulesPageRevamp.tsx:179), so pre-sort there's exactly one boundary → one "Default" header then one "Custom rules" header. Sorting bycardSummaryreorders the default row into the custom run and breaks that contiguity. The same latent defect applies to the Type column (index.tsx:47-55), which also doesn't pinisDefault.What changes do you think we should make in order to solve the problem?
Make
isDefaultthe primary sort key at the top ofcompareItemsso the default row always sorts to one end and the custom rows stay one contiguous run — guaranteeing exactly one "Custom rules" boundary. InWorkspaceSpendRulesTable/index.tsx:44, before the column-specific branches:Returning a fixed value (not multiplied by
orderMultiplier) pins the Default section to the top regardless of sort direction, matching the original layout. This single change also fixes the equivalent issue on the Type column.What alternative solutions did you explore?
Partition the rows into default vs. custom groups structurally (outside the generic sort) instead of relying on the comparator. This is more robust but a larger change; the primary-sort-key fix is the minimal, lowest-risk option for a deploy blocker.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/94360)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
blimpich commentedon Jun 23, 2026
behind beta
6 remaining items
mitarachim commentedon Jun 26, 2026
Deploy Blocker #94641 was identified to be related to the PR #94478 that attempted to fix this issue.
[-]Rules - "Custom rules" section appears separately when rules are sorted by Card[/-][+][Due for payment 2026-07-03] Rules - "Custom rules" section appears separately when rules are sorted by Card[/+]melvin-bot commentedon Jun 26, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jun 26, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.20-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-07-03. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jun 26, 2026
@Krishna2323 / @situchan The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]
melvin-bot commentedon Jun 29, 2026
@Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!
Krishna2323 commentedon Jun 30, 2026
@luacmartins we can close this issue.