App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-12-08] Report Title showing the report title formula instead of what the formulas should generate

Open m-natarajan opened this issue 9 months ago • 22 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: Reproducible in staging?: Needs Reproduction (Unable to reproduce) Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @AHowell14 Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Navigate to workspaces settings
  2. Select Reports and set the formula as {report:autoReporting:end}
  3. Navigate to Reports and observe the report title or create new report and observe

Expected Result:

Expected to see report titles as just dates

Actual Result:

Report titles are now showing as {report:autoReporting:end}

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

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

Screenshots/Videos

Image

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @huult

m-natarajan avatar Feb 05 '26 17:02 m-natarajan

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

melvin-bot[bot] avatar Feb 05 '26 17:02 melvin-bot[bot]

Triggered auto assignment to @JmillsExpensify (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 Feb 05 '26 17:02 melvin-bot[bot]

Not a bug, closed as explained here

neil-marcellini avatar Feb 05 '26 17:02 neil-marcellini

Issue reproduced here https://expensify.slack.com/archives/C049HHMV9SM/p1794591404003189 and reopening

m-natarajan avatar Nov 16 '26 18:11 m-natarajan

Proposal

What is the root cause of that problem?

Report titles come from the server, and the server leaves {report:autoReporting:...} as raw text whenever the workspace has no submission schedule. The server checks this rule only when the title is saved. So turning Submissions off later (or setting Instantly, Daily or Manually) re-titles every open report with the raw formula.

I ran it on a local build against staging, on a Control workspace:

  1. Workflows: Submissions on, Weekly. Reports: set the default report title to {report:autoReporting:end}. Spend > Reports shows 2026-11-22 for the open reports.
  2. Workflows: turn Submissions off. Spend > Reports now shows {report:autoReporting:end} for every open report (13 of 13), and a new report gets it too (1 of 1). With Manually instead of Submissions off, new reports get it as well (3 of 3).
  3. Turn Submissions back on: the dates come back (3 of 3 off/on rounds). So it's the server re-titling the reports each time.
  4. With no schedule, saving the title fails: SetPolicyDefaultReportTitle answers "Formula field {report:autoReporting:start} not recognized". It's accepted with Weekly, Twice a month, Monthly and By trip. A new workspace starts with no schedule, so on staging the issue's steps alone stop at this error. The raw titles appear once the schedule is removed after the title was saved.

The app evaluates the same formula itself, and for these frequencies it uses today's date: https://github.com/Expensify/App/blob/b60dd886eee658e59bae18b0c1e8b942e24e2b26/src/libs/Formula.ts#L863-L924 A new report shows that date until the CreateAppReport response replaces it with the raw formula (3 of 3). Meanwhile, the app changes the schedule without looking at the title formula: https://github.com/Expensify/App/blob/b60dd886eee658e59bae18b0c1e8b942e24e2b26/src/pages/workspace/workflows/tabs/WorkflowsSubmissionsTab.tsx#L49-L58 https://github.com/Expensify/App/blob/b60dd886eee658e59bae18b0c1e8b942e24e2b26/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx#L91-L115

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

Backend (needs an internal engineer): evaluate autoReporting when there is no schedule, the way the app already does (today's date), or reject removing the schedule while the title uses it. This is the only fix for workspaces that are already in this state.

App, so admins can't get into this state and can see it when they're already in it:

  1. Submissions toggle and frequency page: if the default report title uses {report:autoReporting:...} and the change leaves no schedule (Submissions off, or Instantly, Daily or Manually), don't apply it. Instead, show an error that names the formula. This is the same rule the server applies when the title is saved.
  2. Reports settings: show the same message under "Default report title" when the workspace is already in that state, so the admin knows to change the title or the schedule.
  3. Default report title page: check this rule before saving, so the error shows right away (also offline) instead of after the server rejects it.

All three use a small helper that parses the formula with Formula.parse and returns the autoReporting parts. getUnsupportedReportFieldFormulaParts already parses formulas this way for report fields.

https://github.com/user-attachments/assets/fa0e9d7c-9df0-43e1-9fc6-be053a01ef48

What alternative solutions did you explore? (Optional)

  • Keep the app's computed title when the server returns a raw formula: the server's name is what Expensify Classic, exports and other devices show, so the app would disagree with them, and reports that already have the raw title would stay wrong.
  • Stop treating autoReporting as a supported formula part in the app: it works while submissions are on a schedule, so this would break workspaces where it is correct today.

laveshfonix avatar Nov 16 '26 19:11 laveshfonix

🤖 ProposalPolice™ is tracking duplicate proposals for this issue using an OpenAI Conversation. This comment stores that Conversation's ID and can be safely ignored.

github-actions[bot] avatar Nov 16 '26 19:11 github-actions[bot]

Proposal

What is the root cause of that problem?

I reproduced this on staging with a new Control workspace and default report title {report:autoReporting:end}:

  • Submissions on, Weekly: a new report is titled 2026-11-22.
  • Submissions turned off: that same report and a new one both become {report:autoReporting:end}.

The backend part is covered in the proposal above. One app-side cause is not covered there: getAutoReportingDates in src/libs/Formula.ts only reads policy.autoReportingFrequency and never checks policy.autoReporting (the Submissions toggle). When Submissions is turned off, the saved frequency stays weekly, so the app still calculates the weekly period end for the optimistic title, while the server treats the workspace as having no schedule. The app and the server disagree for the most common path, the Submissions toggle, not only for Instantly / Daily / Manually.

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

Keep schedule changes allowed and give autoReporting a clear meaning when there is no schedule, instead of blocking the change:

  1. App: in getAutoReportingDates, return the "no schedule" result whenever policy.autoReporting is false (this is what the Submissions toggle sets in setWorkspaceAutoHarvesting, while autoReportingFrequency is left as is) or the frequency means there is no schedule (Instantly / Daily / Manually), not only when the frequency is missing.
  2. "No schedule" result: use the report's own expense date range (oldest and newest expense date, falling back to the report created date). The app already does this for the Trip frequency, so the same branch can be reused. This gives each report a meaningful title (all expenses from one day give that day) instead of every open report showing today's date.
  3. Backend (internal): apply the same rule, so the server title matches the app and the raw formula never shows. Existing reports are fixed the next time the server re-titles them, which it already does when the schedule changes.
  4. Unit tests in Formula for: Submissions off with Weekly saved, Manually, and Instantly.

What alternative solutions did you explore? (Optional)

Using today's date for the "no schedule" case: simpler, but every open report on the workspace would get the same title and it changes every day, which is confusing for drafts that stay open.

rcn948 avatar Nov 17 '26 02:11 rcn948

📣 @rcn948! 📣 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 17 '26 02:11 melvin-bot[bot]

Question for the maintainers before putting together a proposal: the proposals above describe an app-side cause (the {report:autoReporting:end} title rule interacting with workspace submission settings) plus a server-side piece (report titles stored server-side, rule checked only at save, so existing titles keep the raw formula).

Could you clarify what the external, paid scope of this issue covers - the app-side fix alone, or also the server-side title-generation change? If the server-side change is required but outside external scope, better to know that before proposing.

sofakingmc0804 avatar Nov 17 '26 03:11 sofakingmc0804

📣 @sofakingmc0804! 📣 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 17 '26 03:11 melvin-bot[bot]

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

rcn948 avatar Nov 17 '26 03:11 rcn948

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

melvin-bot[bot] avatar Nov 17 '26 03:11 melvin-bot[bot]

⚠️ @rcn948 Thanks for your interest. To be considered for this job, please post a proposal following the proposal template (note the mandatory sections). Comments claiming the job without one are not reviewed.

github-actions[bot] avatar Nov 17 '26 03:11 github-actions[bot]

🚨 Edited by proposal-police: This proposal was edited at 2026-11-17 05:31:47 UTC.

Proposal

What is the root cause of that problem?

Disabling Submissions sets policy.autoReporting to false but keeps the saved reporting frequency. getAutoReportingDates() only checks that frequency, so it can still calculate a Weekly reporting period even though Submissions is off.

There is also a server-side problem: when no reporting period exists, the title generator leaves {report:autoReporting:start} or {report:autoReporting:end} unresolved. That literal text becomes the report’s stored name, which the App displays. Fixing only the optimistic calculation would not prevent the server response from replacing it.

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

Use the report’s expense dates when there is no reporting period, with the same behavior in the App and backend.

In Formula.ts, update getAutoReportingDates() to use the existing earliest/latest expense-date calculation when Submissions is disabled or the frequency is Instant or Immediate. Daily and Manual both use Immediate internally, with different harvesting settings. Keep the existing calculations for active Weekly, Twice a month, Monthly, and By trip settings.

Reuse the existing transaction helpers so optimistic additions, edited dates, and pending deletions are included correctly. If the report has no eligible expenses, fall back to today, matching the existing By trip behavior. Preserve date-only expense values as calendar dates so they do not shift to the previous day in timezones west of UTC.

On the backend, apply the same fallback in title evaluation and validation. Reuse the existing title-recalculation path to correct affected formula-managed reports, while preserving manually entered names and the existing rules for finalized reports. This requires a coordinated backend change; an App-only fix is insufficient.

I would verify:

  • Disabling Submissions with a Weekly frequency saved.
  • Instant, Daily, and Manual settings.
  • Empty reports and reports with one or several expense dates.
  • Adding, editing, and deleting the earliest/latest expense offline, including failed requests and reconnect.
  • Date-only expenses across timezones.
  • Restoring an active schedule, preserving manual names, and correcting existing literal titles.

What alternative solutions did you explore? (Optional)

Blocking schedule changes would prevent some new cases but would not repair existing reports. Replacing the title only during rendering would leave the stored name incorrect and could make exports and other clients show different names.

gesh1518 avatar Nov 17 '26 04:11 gesh1518

📣 @gesh1518! 📣 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 17 '26 04:11 melvin-bot[bot]

@huult, My proposal addresses both parts of the issue: the client calculating dates from a disabled schedule and the backend saving the unresolved formula as the report title. It keeps the change small by reusing the existing expense-date calculation, with matching behavior on both sides.

I’ve attached before-and-after recordings showing the behavior working in my test environment. Please take a look and let me know if anything else needs clarification.

Before:

https://github.com/user-attachments/assets/419e7bea-3e61-421d-a0d8-d0ada1e697ca

After:

https://github.com/user-attachments/assets/9236ba19-36a2-4ce7-9d4a-a0b0ae0f1ab8

gesh1518 avatar Nov 17 '26 07:11 gesh1518

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

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

The auth PR is still in progress

huult avatar Nov 24 '26 01:11 huult

The App PR is ready for review, the backend PR is on production.

  • https://github.com/Expensify/App/pull/107028#top

neil-marcellini avatar Nov 24 '26 23:11 neil-marcellini

The App PR is ready for review, the backend PR is on production.

Since the PR for this ticket is ready for review, I’ve changed the priority to Weekly and removed the Help Wanted label.

huult avatar Nov 25 '26 02:11 huult