App icon indicating copy to clipboard operation
App copied to clipboard

[$175] Spend - Category field not displayed on expense thread when delete workspace

Open applause-bot[bot] opened this issue 6 days ago • 13 comments

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


Version Number: 9.5.54-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/177732410/folder/57600458 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: windows 10/chrome App Component: Other

Action Performed:

  1. Create workspace
  2. Create manual expense with category
  3. Go to Spend and verify category field is displayed when open expense thread
  4. Delete the workspace
  5. Go to Spend and open the expense thread

Expected Result:

Category field should be displayed

Actual Result:

Category field is not displayed in expense thread, It is only displayed on category column

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/c19d999d-da25-4f28-8d58-80686ba91b81

View all open jobs on GitHub

Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7324366

Upwork Automation - Do Not Edit

applause-bot[bot] avatar Nov 25 '26 19: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/c17aeae5397b1c2f0cb759637d609220af41e8c3e8f45808d26ea9ee4250ee6d

applause-bot[bot] avatar Nov 25 '26 19:11 applause-bot[bot]

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

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

🤖 Web test steps verification results: ✅ pass

Reproduced issue 108028 on dev NewDot web. After workspace deletion, Spend retains Advertising, but the reopened expense thread no longer shows a Category field.

Same expense in Spend still displaying Advertising
Step Status
1. Create a workspaceCreated a Collect workspace.
✅
2. Create a manual expense with a categoryCreated a $12.34 expense categorized as Advertising.
✅
3. Open from Spend and confirm thread CategoryBoth Spend and the expense thread displayed Advertising before deletion.
✅
4. Delete the workspaceDeletion completed; the Workspaces screen showed “No workspaces yet.”
✅
5. Reopen the expense and compare Category — proposal and evidenceThe reopened thread omitted Category, while Spend still displayed Advertising.
Reopened expense after deletion with Category field absent
Same expense in Spend still displaying Advertising

Proposal

What is the root cause of that problem?

Medium confidence: the thread’s Category visibility depends on workspace classification, even when an expense already has a category. The visibility condition hides the row when neither the workspace nor unreported-expense branch qualifies. Workspace classification depends on the current policy type. Spend instead renders its transaction’s category directly. The UI discrepancy is reproduced; the exact post-deletion policy and canonical transaction values were not inspected.

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

After confirming the thread’s transaction retains its category, make a nonmissing stored category independently sufficient to display the row. Preserve existing rules for empty fields and editing permissions. Add regression coverage for deleted-policy expenses, direct reopening, empty categories, and read-only behavior.

What alternative solutions did you explore? (Optional)

Restoring deleted workspace metadata is unnecessary for displaying a historical value. Category-data loss remains an alternative to exclude: Spend and the thread can read different transaction sources, so the retained Spend value alone does not conclusively rule it out.
✅

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


view run · view recording

MelvinBot avatar Nov 25 '26 20:11 MelvinBot

Proposal

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

After the workspace is deleted, opening an expense thread (from Spend) no longer shows the Category row, even though the expense still has a category and the Spend Category column still displays it.

What is the root cause of that problem?

MoneyRequestView decides whether this is a workspace expense purely from the policy object's type in Onyx:

https://github.com/Expensify/App/blob/384aa905484e6a7818870d38254484b74d14138a/src/components/ReportActionItem/MoneyRequestView.tsx#L314-L316

const [reportPolicyType] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${moneyRequestReport?.policyID}`, {selector: policyTypeSelector});
const isPolicyExpenseChat = isGroupPolicyByType(reportPolicyType);

When the workspace is deleted, deleteWorkspace marks the policy as pending delete and the backend then removes the policy from Onyx (https://github.com/Expensify/App/blob/384aa905484e6a7818870d38254484b74d14138a/src/libs/actions/Policy/Policy.ts#L493-L501). From that point reportPolicyType is undefined, so isPolicyExpenseChat becomes false for an expense that still lives on a (now archived) workspace expense report.

The Category visibility condition then fails on both branches (not policy expense chat, not unreported), so the row is hidden even though categoryForDisplay is non-empty:

https://github.com/Expensify/App/blob/384aa905484e6a7818870d38254484b74d14138a/src/components/ReportActionItem/MoneyRequestView.tsx#L553-L555

Spend is unaffected because its Category cell renders the transaction's category directly, without looking up the policy.

The same wrong isPolicyExpenseChat = false also hides the other workspace-only fields that the expense already has values for (Tag at L557, Billable at L563, Tax via isTaxTrackingEnabled at L632), so this is broader than Category.

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

Don't rely only on the policy still existing in Onyx to classify the expense. Fall back to the report's own data, which survives workspace deletion: the parent money-request report is an expense report (type: expense), and expense reports only exist on workspaces. isExpenseReport is already imported in this file.

  • Compute isPolicyExpenseChat as "policy type is a group policy OR the parent report is an expense report" (isExpenseReport(moneyRequestReport)).
  • With that, the existing categoryForDisplay check shows the stored category; since the deleted policy has no categories, an empty category still stays hidden, and editing remains blocked by the existing canEdit / archived-report rules.
  • Apply the same fix to the Tag / Billable / Tax rows that share this flag so their existing values also remain visible.

What specific scenarios should we cover in automated tests?

  • Render MoneyRequestView for an expense on an expense report whose policy is missing from Onyx (deleted workspace) with a category set → Category row is shown with the value and is not editable.
  • Same setup with an empty category → Category row is hidden.
  • Same setup with a tag set → Tag row is shown.
  • Normal workspace expense with the policy present → behaviour unchanged.

What alternative solutions did you explore? (Optional)

  • Only making a non-empty category sufficient on its own (MelvinBot's suggestion). That fixes Category but would also start showing a category row on non-workspace (P2P/IOU) expenses if one is ever set, and leaves Tag/Billable/Tax hidden after deletion. Fixing the classification at its source is narrower and covers all affected fields.
  • Reading the policy type from the deleted policy's data — not possible, since the policy is removed from Onyx.

How this differs from MelvinBot's proposal: Melvin marks the root cause as medium confidence and doesn't identify why the condition fails. The actual cause is that isPolicyExpenseChat is derived only from the policy's type, which is gone after workspace deletion. Fixing that one flag restores Category and also Tag/Billable/Tax, which Melvin's proposal doesn't cover.

Contributor details

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

akzkid avatar Nov 25 '26 20:11 akzkid

Proposal

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

When an expense with a category is created on a workspace and that workspace is subsequently deleted, navigating to the Spend page correctly displays the category name in the Category column of the table. However, when the user clicks to open the expense details thread, the Category field is completely absent from the view.

What is the root cause of that problem?

In src/components/ReportActionItem/MoneyRequestView.tsx (lines 314–316):

const [reportPolicyType] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${moneyRequestReport?.policyID}`, {selector: policyTypeSelector});
// Collect/Control (group) policies are always tied to an expense chat, so a group policy type means this is a policy expense chat.
const isPolicyExpenseChat = isGroupPolicyByType(reportPolicyType);

And in lines 553–555:

const shouldShowCategory =
    (isPolicyExpenseChat && (categoryForDisplay || hasEnabledOptions(policyCategories ?? {}))) ||
    (isExpenseUnreported && (!policyForMovingExpenses || hasEnabledOptions(policyCategories ?? {})));

When a workspace is deleted:

  1. The workspace policy ${ONYXKEYS.COLLECTION.POLICY}${policyID} is removed from the local Onyx store.
  2. reportPolicyType resolves to undefined.
  3. isGroupPolicyByType(undefined) evaluates to false, causing isPolicyExpenseChat to become false.
  4. isExpenseUnreported is also false because the expense is filed on an expense report (moneyRequestReport.type === CONST.REPORT.TYPE.EXPENSE).
  5. In shouldShowCategory, both sides of the || condition evaluate to false:
    • (false && (categoryForDisplay || ...)) evaluates to false.
    • (false && ...)) evaluates to false.
  6. As a result, shouldShowCategory evaluates to false.

Even though the underlying transaction in Onyx retains its historical category (transaction.category = 'Advertising'), and CategoryCell.tsx on the Spend table displays it because it reads transaction?.category directly without relying on policy lookup, MoneyRequestView.tsx completely omits the Category MenuItem because shouldShowCategory is false.

Furthermore, this same failure to identify the parent report as a workspace expense report affects tag and billable visibility on lines 557 and 563:

const shouldShowTag = (isPolicyExpenseChat || isExpenseUnreported) && (transactionTag || (canEdit && policyHasEnabledTags));
const shouldShowBillable = (isPolicyExpenseChat || isExpenseUnreported) && (!!transactionBillable || isBillableEnabledOnPolicy(policy) || !!updatedTransaction?.billable);

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

1. Derive isPolicyExpenseChat from both policy type and parent report type

In src/components/ReportActionItem/MoneyRequestView.tsx (line 316):

// Collect/Control (group) policies are always tied to an expense chat, so a group policy type means this is a policy expense chat.
// If the workspace was deleted, the policy is removed from Onyx, but the parent moneyRequestReport retains type: 'expense'.
const isPolicyExpenseChat = isGroupPolicyByType(reportPolicyType) || isExpenseReport(moneyRequestReport);

Note: isExpenseReport is already imported in MoneyRequestView.tsx at line 95.

Why this completely solves the issue with zero regressions:

  1. Accurate expense report identification: Every expense report (type: 'expense') originates from a workspace policy and survives workspace deletion. Even after the policy is expunged from Onyx, isExpenseReport(moneyRequestReport) remains true.
  2. Category display restored: Since isPolicyExpenseChat is true and categoryForDisplay is non-empty ('Advertising'), shouldShowCategory evaluates to true, correctly rendering the Category row.
  3. Empty categories remain hidden: If the expense never had a category (categoryForDisplay === ''), hasEnabledOptions(policyCategories ?? {}) evaluates to false (since policyCategories is empty/undefined), ensuring an empty Category row is never shown unnecessarily.
  4. Read-only protection: When the workspace is deleted, policy is undefined, so canEdit evaluates to false. The row cleanly renders as a read-only field displaying the historical category name without showing interactive chevrons or edit links.
  5. Preserves Tag and Billable fields: Existing tags (transactionTag) and billable indicators on deleted workspaces are also preserved seamlessly.
  6. No impact on personal IOUs: For P2P / 1:1 IOU requests, moneyRequestReport.type === CONST.REPORT.TYPE.IOU, so isExpenseReport(moneyRequestReport) evaluates to false, maintaining standard P2P behavior.

What alternative solutions did you explore (Optional)?

We explored making !!categoryForDisplay independently sufficient in shouldShowCategory:

const shouldShowCategory =
    !!categoryForDisplay ||
    (isPolicyExpenseChat && hasEnabledOptions(policyCategories ?? {})) ||
    (isExpenseUnreported && (!policyForMovingExpenses || hasEnabledOptions(policyCategories ?? {})));

While this also restores category visibility, deriving isPolicyExpenseChat from isExpenseReport(moneyRequestReport) is more architectural because it addresses the root cause at the classification level, properly restoring Tag and Billable fields as well without modifying multiple separate condition trees.

Automated Tests?

Yes, added automated component test in tests/ui/MoneyRequestViewTest.tsx:

npm test -- tests/ui/MoneyRequestViewTest.tsx

Test scenario:

  • Renders MoneyRequestView for an expense on a report with type: CONST.REPORT.TYPE.EXPENSE whose policy has been deleted (Onyx.set(policy, null)).
  • Asserts that fieldLabel('common.category') is present on the screen and displays the stored transaction category.
  • Asserts that for an expense report with no category set and deleted policy, the category field is omitted.

kevinjosh10 avatar Nov 26 '26 04:11 kevinjosh10

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

kevinjosh10 avatar Nov 26 '26 05:11 kevinjosh10

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

melvin-bot[bot] avatar Nov 26 '26 05:11 melvin-bot[bot]

Proposal

What is the root cause of that problem?

MoneyRequestView decides "is this a workspace expense?" only from the workspace's type in Onyx:

https://github.com/Expensify/App/blob/c0604399d893869f81bf3bf222be9f0222ffca60/src/components/ReportActionItem/MoneyRequestView.tsx#L314-L316

After the workspace is deleted and the server confirms it, policy_<id> no longer has a type. So reportPolicyType is undefined and isPolicyExpenseChat is false. Before the server confirms, the policy is still in Onyx with pendingAction: delete (Policy.ts L494-L501), which is why the row only disappears after the delete completes.

The Category row needs either isPolicyExpenseChat or an unreported expense:

https://github.com/Expensify/App/blob/c0604399d893869f81bf3bf222be9f0222ffca60/src/components/ReportActionItem/MoneyRequestView.tsx#L553-L555

The expense is on an expense report, so it is not unreported. Both branches are false and the row is hidden, even though transaction.category is still set. The Spend table shows it because CategoryCell reads transaction.category directly.

Two things the flag does not fully explain:

  • Tag: even with the flag fixed, Tag rows are built by mapping policyTagLists (L541, L1218-L1224). If the deleted workspace's tag list is no longer loaded, that list is empty and no Tag row renders, whatever shouldShowTag says.
  • Tax: not affected. The Tax row already shows when the expense has a tax code, through shouldShowTaxDisabledAlert (L632-L634).

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

  1. Classify from the report, not only the policy. An expense report (type: expense) only exists on a workspace, and it survives workspace deletion. parentReport also falls back to the Spend results (L240-L241), so it is there when the thread is opened from Spend.

    isPolicyExpenseChat = isGroupPolicyByType(reportPolicyType) || isExpenseReport(moneyRequestReport)
    

    This brings back Category (and Billable, if set) as read-only rows. An empty category stays hidden when the deleted workspace's category list is gone (hasEnabledOptions is false). Editing stays blocked by the existing canEdit rules for archived reports.

  2. Keep "please fix this" checks on the live workspace. The same flag turns on the "missing merchant" error (L850). After delete, nobody can edit the expense, so that error would be a dead end. Use isGroupPolicyByType(reportPolicyType) there, as violations already do (L627).

  3. Show the stored tag when the tag list is gone. The file already has a single read-only "Tag" row that shows the full tag when the expense's tag lists are not usable (L538-L544). Also use it when the expense has a tag but its workspace tag list is empty:

    shouldShowFullTransactionTag = (existing condition) || (!!transactionTag && isEmptyObject(policyTagList))
    

    canEditTag already turns off for this row, so it stays read-only.

Tests (tests/ui/MoneyRequestViewTest.tsx), expense on an expense report with the policy removed from Onyx:

  • Category set: the Category row shows the value and has no edit chevron.
  • No category: no Category row.
  • Tag set and no tag list in Onyx: one read-only "Tag" row with the full tag.
  • No merchant: no "missing merchant" error.
  • Policy still in Onyx with pendingAction: delete: Category row shows (unchanged).
  • Parent report only in the Spend results, not in Onyx: Category row shows.
  • Normal workspace expense and P2P IOU expense: unchanged.

What alternative solutions did you explore? (Optional)

  • A stored category alone shows the row (MelvinBot): fixes Category only. Tag and Billable stay hidden, and the classification stays wrong for the rest of the view.
  • Only change isPolicyExpenseChat (the other proposals): fixes Category and Billable, but Tag still does not render when the tag list is gone, and it adds a "missing merchant" error the user cannot fix.
  • Keep the deleted policy in Onyx: the server owns that data. Showing a value the expense already stores should not depend on it.

mattlsyyssll avatar Nov 26 '26 07:11 mattlsyyssll

Proposal

What is the root cause of that problem?

In src/components/ReportActionItem/MoneyRequestView.tsx (lines 314–316), workspace classification depends solely on the policy object still existing in Onyx:

  • reportPolicyType is read from ${ONYXKEYS.COLLECTION.POLICY}${moneyRequestReport?.policyID}.
  • isPolicyExpenseChat is computed as isGroupPolicyByType(reportPolicyType).

Once a workspace is deleted and confirmed by the server, policy_<policyID> is removed from Onyx, so reportPolicyType becomes undefined and isPolicyExpenseChat evaluates to false. Because the expense still belongs to an expense report (moneyRequestReport.type === CONST.REPORT.TYPE.EXPENSE), isExpenseUnreported is also false.

As a result, shouldShowCategory (lines 553–555) evaluates to false even though transaction.category (categoryForDisplay) is still populated. By contrast, Spend's CategoryCell renders transaction.category directly without requiring the policy object, causing the mismatch between Spend and the expense thread.

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

  1. Preserve historical Category visibility for deleted-workspace expense reports without altering unrelated isPolicyExpenseChat semantics.
    • In src/components/ReportActionItem/MoneyRequestView.tsx, keep isPolicyExpenseChat tied to live group policies so downstream policy-dependent calculations (such as getDisplayTransactionWithoutInvalidCommuterExclusion at L330, shouldShowReimbursable at L566, and commuterExclusionData at L676) do not unexpectedly flip on when policy is undefined.
    • Update shouldShowCategory (lines 553–555) to also display the read-only Category row when the parent report is an expense report (isExpenseReport(moneyRequestReport), already imported in MoneyRequestView.tsx) and categoryForDisplay is non-empty:
      • Active workspace expense: shows when categoryForDisplay is set or enabled policyCategories exist (unchanged).
      • Deleted workspace expense report: shows the historical categoryForDisplay value; since policy is gone and the report is archived (canEdit is false), the row renders read-only with copy support (MenuItem.Copy) and does not trigger showCategoryDisabledAlert().
  2. Add a unit test verifying that MoneyRequestView renders the Category field with the transaction's category value when moneyRequestReport is an expense report whose policy has been deleted from Onyx (undefined), while keeping it non-editable.

What alternative solutions did you explore? (Optional)

  • Changing isPolicyExpenseChat itself to isGroupPolicyByType(reportPolicyType) || isExpenseReport(moneyRequestReport): concise, but isPolicyExpenseChat feeds multiple other paths in MoneyRequestView that assume a live workspace policy (getDisplayTransactionWithoutInvalidCommuterExclusion, shouldShowReimbursable, commuterExclusionData, and isTaxTrackingEnabled). Scoping the fallback directly to shouldShowCategory (with !!categoryForDisplay) avoids unintended side effects on deleted workspaces while cleanly restoring the missing Category row.

ductai05 avatar Nov 26 '26 14:11 ductai05

Proposal

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

When an expense with a category is submitted on a workspace and that workspace is subsequently deleted, opening the expense from Reports > Expenses no longer displays the Category field (as well as other stored workspace-expense metadata like Tag / Billable) in MoneyRequestView.

What is the root cause of that problem?

In src/components/ReportActionItem/MoneyRequestView.tsx (lines 314–316), workspace-expense field visibility is gated on isPolicyExpenseChat:

const reportPolicyType = moneyRequestReport?.policyType ?? policy?.type;
const isPolicyExpenseChat = isGroupPolicyByType(reportPolicyType);

After a workspace is deleted, policy (ONYXKEYS.COLLECTION.POLICY_${policyID}) is removed/inaccessible and moneyRequestReport.policyType is undefined, while the expense report itself remains an expense report (moneyRequestReport.type === CONST.REPORT.TYPE.EXPENSE / isExpenseReport(moneyRequestReport) === true) and the transaction still retains its stored category (categoryForDisplay), tag (transactionTag), and billable (transactionBillable).

Because isPolicyExpenseChat evaluates to false:

  1. shouldShowCategory (line 556: isPolicyExpenseChat && (hasEnabledOptions || !!categoryForDisplay)) becomes false, hiding the stored category.
  2. Similarly, stored read-only workspace metadata on the same deleted-workspace expense is suppressed: for Tag (lines 539–562), policyTagLists (getTagLists(policyTagList)) is empty ([]) once POLICY_TAGS_${policyID} is purged, so shouldShowFullTransactionTag evaluates to false even if isPolicyExpenseChat were true, and shouldShowBillable (line 564) also checks isPolicyExpenseChat.

Crucially, broadening isPolicyExpenseChat itself to || isExpenseReport(moneyRequestReport) when policy is undefined causes regressions across MoneyRequestView.tsx:

  • Line 850 (merchant error check): !isSettled && !isCancelled && isPolicyExpenseChat && isEmptyMerchant triggers a false, unfixable "Missing merchant" RBR error on unsettled historical expenses from a deleted workspace.
  • Line 566 (shouldShowReimbursable): canShowReimbursableToggleForPolicy(undefined, true, ...) alters reimbursable visibility.
  • Line 676 (commuterExclusionData): runs getDisplayTransactionWithoutInvalidCommuterExclusion with policy: undefined.

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

  1. Keep isPolicyExpenseChat unchanged (isGroupPolicyByType(reportPolicyType)) so active-policy validation (merchant RBR at line 850, shouldShowReimbursable at line 566, commuterExclusionData at line 676, and canEdit*) is completely unaffected when policy is deleted.
  2. Introduce a narrow read-only fallback const isDeletedWorkspaceExpenseReport = !isPolicyExpenseChat && isExpenseReport(moneyRequestReport); in src/components/ReportActionItem/MoneyRequestView.tsx:
    • Category (line 556):
      const shouldShowCategory =
          (isPolicyExpenseChat && (hasEnabledOptions || !!categoryForDisplay)) ||
          (isDeletedWorkspaceExpenseReport && !!categoryForDisplay);
      
    • Disabled-category alert guard (line 559): Guard const shouldShowCategoryDisabledAlert = !!policy && !policy.areCategoriesEnabled && !!category; so a missing/deleted policy object is never treated as "categories disabled on active policy".
    • Tag & Billable (lines 562–564): Preserve stored non-empty transactionTag (bypassing empty policyTagLists when the workspace's POLICY_TAGS collection was deleted) and explicit transactionBillable (policy?.disabledFields?.defaultBillable !== true && transactionBillable) when isDeletedWorkspaceExpenseReport is true.
  3. Add unit/component tests in tests/ui/MoneyRequestView.tsx (or MoneyRequestViewTest) verifying that on an expense report whose workspace policy has been deleted (policy === undefined, moneyRequestReport.policyType === undefined):
    • Stored category (and stored tag / billable when present) renders as read-only (canEdit === false, no disabled-category alert).
    • Empty category stays hidden.
    • Unsettled expenses with an empty merchant on a deleted workspace do not show a false Missing merchant RBR error.

What alternative solutions did you explore? (Optional)

  • Changing isPolicyExpenseChat = isGroupPolicyByType(reportPolicyType) || isExpenseReport(moneyRequestReport) globally: rejected because isPolicyExpenseChat drives active-policy validation rules (Missing merchant error at line 850, canShowReimbursableToggleForPolicy at line 566, and commuter exclusion handling at line 676) that assume a live group policy.

khoap1220-hue avatar Nov 28 '26 18:11 khoap1220-hue

@MelvinBot Please add your proposal. I can't see it in the comments.

jayeshmangwani avatar Nov 29 '26 04:11 jayeshmangwani

My proposal was buried inside a collapsed test-results row. Reposting it here as a standalone comment.

Proposal

What is the root cause of that problem?

Medium confidence: The expense thread’s Category visibility depends on workspace classification, even when the expense already has a stored category. After workspace deletion, that classification can fail, hiding the Category row. Spend displays the transaction’s category independently.

Code references and verification limits

The earlier web verification reproduced the discrepancy, but did not inspect the thread’s underlying transaction after deletion. Spend retaining its category alone does not establish that both views have identical transaction data.

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

First confirm that the thread’s transaction retains its category after workspace deletion. If confirmed, make a nonempty stored category sufficient to display the Category row without requiring the deleted workspace’s metadata.

Keep existing empty-field behavior and editing restrictions unchanged. Scope the change to Category visibility rather than changing shared workspace classification.

Regression coverage should include:

  • Deleted workspace with a stored category: value remains visible and read-only.
  • Deleted workspace without a category: no empty Category row.
  • Reopening directly and through Spend.
  • Existing workspace and personal-expense behavior.

What alternative solutions did you explore? (Optional)

Restoring deleted workspace metadata should not be necessary to display a historical value. Broadening shared workspace classification would require auditing its other consumers for unintended behavior changes.


Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/108028) to create a draft PR, subject to confirming the transaction-data prerequisite above.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin’s proposal.


view run

MelvinBot avatar Nov 29 '26 05:11 MelvinBot