Skip to content

[Due for payment 2025-10-27] [$250] Workspace - In offline, after re-enabling distance rate, second distance rate also enabled #68739

Closed

Description

@jponikarchuk

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: V9.1.96-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #68004
Email or phone of affected tester (no customers): Slottwo1 2@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13 phone
App Component: Money Requests

Action Performed:

  1. Launch app
  2. Go to workspace settings
  3. Go offline
  4. Enable distance rate
  5. Open distance rate
  6. Add a rate
  7. Go to more features - disable and enable the rate
  8. Open distance rate
  9. Note first distance rate is enabled
  10. Turn on internet
  11. Note second rate is enabled

Expected Result:

In offline, after re-enabling distance rate, second distance rate must not be enabled when turn on internet.

Actual Result:

In offline, after re-enabling distance rate, second distance rate also enabled when turn on internet.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021960500223321046518
  • Upwork Job ID: 1960500223321046518
  • Last Price Increase: 2025-09-03
Issue OwnerCurrent Issue Owner: @stephanieelliott / @dylanexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 19, 2025
  2. melvin-bot commented on Aug 19, 2025

    @melvin-bot

    Triggered auto assignment to @stephanieelliott (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.

  3. nkdengineer commented on Aug 19, 2025

    @nkdengineer
    Contributor

    Proposal

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

    In offline, after re-enabling distance rate, second distance rate also enabled when turn on internet.

    What is the root cause of that problem?

    When we disable and enable the distance rate in offline mode, both APIs are removed from the queue based on resolveEnableFeatureConflicts.

    App/src/libs/API/index.ts

    Lines 195 to 205 in d1b5bdd

    function writeWithNoDuplicatesEnableFeatureConflicts<TCommand extends EnablePolicyFeatureCommand>(
    command: TCommand,
    apiCommandParameters: ApiRequestCommandParameters[TCommand],
    onyxData: OnyxData = {},
    ): Promise<void | Response> {
    const conflictResolver = {
    checkAndFixConflictingRequest: (persistedRequests: OnyxRequest[]) => resolveEnableFeatureConflicts(command, persistedRequests, apiCommandParameters),
    };
    return write(command, apiCommandParameters, onyxData, conflictResolver);
    }

    Only the distance rate API is called, which enables the rate.

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

    We should only remove duplicate enabled feature API for the features that don't change the data, like expenseify card, company card.

    const availableRemoveDuplicateEnableFeatureConflicts: string[] = [
        WRITE_COMMANDS.ENABLE_POLICY_EXPENSIFY_CARDS,
        WRITE_COMMANDS.ENABLE_POLICY_COMPANY_CARDS,
        WRITE_COMMANDS.ENABLE_POLICY_CONNECTIONS,
        WRITE_COMMANDS.TOGGLE_RECEIPT_PARTNERS,
        WRITE_COMMANDS.ENABLE_POLICY_INVOICING,
    ];
    
    

    const deleteRequestIndex = persistedRequests.findIndex(
    (request) => availableRemoveDuplicateEnableFeatureConflicts.includes(command) && request.command === command && request.data?.policyID === parameters.policyID && request.data?.enabled !== parameters.enabled,
    );

    const deleteRequestIndex = persistedRequests.findIndex(
    (request) => request.command === command && request.data?.policyID === parameters.policyID && request.data?.enabled !== parameters.enabled,
    );
    if (deleteRequestIndex === -1) {

    App/src/libs/API/index.ts

    Lines 195 to 205 in d1b5bdd

    function writeWithNoDuplicatesEnableFeatureConflicts<TCommand extends EnablePolicyFeatureCommand>(
    command: TCommand,
    apiCommandParameters: ApiRequestCommandParameters[TCommand],
    onyxData: OnyxData = {},
    ): Promise<void | Response> {
    const conflictResolver = {
    checkAndFixConflictingRequest: (persistedRequests: OnyxRequest[]) => resolveEnableFeatureConflicts(command, persistedRequests, apiCommandParameters),
    };
    return write(command, apiCommandParameters, onyxData, conflictResolver);
    }

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

    None

    What alternative solutions did you explore? (Optional)

    We can call API.write for the enable feature API that changes the policy data

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. melvin-bot commented on Aug 22, 2025

    @melvin-bot

    @stephanieelliott Whoops! This issue is 2 days overdue. Let's get this updated quick!

  5. melvin-bot commented on Aug 26, 2025

    @melvin-bot

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

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 27, 2025
  7. changed the title [-]Workspace - In offline, after re-enabling distance rate, second distance rate also enabled[/-] [+][$250] Workspace - In offline, after re-enabling distance rate, second distance rate also enabled[/+] on Aug 27, 2025
  8. melvin-bot commented on Aug 27, 2025

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

    @melvin-bot

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

  11. 33 remaining items

  12. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Oct 20, 2025
  13. changed the title [-][$250] Workspace - In offline, after re-enabling distance rate, second distance rate also enabled[/-] [+][Due for payment 2025-10-27] [$250] Workspace - In offline, after re-enabling distance rate, second distance rate also enabled[/+] on Oct 20, 2025
  14. melvin-bot commented on Oct 20, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Oct 20, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.33-4 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 2025-10-27. 🎊

    For reference, here are some details about the assignees on this issue:

  16. melvin-bot commented on Oct 20, 2025

    @melvin-bot

    @parasharrajat @stephanieelliott / @dylanexpensify 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]

  17. melvin-bot commented on Oct 27, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@stephanieelliott)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1960500223321046518/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  18. parasharrajat commented on Oct 28, 2025

    @parasharrajat
    Member

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/57486/files#r2468175378

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: Not needed

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Test:

    1. Go to workspace settings
    2. Go offline
    3. Enable distance rate
    4. Open distance rate
    5. Add a rate
    6. Go to more features - disable and enable the rate
    7. Open distance rate
    8. Note first distance rate is enabled
    9. Turn on internet
    10. Verify that: In offline, after re-enabling distance rate, second distance rate must not be enabled when turn on internet.

    Do we agree 👍 or 👎

  19. stephanieelliott commented on Oct 31, 2025

    @stephanieelliott
    Contributor
  20. stephanieelliott commented on Oct 31, 2025

    @stephanieelliott
    Contributor

    Payment Summary

    Contributor: @nkdengineer due $250 via NewDot
    Contributor+: @parasharrajat due $250 via NewDot

  21. parasharrajat commented on Nov 9, 2025

    @parasharrajat
    Member

    Payment requested as per #68739 (comment)

  22. trjExpensify commented on Nov 17, 2025

    @trjExpensify
    Contributor

    approved $250 for @parasharrajat.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions