Skip to content

[$250] $250 Remove the code which clears report draft indicators when a policy is deleted #73938

Closed

Description

@tgolen

Problem

This code here contains a side-effect in the onyx connection which is an anti-pattern and adds unnecessary complexity to the code.

Solution

Figure out the best approach for removing the code completely.

cc @shubham1206agra @PiyushChandra17

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021984308625540406217
  • Upwork Job ID: 1984308625540406217
  • Last Price Increase: 2025-10-31
Issue OwnerCurrent Issue Owner: @

Activity

  1. self-assigned this
    on Oct 31, 2025
  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 31, 2025
  3. melvin-bot commented on Oct 31, 2025

    @melvin-bot

    Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  4. PiyushChandra17 commented on Oct 31, 2025

    @PiyushChandra17
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-10-31 17:38:34 UTC.

    Proposal

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

    Remove the code which clears report draft indicators when a policy is deleted

    What is the root cause of that problem?

    Improvement

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

    1. Add an explicit cleanup function, e.g. cleanupPolicyReports(policyID: string), that performs the Onyx operations.
    2. Remove the Onyx.mergeCollection / Onyx.multiSet / delete allPolicies[...] from the Onyx connection callback.
    3. Call cleanupPolicyReports from the action that issues the policy deletion (or from the codepath that knows a policy is being deleted), so the side-effect is explicit and can be unit-tested or mocked.

    Tests to add

    • Unit test for cleanupPolicyReports: ensure Onyx.multiSet is called with the proper keys for a given set of policy reports.

    • Integration test: archive/delete a policy and assert LHN no longer shows the archived chats and draft comments were removed.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    n/A

    What alternative solutions did you explore? (Optional)

    n/A

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    HelpDotApply this label if the issue relates to ExpensifyHelp
    on Oct 31, 2025
  6. changed the title [-]$250 Remove the code which clears report draft indicators when a policy is deleted[/-] [+][$250] $250 Remove the code which clears report draft indicators when a policy is deleted[/+] on Oct 31, 2025
  7. melvin-bot commented on Oct 31, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 31, 2025
  9. melvin-bot commented on Oct 31, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External)

  10. removed
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 31, 2025
  11. 4 remaining items

  12. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 31, 2025
  13. melvin-bot commented on Oct 31, 2025

    @melvin-bot

    Current assignee @thesahindia is eligible for the External assigner, not assigning anyone new.

  14. melvin-bot commented on Oct 31, 2025

    @melvin-bot

    Current assignee @sonialiap is eligible for the Bug assigner, not assigning anyone new.

  15. tgolen commented on Oct 31, 2025

    @tgolen
    ContributorAuthor

    Oh labels... what have I done 😂

  16. tgolen commented on Nov 3, 2025

    @tgolen
    ContributorAuthor

    @thesahindia will be reviewing proposals for this one

  17. thesahindia commented on Nov 5, 2025

    @thesahindia
    Member

    @PiyushChandra17's proposal seems fine. Let's assign it to them.

    🎀 👀 🎀 C+ reviewed

  18. melvin-bot commented on Nov 5, 2025

    @melvin-bot

    Current assignee @tgolen is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

  19. tgolen commented on Nov 5, 2025

    @tgolen
    ContributorAuthor

    There has been a slight twist to this issue. In #73937 (comment) it was discovered that the code might no longer be necessary at all. If that can be confirmed, then we will just remove all instances of it in that PR and this issue can be closed.

  20. PiyushChandra17 commented on Nov 10, 2025

    @PiyushChandra17
    Contributor

    @tgolen What's the status on this ?

  21. tgolen commented on Nov 10, 2025

    @tgolen
    ContributorAuthor

    We updated the other PR to remove all instances of the code, so this can be closed now. Sorry about the confusion with this one. At first, I wasn't sure if the code was still necessary or not.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions