Skip to content

[Due for payment 2026-10-28] [Follow-up] Per diem import silently fails when the workspace has no PerDiemInternational custom unit #101066

Closed

Description

@MelvinBot

Problem

A workspace can have arePerDiemRatesEnabled: true while having no PerDiemInternational custom unit. On those workspaces, per diem rates can never be added:

This is pre-existing, not introduced by #100956. That PR removes the never-resolving spinner on the same page, and was merged for urgency without waiting on this. Both symptoms come from the same workspace state.

Two things to answer

  1. Why do these workspaces exist? Find how a policy ends up with arePerDiemRatesEnabled: true and no PerDiemInternational custom unit — a backfill gap, an enable path that skips unit creation, or something else. This may need a backend fix rather than an App fix.
  2. Where should the unit get created? Provisioning on page render would write policy state from opening a read-only page, so the import itself looks like the right place. That needs a backend answer on whether ImportPerDiemRates can create the unit when the customUnitID doesn't exist yet, or whether the App must create it first.

At minimum, the silent return at ImportedPerDiemPage.tsx:122 should surface an error instead of doing nothing.

Steps to reproduce

  1. Open a workspace with Per diem enabled but no PerDiemInternational custom unit.
  2. Go to Workspace settings > Per diem.
  3. Open the More dropdown and pick Import spreadsheet.
  4. Upload a CSV with Destination / Subrate / Currency / Amount columns and map all four.
  5. Confirm the import. Nothing happens and no error appears.

Context

Follow-up requested by mountiny in #100956: #100956 (comment)

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. BartekObudzinski commented on Sep 14, 2026

    @BartekObudzinski
    Contributor

    Some policies come back with per diem enabled and no per diem custom unit. The request succeeds and the flag is true, but the custom units object contains only the distance unit. The page then has no rates to show. The import also cannot run, because it needs a custom unit ID that does not exist.

    We cannot reproduce this from the app. The only code that sets the flag creates the custom unit in the same call, and we confirmed that on a new workspace.

    Could someone from the backend side take a look at three things:

    1. What sets the flag on these policies without creating the custom unit?
    2. Can we create the missing unit for every policy already in this state? That would fix all the affected workspaces at once, and it is not covered by the follow-up issue.
    3. If that is not possible, does the import command create the custom unit itself when it receives a custom unit ID that does not exist yet?
  2. self-assigned this
    on Sep 14, 2026
  3. hungvu193 commented on Sep 15, 2026

    @hungvu193
    Contributor

    So when we copy the workspace settings, our Backend logic will set the per-diem enabled based on arePerDiemRatesEnabledfield (default to true). I think that's the RCA. Let me check why these logics were added at first place.

  4. BartekObudzinski commented on Sep 17, 2026

    @BartekObudzinski
    Contributor

    Hi @hungvu193 How the things are going?

  5. hungvu193 commented on Sep 17, 2026

    @hungvu193
    Contributor

    Hi @hungvu193 How the things are going?

    Sorry for the delay. I have limited avaibility this week. I'll try to raise a PR before EOW

  6. hungvu193 commented on Sep 21, 2026

    @hungvu193
    Contributor
  7. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    @hungvu193 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  8. 35 remaining items

  9. huult commented on Oct 22, 2026

    @huult
    Contributor
    Image

    This ticket will be paid at $250 because I was assigned to it on September 14.

  10. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Oct 27, 2026
  11. melvin-bot commented on Oct 27, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  12. melvin-bot commented on Oct 27, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  13. mallenexpensify commented on Oct 30, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @huult due $175 via NewDot

  14. JmillsExpensify commented on Nov 14, 2026

    @JmillsExpensify
    Contributor

    $175 approved for @huult

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 productionDailyKSv2Task

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions