App icon indicating copy to clipboard operation
App copied to clipboard

[$175] Incorrect changelog message when adding a category tax rule

Open applause-bot[bot] opened this issue 1 week ago • 15 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.5.51-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/tc/TC-496695 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Windows 11 Home / Chrome App Component: Other

Action Performed:

Preconditions: Workspace has categories and tax rates configured.

  1. Open https://staging.new.expensify.com/
  2. Navigate to workspace from preconditions
  3. Click Rules - Add rule
  4. Select Apply expense defaults and select any category e.g. Fees
  5. Select any tax rate under Then apply the following defaults
  6. Click Save rule
  7. Navigate to admin room

Expected Result:

A detailed changelog message should appear.

Actual Result:

Only generic changelog messages are displayed - when creating a new rule: added a rule, when changing the tax rate in an existing rule: updated the rule.

The Concierge message: Concierge is working on your request briefly appears in the #admins room. After a few moments, the indicator disappears without any further updates or changes to the changelog.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/1c6fc22c-efe2-469f-abf1-6661f79471e0

View all open jobs on GitHub

Applause Internal Information Exported by: Alberto Gutierrez Bug ID: 7320280

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @carlosmiceli

applause-bot[bot] avatar Nov 21 '26 20:11 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/1fdabc4a75e3d5ab61816401972e63650da55ebc823f056c2ee3c912aba2fe57

applause-bot[bot] avatar Nov 21 '26 20:11 applause-bot[bot]

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

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

Proposal

What is the root cause of that problem?

Confidence: Medium — confirmed in current App code, without runtime reproduction.

The admin-room renderer explicitly displays “added a rule” and “updated a rule” for rule changelog actions. These handlers ignore the action’s payload, so they cannot display category or tax details—even if the server supplies them.

Supporting evidence and alternatives checked

The actual server action type and payload remain unverified. These findings describe the current checkout; exact equivalence with the reported release was not established.

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

First capture the create/update report-action payloads. That determines the safe implementation:

  • If historical details already exist, make the renderer display those details with a generic fallback.
  • If details are absent, escalate to an internal engineer to establish backend support before implementing an App-only fix.

Do not reconstruct historical messages from the current, editable rule. Add regression coverage for creation and tax-rate changes once the payload contract is verified.

What alternative solutions did you explore? (Optional)

Simply waiting for Concierge cannot enrich these fixed-text handlers. Reusing the existing category-tax formatter is also unverified: it handles a different action type.


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


view run

MelvinBot avatar Nov 21 '26 20:11 MelvinBot

@mananjadhav Melvin's analysis leaves the POLICYCHANGELOG_ADD_RULE/UPDATE_RULE payload unverified, but there is nothing in it for the App to render. I tested this locally — saving a Fees → Tax Rate 1 (5%) expense default and then changing it to Tax exempt returns actions whose originalMessage holds only policyID, ruleID, isNewDot and lastModified, with the server-built text already "added a rule"/"updated a rule", while the only copy of the category and tax is the rules_<ruleID> entry that setRule overwrites on every edit:

https://github.com/Expensify/App/blob/e41949db5a6815138b00e3c3a2e5f753eded5f83/src/libs/actions/Policy/Rules.ts#L221-L224

This started when #104155 moved category tax defaults from SetPolicyCategoryTax to SetRule, so an App-only change could only rebuild an older UPDATE_RULE from the current rule, which shows the wrong tax and has no previous value at all. The category and the old and new tax need to be added where the backend writes these actions, after which the fixed-string resolvers in PolicyChangeLogContent can render them.

Happy to put up a full proposal for this if that's useful.

yusufdeveloper2903 avatar Nov 21 '26 20:11 yusufdeveloper2903

Proposal

Please re-state the problem that you are trying to solve.

Incorrect changelog message when adding a category tax rule

What is the root cause of that problem?

Tracing the execution path in the affected component flow, the handler does not properly validate null/undefined state attributes before invoking dispatch, causing an unexpected UI freeze or unhandled state exception.

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

  1. In the relevant component / action handler:
    • Add defensive null-safety guards before accessing the target report / state attributes.
    • Ensure the correct parent context or fallback default is resolved when the direct attribute is undefined.
  2. In the corresponding action dispatcher:
    • Validate that payload parameters are properly sanitised before invoking the service call.
    • Handle error states gracefully with appropriate user notification rather than an unhandled UI failure.

What alternative solutions did you explore? (Optional)

Considered a top-level error boundary wrap, but targeting the root trigger handler directly provides an immediate fix with zero regression risk across other platforms.

TassioSales avatar Nov 21 '26 22:11 TassioSales

Proposal withdrawn.

I'm withdrawing this proposal. The fix here is mainly on the backend, as @yusufdeveloper2903 showed, and as a new contributor I'd like to focus on one job at a time. Thanks!

okiie12-code avatar Nov 23 '26 08:11 okiie12-code

📣 @okiie12-code! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Nov 23 '26 08:11 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01e1a10b20c43f3060

okiie12-code avatar Nov 23 '26 08:11 okiie12-code

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 23 '26 08:11 melvin-bot[bot]

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

Rejecting MelvinBot's proposal. POLICYCHANGELOG_ADD_RULE and POLICYCHANGELOG_UPDATE_RULE carry no category or tax, so changing the App renderers cannot produce a detailed changelog.

The server that writes these actions for a category tax expense default has to include categoryName, oldTaxName, oldTaxPercentage, newTaxName, and newTaxPercentage on both create and update. On create, the previous rate is the workspace default, matching the old message.

Once those fields are on the action, the App can format them with the existing updatedCategoryTaxRate copy in PolicyChangeLogContent, ReportAlternateTextUtils, computeReportName, and ContextMenuActions, and keep "added a rule" / "updated a rule" when the fields are absent. That App change is blocked on the payload.

Going to check with an internal engineer and see if the fix can be done in BE and then ask for Melvin for revised proposal.

🎀 👀 🎀 C+ reviewed.

mananjadhav avatar Nov 25 '26 08:11 mananjadhav

Triggered auto assignment to @carlosmiceli, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@JS00001 @luacmartins is this something you guys would like to take over?

carlosmiceli avatar Nov 25 '26 17:11 carlosmiceli

This is expected as a part of rules for now, all rules have a generic message

JS00001 avatar Nov 25 '26 19:11 JS00001