Skip to content

Rules - Deleted Rules reappears after go offline #96857

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.4.43-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #95312
Email or phone of affected tester (no customers): applausetester+ndk44@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Windows 11 Home/Chrome
App Component: Workspace Settings

Action Performed:

Preconditions:

  • Create new Expensifail account
  • Create a workspace, enable Rules
  1. Open https://staging.new.expensify.com/
  2. Navigate to Workspace settings
  3. Navigate to Rules
  4. Select Field Requirements
  5. Create 2 Field Requirements rules
  6. Bulk select them
  7. Bulk Delete them
  8. Go offline

Expected Result:

Deleted rules will not reappear

Actual Result:

Deleted rules reappear when go offline

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7215232_1784789570122.deleted_rules_reappears.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7215232

Issue OwnerCurrent Issue Owner: @situchan

Activity

  1. applause-bot commented on Jul 23, 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/2428a5e6c0b8ab67abeb5ff926f528a9d7aa02af165a096bc7606b3fedb1dcd8

  2. added
    DeployBlockerCash
    Bug
    on Jul 23, 2026
  3. melvin-bot commented on Jul 23, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jul 23, 2026

    @melvin-bot

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

  5. github-actions commented on Jul 23, 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.
  6. added
    DeployBlocker
    and removed
    DeployBlockerCash
    on Jul 23, 2026
  7. jponikarchuk commented on Jul 23, 2026

    @jponikarchuk

    This issue is not reproducible when Use Staging Server is disabled

  8. changed the title [-]Rules- Deleted Rules reappears after go offline[/-] [+]Rules - Deleted Rules reappears after go offline[/+] on Jul 23, 2026
  9. MelvinBot commented on Jul 23, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    After bulk-deleting Field requirements rules (which disappear correctly while online), toggling offline makes the deleted rules reappear in the table. Introduced by #95312.

    What is the root cause of that problem?

    The table builder hides an optimistically-deleted rule row only while online, and shows it again while offline:

    src/libs/RequireFieldsRulesUtils.ts:719

    if (!isOffline && isPendingDelete) {
        continue; // hidden ONLINE only
    }

    When you delete a rule, the category's pendingFields are optimistically marked DELETE, so getRequireFieldsPendingActionForCategory returns DELETE and the row is hidden online. But if you go offline while that optimistic DELETE state is still active (the delete write request hasn't been acknowledged yet), the !isOffline guard no longer applies — so the row is rendered again. Row visibility should never depend on connectivity, but here it does, producing the "reappear when going offline" glitch.

    Investigation details / evidence
    • deleteRequireFieldsRule (RequireFieldsRulesUtils.ts:394) tears the rule down via per-field actions (setPolicyCategoryDescriptionRequired, setPolicyCategoryAttendeesRequired, removePolicyCategoryReceiptsRequired, removePolicyCategoryItemizedReceiptsRequired).
    • Each action's optimisticData sets pendingFields.<field> = DELETE while keeping the underlying value; its successData/failureData reset pendingFields.<field> back to null. So pendingAction === DELETE only lives for the in-flight duration of the delete request (verified in src/libs/actions/Policy/Category.ts).
    • While that DELETE window is open, RequireFieldsRulesUtils.ts:716-721 hides the row online but re-shows it offline — which is exactly the reported symptom. It is trivially reproducible because a user can go offline at any moment after tapping delete.
    • The !isOffline guard appears to have been added so full-rule deletes look "cleanly gone" online (see the comment at RequireFieldsRulesUtils.ts:495-499), but coupling visibility to network state is what regresses the offline case.

    Confidence: Medium-High — the network-dependent visibility at line 719 is a direct, verified cause. The exact trigger window (delete request in flight when going offline) is timing-based, but the design flaw is unambiguous.

    What changes do you think we should make in order to solve the problem?

    Make optimistically-deleted rows render consistently regardless of connectivity — do not branch on isOffline. Minimal fix: drop the !isOffline condition so a full-rule DELETE row is hidden the moment it's optimistically deleted, matching the expected result "deleted rules will not reappear":

    // RequireFieldsRulesUtils.ts:719
    if (isPendingDelete) {
        continue;
    }

    The reviewer should confirm the intended offline-delete feedback UX: if a pendingAction=delete row is meant to stay visible with a strikethrough (standard OfflineWithFeedback pattern) until sync, then it should do so in both online and offline states rather than flipping between hidden and visible.

    What alternative solutions did you explore?

    Show the pending-delete row with a strikethrough/greyed OfflineWithFeedback indicator in both states until the server confirms deletion, instead of hiding it. This preserves offline feedback but changes the current online "instantly gone" behavior.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/96857) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

    Since this is a deploy blocker tied to #95312, the fastest path may be for the PR author to push this one-line fix directly (or revert).

  10. 1 remaining item

  11. added
    Daily
    and removed
    DeployBlocker
    on Jul 23, 2026
  12. JS00001 commented on Jul 23, 2026

    @JS00001
    Contributor

    Behind a beta

  13. melvin-bot commented on Jul 28, 2026

    @melvin-bot

    @situchan Eep! 4 days overdue now. Issues have feelings too...

  14. melvin-bot commented on Jul 30, 2026

    @melvin-bot

    @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  15. Krishna2323 commented on Aug 3, 2026

    @Krishna2323
    Contributor

    @JS00001 @situchan, I can't reproduce this issue. If the category settings aren't fully deleted, the rule will reappear in offline mode when the delete is optimistic, which is expected.

  16. situchan commented on Aug 3, 2026

    @situchan
    Contributor

    I am not able to reproduce either. Maybe tester's device was on slow network connection so it's delete pending.

    Screen.Recording.2026-08-03.at.3.56.41.PM.mov
  17. JS00001 commented on Aug 3, 2026

    @JS00001
    Contributor

    Requested a retest

  18. m-natarajan commented on Aug 3, 2026

    @m-natarajan

    Not repro, Windows 11 / Chrome, v9.4.48-2

    04.08.2026_01.30.19_REC.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions