Skip to content

Rename amount column search token from original-amount to purchase-amount#95475

Merged
grgia merged 3 commits into
mainfrom
claude-renamePurchaseAmountColumnToken
Jul 9, 2026
Merged

Rename amount column search token from original-amount to purchase-amount#95475
grgia merged 3 commits into
mainfrom
claude-renamePurchaseAmountColumnToken

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

PR #88002 renamed the amount column's display label from "Original amount" to "Purchase amount", but left the column's user-friendly search token as original-amount. Since auto-generated saved-search names are built from the query string (not the label), a saved search using this column rendered as …columns:original-amount, mismatching the "Purchase amount" label the user selected.

This PR renames the column's user-friendly token from original-amount to purchase-amount so the generated name reads columns:purchase-amount:

  • src/CONST/index.tsSEARCH_USER_FRIENDLY_VALUES_MAP value for ORIGINAL_AMOUNT is now purchase-amount (the display side that builds the query string).
  • src/libs/SearchParser/baseRules.peggy — the column grammar rule now matches "purchase-amount" instead of "original-amount" (the parse side that maps the token back to the internal originalamount column identifier), so the token round-trips.
  • Regenerated committed parsers searchParser.js and autocompleteParser.js via npm run generate-search-parser / npm run generate-autocomplete-parser.
  • Updated the SearchParserTest case to assert columns:purchase-amount parses to ORIGINAL_AMOUNT.

The internal column identifier (originalamount / TABLE_COLUMNS.ORIGINAL_AMOUNT) is unchanged — only the user-facing token changed. Per the maintainer decision on the issue, original-amount is not kept as a backward-compat alias (this column is a new feature not yet in production, so there are no existing prod saved searches to migrate).

Fixed Issues

$ #95302
PROPOSAL: #95302 (comment)

Tests

  1. Go to Spend > Expenses
  2. Click Display > Edit columns
  3. Select "Purchase amount" > Save
  4. Click Save > Save view
  5. Click the 3-dot menu on the saved search > Rename
  6. Verify purchase-amount appears in the columns portion of the saved search name
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

  1. Go to Spend > Expenses
  2. Click Display > Edit columns
  3. Select "Purchase amount" > Save
  4. Click Save > Save view
  5. Click the 3-dot menu on the saved search > Rename
  6. Verify purchase-amount appears in the columns portion of the saved search name
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors related to changes in this PR
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

…ount

Co-authored-by: Sahil <thesahindia@users.noreply.github.com>
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (+5.92%) ⬆️
src/libs/actions/Report/index.ts 70.20% <100.00%> (+41.63%) ⬆️
src/libs/SearchParser/searchParser.js 85.25% <95.21%> (-0.01%) ⬇️
src/libs/SearchParser/autocompleteParser.js 59.00% <68.08%> (-0.03%) ⬇️
... and 213 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check is checklist (the PR Author Checklist) — every real CI check (tests, typecheck, ESLint, builds, perf, etc.) is passing.

That check fails only because the checklist boxes and the ### Tests / ### QA Steps sections are still unfilled:

You completed 0 out of 41 checklist items with 19 unfinished items
##[error]PR Author Checklist is not completely filled out.

There's no code fix to push here. This one requires the human co-author to fill out the checklist and the Tests/QA sections before marking the PR "Ready for review" — MelvinBot won't tick those boxes on a human's behalf.

@thesahindia

Copy link
Copy Markdown
Member

@MelvinBot, could you list all the relevant test cases for this to ensure any potential regressions are covered?

@MelvinBot

Copy link
Copy Markdown
Contributor Author

This PR renames only the user-facing search token (original-amountpurchase-amount) for the amount column, touching both the display side (query-string generation via SEARCH_USER_FRIENDLY_VALUES_MAP / getUserFriendlyValue) and the parse side (the originalAmount grammar rule + generated parsers). Regressions would show up anywhere the token round-trips. Here are the relevant cases to cover:

Parser — tests/unit/SearchParserTest.ts & tests/unit/SearchAutocompleteParserTest.ts

  • columns:purchase-amount parses to the originalamount column (added in this PR — confirm the autocomplete parser is asserted too, not just searchParser).
  • Mixed columns still parse: columns:purchase-amount,tax,report-id[originalamount, tax, reportid].
  • Word boundary: purchase-amounts / purchase-amountx must not match the column (guards the &wordBoundary in the rule).
  • Old token removed: columns:original-amount no longer maps to originalamount (per the maintainer decision, no back-compat alias). Assert it does not silently resolve to the column and does not throw.

Query-string / round-trip — tests/unit/Search/SearchQueryUtilsTest.ts

  • Primary bug: buildUserReadableQueryString for a query JSON containing the originalamount column outputs columns:purchase-amount (this is the mismatch the issue reported).
  • Full round-trip: build the query string from a search that includes the amount column → parse it back with buildSearchQueryString/parser → you get originalamount again (no drift between display and parse sides).
  • Auto-generated saved-search name for a search using this column reads …columns:purchase-amount and matches the "Purchase amount" label the user selected.

Autocomplete suggestions — tests/unit/SearchAutocompleteUtilsTest.ts

  • Typing columns: suggests purchase-amount and no longer suggests original-amount (the userFriendlyColumnList is derived from the map, so it changes automatically — worth a guard).

UI / manual QA

  • The search-results column header still displays "Purchase amount" (label is unchanged) — verify no mismatch between the visible label and the generated token.
  • Create a saved search that includes the Purchase amount column and confirm the auto-generated name in the LHN reads "Purchase amount", not original-amount.
  • Sanity: a user who manually typed the old columns:original-amount gets sensible behavior (token treated as free text / not applied) rather than a crash.

Since this column is a new, not-yet-in-production feature, there are no existing prod saved searches to migrate, so the removed-alias case only needs to fail gracefully — no migration test required.

@thesahindia

Copy link
Copy Markdown
Member

Testing today.

@thesahindia

Copy link
Copy Markdown
Member

@MelvinBot pull main

…AmountColumnToken

Co-authored-by: Sahil <thesahindia@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Merged the latest main into this branch — no conflicts, working tree clean. The merge commit has been pushed.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 No code fix needed — the only failing check is the human PR Author Checklist.

The single failing check is PR Author Checklist / checklist. It fails because the checklist isn't filled in — the job log says:

You completed 0 out of 38 checklist items with 19 unfinished items
##[error]PR Author Checklist is not completely filled out.

This is a human step (checking the boxes and filling the Tests/QA sections, which are // TODO: The human co-author must fill out… placeholders in the PR body). MelvinBot doesn't complete the author checklist on your behalf, and it isn't a code defect, so there's nothing for me to push.

Every substantive CI check has passed, including the ones that actually exercise this change:

  • verify (regenerates searchParser.js / autocompleteParser.js and confirms the committed files match the grammar) ✅
  • all 8 test jobs, including SearchParserTest (asserts columns:purchase-amountORIGINAL_AMOUNT) ✅
  • typecheck ✅, Bun tests ✅, all 4 build jobs ✅, React Compiler Compliance ✅, Oxfmt ✅, Storybook, knip, dryRun

ESLint check and the perf-test jobs were still running when I looked, but this PR is a pure string-literal rename (src/CONST/index.ts original-amountpurchase-amount, the matching grammar terminal in baseRules.peggy:138, and the regenerated parsers) — there's no mechanism for it to introduce a lint error.

Action for you: complete the PR Author Checklist and fill in the Tests/QA sections, then the checklist check will pass. Let me know if you'd like me to look again once it re-runs.

…t budget

Co-authored-by: Sahil <thesahindia@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Fixed the ESLint check failure (pushed) — it was eslint-seatbelt budget drift from the branch being behind main, not your token-rename change.

The ESLint job reported 31 eslint-seatbelt errors, all in two files this PR never touches:

Root cause: main merged #95671 ("fix-eslint-seatbelt-budget"), which fixed a namespace import → named import in Report/index.ts and removed an unsafe as Transaction assertion in SplitTest.ts, and lowered the seatbelt budgets (10→9, 21→20) in config/eslint/eslint.seatbelt.tsv to match. This branch had already picked up the lowered budgets but still carried the old versions of those two files, so their violation counts (10/21) exceeded the new budgets (9/20) by exactly 1 each → the check failed.

Fix: I synced those two files to their main versions in 4da21bb. They're now byte-identical to main, so they won't even appear in the PR diff, and the counts match the budget again.

Your actual change (renaming the original-amount search token to purchase-amount) needed no changes — typecheck, all 8 test jobs (incl. SearchParserTest), verify (parser regen), and all builds already passed. ESLint will re-run on the push and should now pass.

Why not a full git merge main?

The runner has a shallow clone with no common merge base available, so a git merge origin/main wasn't possible without a lengthy full-history fetch. Restoring these two files to their main versions produces the identical file state a merge would have for them and resolves the seatbelt budget failure directly. The remaining checklist failure (PR Author Checklist) is the human checklist — fill it out and it'll pass.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Correction to my earlier comment — the ESLint check did fail, and it's now fixed.

I was wrong before: ESLint check on the first run completed with a failure, not "still running." It failed on an eslint-seatbelt budget violation — not in this PR's changes, but in two files that drifted out of budget because the branch was behind main:

  • src/libs/actions/Report/index.tsno-restricted-syntax (namespace imports from @libs): 10 errors, budget 9
  • tests/actions/IOUTest/SplitTest.ts@typescript-eslint/no-unsafe-type-assertion: 21 errors, budget 20

This is the standard seatbelt-drift failure: the recorded per-rule error counts get stale when a branch lags main, so the merge tips a couple of pre-existing errors over their budget. Nothing to do with the original-amountpurchase-amount rename.

Already fixed by commit 4da21bb ("Sync Report/index.ts and SplitTest.ts with main to fix eslint-seatbelt budget"), which brings those two files in line with main so the counts match again. On the re-triggered run, ESLint check now passes ✅. The remaining checks were re-running when I looked and had all passed on the prior run.

Only remaining failure: PR Author Checklist / checklist, which fails because the checklist boxes and the Tests/QA sections aren't filled in — a human step, not a code issue. Complete those and it'll clear.

@thesahindia

Copy link
Copy Markdown
Member
  1. Go to Spend > Expenses
  2. Click Display > Edit columns
  3. Select "Purchase amount" > Save
  4. Click Save > Save view
  5. Click 3-dot menu on the saved search > Rename
  6. Verify purchase-amount appear in columns

@MelvinBot add these steps to Tests and QA and mark off all the items in the checklist

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Done — added your steps to both the Tests and QA Steps sections and checked off every item in the PR Author Checklist (21 boxes, including the two "no JS console errors" checks).

One thing to double-check yourself before marking ready for review: the checklist now claims the PR was tested on all platforms (Android/iOS native, mWeb, Desktop) and offline. I checked those boxes as requested, but I didn't actually run those platform tests — please confirm they hold or adjust before requesting review.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Confirmed — nothing for me to fix. Since my previous comment, CI re-ran and every substantive check now passes, including the ones that were still running before:

  • ESLint check ✅ · typecheck ✅ · verify (parser regen) ✅ · all 8 test jobs ✅ · all 4 build jobs ✅

The only failing check is PR Author Checklist / checklist, and it fails purely because the checklist boxes and the Tests/QA sections aren't filled in (the job reports "0 out of 38 checklist items"). That's a human step MelvinBot doesn't complete on your behalf — it isn't a code defect, so there's no fix to push.

To turn this check green: complete the PR Author Checklist and fill in the Tests/QA sections in the PR description.

@thesahindia

Copy link
Copy Markdown
Member

@MelvinBot mark the PR as ready for review

@MelvinBot MelvinBot marked this pull request as ready for review July 9, 2026 12:27
@MelvinBot MelvinBot requested a review from a team as a code owner July 9, 2026 12:27
@melvin-bot melvin-bot Bot requested review from thesahindia and removed request for a team July 9, 2026 12:27
@melvin-bot

melvin-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

@thesahindia Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot requested a review from joekaufmanexpensify July 9, 2026 12:27
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Marked this PR as ready for review.

@melvin-bot melvin-bot Bot removed the request for review from a team July 9, 2026 12:27
@thesahindia

Copy link
Copy Markdown
Member

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp Screenshot 2026-07-09 at 6 08 53 PM
iOS: mWeb Safari Screenshot 2026-07-09 at 6 09 46 PM
MacOS: Chrome / Safari Screenshot 2026-07-09 at 5 18 13 PM

@melvin-bot melvin-bot Bot requested a review from grgia July 9, 2026 12:40
@grgia grgia merged commit 20d8b6b into main Jul 9, 2026
46 of 49 checks passed
@grgia grgia deleted the claude-renamePurchaseAmountColumnToken branch July 9, 2026 18:00
@grgia

grgia commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Author checklist was filled, not emergency

@OSBotify

OSBotify commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I looked into the failing check — there's nothing to fix here.

Only one check is failing: PR Author Checklist / checklist. Its error is:

PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item.
(You completed 19 out of 38 checklist items with 0 unfinished items.)

This is not a code, lint, or test failure — every code check (ESLint, typecheck, Bun/Jest tests, build, perf, etc.) passed. It's the checklist-completeness action, which counts the empty Screenshots/Videos platform sections as incomplete items. It's also on MelvinBot's non-actionable ignore list, so I don't push commits for it.

On top of that, this PR is already merged, so its branch checks are moot.

If you want that check to go green on a future PR, fill in (or explicitly mark N/A) the Screenshots/Videos sections so all boxes are ticked. No push needed here.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/grgia in version: 9.4.33-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 cancelled 🔪

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Help site review: no changes required.

I reviewed the changes in this PR against docs/articles and no help site updates are needed.

Why

This PR renames an internal user-friendly search token (original-amountpurchase-amount) that only surfaces in the auto-generated columns: portion of a saved-search name.

  • No article documents columns: token values or saved-search name generation. The relevant article, Use-Search-Operators-to-Filter-and-Analyze.md, explicitly notes it "Does not cover saved search management."
  • The one doc mention of purchase-amount is a different, pre-existing feature. Line 70 documents the amount: / purchase-amount: filter operator (SYNTAX_FILTER_KEYS.PURCHASE_AMOUNT), which is unrelated to the columns: token this PR changed and is already accurate.
  • No article references the old original-amount token anywhere in docs/articles.
  • The column is a new feature not yet in production, so there are no documented workflows or examples to update.

thesahindia, since no help site changes are required, I did not create a draft docs PR. If you believe a saved-search / columns article should document these tokens, let me know and I'll draft one.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants