App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Unclear admin system message when update distance rates

Open mitarachim opened this issue 1 month ago • 36 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.2.63-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-2155/folder/13176744/41237137/1035950355 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Device used: Lenovo 80ES / Windows 10 Pro App Component: Chat Report View

Action Performed:

  1. Create workspace
  2. Enable distance rates
  3. Add new rate
  4. Disable the new rate
  5. Go to #admin
  6. Open the thread

Expected Result:

The last admin system message should clearly indicate the change that happened for the new rate

Actual Result:

generate 2 system messages :

  • updated the enabled of the Distance rate "New Rate" from "enabled" to "disabled"
  • updated the index of the Distance rate "New Rate" from "" to "1"

The second admin system message is unclear. It reads: "updated the index of the Distance rate "New Rate" from "" to "1" the "1" seems to be a placeholder and doesn't clearly state the change.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Image

https://github.com/user-attachments/assets/c45e23dd-fb51-4fc2-a24f-b08f3f52c96a

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021993382977909527240
  • Upwork Job ID: 1993382977909527240
  • Last Price Increase: 2025-12-23

mitarachim avatar Nov 25 '25 09:11 mitarachim

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

melvin-bot[bot] avatar Nov 25 '25 10:11 melvin-bot[bot]

Proposal

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

Unclear admin system message when update distance rates

What is the root cause of that problem?

  • The "enabled" and "index" field is not handles here: https://github.com/Expensify/App/blob/dbec56adf78f853d08ba2c88527e5ebb22203044/src/libs/ReportActionsUtils.ts#L2683-L2719

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

  • We should handle those fields in the function:
    if (customUnitRateName && updatedField === 'enabled' && typeof newValue === 'boolean') {
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        return translateLocal('workspaceActions.updatedCustomUnitRateEnabled', {
            customUnitRateName,
            newValue,
            oldValue: typeof oldValue === 'boolean' ? oldValue : undefined,
        });
    }

    if (customUnitRateName && updatedField === 'index' && typeof newValue === 'number') {
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        return translateLocal('workspaceActions.updatedCustomUnitRateIndex', {
            customUnitRateName,
            newValue,
            oldValue: typeof oldValue === 'number' ? oldValue : undefined,
        });
    }

type UpdatedPolicyCustomUnitRateEnabledParams = {customUnitRateName: string; newValue: boolean; oldValue?: boolean};

type UpdatedPolicyCustomUnitRateIndexParams = {customUnitRateName: string; newValue: number; oldValue?: number};

    updatedCustomUnitRateEnabled: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitRateEnabledParams) => {
        const newValueText = newValue ? 'enabled' : 'disabled';
        if (oldValue !== undefined) {
            const oldValueText = oldValue ? 'enabled' : 'disabled';
            return `changed the distance rate "${customUnitRateName}" to ${newValueText} (previously ${oldValueText})`;
        }
        return `set the distance rate "${customUnitRateName}" to ${newValueText}`;
    },
    updatedCustomUnitRateIndex: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitRateIndexParams) => {
        if (oldValue !== undefined) {
            return `changed the index of the distance rate "${customUnitRateName}" to ${newValue} (previously ${oldValue})`;
        }
        return `set the index of the distance rate "${customUnitRateName}" to ${newValue}`;
    },
  • Also handle other field if missing.
  • Translations can be updated and changed during the PR work.

What alternative solutions did you explore? (Optional)

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.

Rkdev09 avatar Nov 25 '25 12:11 Rkdev09

I have updated my proposal. I hope that's not an issue.

Rkdev09 avatar Nov 25 '25 12:11 Rkdev09

Thanks for the proposal @Rkdev09! Adding a C+ to review. I can reproduce with the steps in the OP.

Christinadobrzyn avatar Nov 25 '25 18:11 Christinadobrzyn

Job added to Upwork: https://www.upwork.com/jobs/~021993382977909527240

melvin-bot[bot] avatar Nov 25 '25 18:11 melvin-bot[bot]

Triggered auto assignment to @dannymcclain (Design), see these Stack Overflow questions for more details.

melvin-bot[bot] avatar Nov 25 '25 18:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 25 '25 18:11 melvin-bot[bot]

Also adding design as I think we need to determine what wording we want to use instead of "1" for the rate change.

Maybe we just remove this link all together? updated the index of the Distance rate "New Rate" from "" to "1" and only use updated the enabled of the Distance rate "New Rate" from "enabled" to "disabled"

Christinadobrzyn avatar Nov 25 '25 18:11 Christinadobrzyn

updated the index of the Distance rate "New Rate" from "" to "1"

Where is this message coming from? It makes no sense to me and I don't know why we'd surface this to users haha. I think we need to either remove it, or figure out what it's trying to communicate and rewrite it to make sense.

dannymcclain avatar Nov 25 '25 19:11 dannymcclain

Proposal

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

The system message shown to admins when updating Distance rates is unclear or unnecessary.

What is the root cause of that problem?

  1. For the message: "updated the enabled of the Distance rate 'New Rate' from 'enabled' to 'disabled'"

    • There is currently no logic to handle this message type in https://github.com/Expensify/App/blob/29e1abf9b6c6bb3b0465f09a6d7e3234d44b421f/src/libs/ReportActionsUtils.ts#L2683, so it falls back to a generic handler at https://github.com/Expensify/App/blob/29e1abf9b6c6bb3b0465f09a6d7e3234d44b421f/src/libs/ReportActionsUtils.ts#L2718, resulting in an unclear message.
  2. For the message: "updated the index of the Distance rate 'New Rate' from '' to '1'"

    • As per this comment, this message is not useful for users and should not be shown. However, there's currently no logic on the frontend to suppress it.

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

  1. For the message: "updated the enabled of the Distance rate 'New Rate' from 'enabled' to 'disabled'"
    • Add a condition at https://github.com/Expensify/App/blob/29e1abf9b6c6bb3b0465f09a6d7e3234d44b421f/src/libs/ReportActionsUtils.ts#L2697 to handle updates to the enabled field of a custom unit rate:
   if (customUnitName && customUnitRateName && updatedField === 'enabled') {
       return translateLocal('workspaceActions.updateCustomUnitEnabled', {
           customUnitName,
           customUnitRateName,
           newValue,
       });
   }
  • Add the following translation string:
        updateCustomUnitEnabled: ({customUnitName, customUnitRateName, newValue}) => `${newValue ? 'enabled' : 'disabled'} the ${customUnitName} rate "${customUnitRateName}"`,
  1. For the message: "updated the index of the Distance rate 'New Rate' from '' to '1'"

    • Create a helper function to detect and filter out this specific message type:
function isEnableCustomUnitRateIndexMessage(action: ReportAction) {
    return (
        action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE &&
        getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE>)?.updatedField === 'index'
    );
}
  • Use this helper in https://github.com/Expensify/App/blob/29e1abf9b6c6bb3b0465f09a6d7e3234d44b421f/src/libs/ReportActionsUtils.ts#L912 to suppress rendering:
   if (isEnableCustomUnitRateIndexMessage(reportAction)) {
       return false;
   }

What alternative solutions did you explore? (Optional)

truph01 avatar Nov 26 '25 05:11 truph01

Gonna tag @Expensify/product-pr here in case any of them have any more context on where this weird system message is coming from/why.

dannymcclain avatar Nov 26 '25 14:11 dannymcclain

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

melvin-bot[bot] avatar Nov 29 '25 00:11 melvin-bot[bot]

@Krishna2323 Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Dec 01 '25 01:12 melvin-bot[bot]

Waiting for @Expensify/product-pr team response on this.

Krishna2323 avatar Dec 01 '25 14:12 Krishna2323

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 02 '25 16:12 melvin-bot[bot]

Still waiting for @Expensify/product-pr team response on https://github.com/Expensify/App/issues/75997#issuecomment-3581509153.

Krishna2323 avatar Dec 03 '25 13:12 Krishna2323

@dannymcclain can you confirm who is on the @Expensify/product-pr team? There doesn't seem to be anyone linked to that group in GH so just trying to figure out if I should reach out to someone in Slack?

Christinadobrzyn avatar Dec 04 '25 01:12 Christinadobrzyn

Oh what the heck? Did something change with that handle recently? I know @JmillsExpensify and @trjExpensify should be in that group at the very least.

dannymcclain avatar Dec 04 '25 15:12 dannymcclain

yeah, we're working on the notification issues. @neil-marcellini might actually be best to answer this question. FWIW though, I don't think this system message should exist at all.

JmillsExpensify avatar Dec 05 '25 10:12 JmillsExpensify

Oh what the heck? Did something change with that handle recently?

Fixed now!

Edit: This is not fixed, it caused us to be notified again for every PR created so I had to remove us again. If you need us, feel free to tag Jason, me, Joe and Jenny for now.

trjExpensify avatar Dec 05 '25 13:12 trjExpensify

@trjExpensify is the fix deployed to staging? I can still reproduce the issue.

Krishna2323 avatar Dec 05 '25 23:12 Krishna2323

Sorry, I was addressing @dannymcclain's question on the GH handle. Not commenting on the bug.

trjExpensify avatar Dec 08 '25 13:12 trjExpensify

@trjExpensify @JmillsExpensify ahh, sorry — is there any chance you know about this system message? These seem to be new messages sent from the BE; I haven’t seen them before. The index message doesn't seem very helpful to me, and the BE shouldn’t send it if we don’t want to show it.

Should I trigger an assignment to CME to discuss this further?

Krishna2323 avatar Dec 08 '25 14:12 Krishna2323

Yeah, I don't have any recollection of where that came from... sorry! I think @rayane-d and @jamesdeanexpensify have been doing some work on policy audit logs recently, @sakluger originally.

trjExpensify avatar Dec 09 '25 01:12 trjExpensify

Ah, yeah, I brought this up here just because I happened to be skimming the channel. Shall we come to a conclusion there?

jamesdeanexpensify avatar Dec 09 '25 01:12 jamesdeanexpensify

Agree that system messages shouldn't make any reference to a BE index.

JmillsExpensify avatar Dec 09 '25 09:12 JmillsExpensify

Yeah, I don't have any recollection of where that came from... sorry! I think @rayane-d and @jamesdeanexpensify have been doing some work on policy audit logs recently, @sakluger originally.

I've been working on implementing the missing policy change logs, but I haven't touched anything related to the distance rates system messages, so I don't believe this is coming from my changes. I can take a look when I get a chance, though. In the meantime, let's apply the hot-pick label.

rayane-d avatar Dec 09 '25 10:12 rayane-d

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 09 '25 16:12 melvin-bot[bot]

Oh yeah, looks like I either forgot to test distance rates, or forgot to document my findings when I tested audit logs recently.

We're discussing the correct language to use here: https://expensify.slack.com/archives/C01GTK53T8Q/p1765036730028859

sakluger avatar Dec 09 '25 21:12 sakluger

@dannymcclain @Christinadobrzyn @Krishna2323 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 09 '25 21:12 melvin-bot[bot]