fix: pass workspace policyID only for GL-code export templates#94389
Draft
aswin-s wants to merge 1 commit into
Draft
fix: pass workspace policyID only for GL-code export templates#94389aswin-s wants to merge 1 commit into
aswin-s wants to merge 1 commit into
Conversation
Account-level export templates have policyID undefined by design. The previous fix (Expensify#92131) attached the selection's workspace policyID to every account-level template, which broke file generation for plain {expense:category}/{expense:tag} templates (deploy blocker Expensify#93088). Scope the workspace policyID fallback to templates that actually reference GL codes (a :glcode column). GL-code templates get the policyID they need to resolve codes (fixes Expensify#89388); plain templates keep policyID undefined and remain on the original working path.
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
This re-raises #92131 (reverted in #93091) with a narrowed scope so it $ #89388 without re-introducing deploy blocker #93088.
Account-level export templates have
policyID: undefinedby design (returned bygetExportTemplates). #92131 attached the selection's workspacepolicyIDto every account-level template. The backend only needs a workspacepolicyIDto resolve GL codes (e.g.{expense:category:glcode}); for plain{expense:category}/{expense:tag}account-level templates, sending apolicyIDmade the backend fail to generate the file — the optimistic "Export in progress" message showed but nothing reached Concierge (#93088).This PR scopes the workspace
policyIDto only templates that reference GL codes (a column containing:glcode):policyID($ [$250] Custom Export Template Truncates GL Codes in New Expensify Compared to Classic #89388).{expense:category}/{expense:tag}templates → keeppolicyID: undefined, staying on the original working path → Export - Custom export template file is not delivered to Concierge #93088 cannot recur.Changes:
src/libs/actions/Search.ts: new exported helperdoesExportTemplateRequireWorkspacePolicy(template)—trueonly when a column contains the GL-code marker.src/hooks/useSearchBulkActions.ts: bulk path resolves the workspacepolicyIDonly when the template requires GL codes. The multi-workspace guard is preserved — it falls back to the selection's workspace only when every selected transaction belongs to a single real workspace, otherwisepolicyIDis left undefined.src/hooks/useExportActions.ts: single-report path falls back tomoneyRequestReport.policyIDonly for GL-code templates.src/types/onyx/ExportTemplate.ts: addedcolumns?: string[](already present at runtime).src/CONST/index.ts: added the:glcodecolumn marker constant.Fixed Issues
$ #89388
PROPOSAL: #89388 (comment)
Tests
Preconditions:
{expense:category:glcode}or{expense:tag:glcode}— call this the GL-code account template.{expense:category}/{expense:tag}columns (no:glcode) — call this the plain account template.A. GL-code account template — bulk path (
useSearchBulkActions):QueueExportSearchWithTemplaterequest body —policyIDis present and matches the workspace ID.policyIDis intentionally absent; GL codes may be unresolved by design for multi-workspace selections).B. Plain account template — bulk path (regression guard for #93088): 5. Select expenses on the same workspace and Export using the plain account template. 6. Verify the file is delivered to Concierge (does not silently fail). 7. (Definitive) Inspect the
QueueExportSearchWithTemplaterequest —policyIDis absent.C. Workspace template — bulk path: 8. Select expenses and Export using the workspace template. 9. Verify the file is delivered (
policyIDpresent = the template's own workspace ID — unchanged behavior).D. Single-report path (
useExportActions): 10. Open an expense report on the workspace with GL codes → report header menu → Export. 11. Export with the GL-code account template → verify the file has the correct GL codes (request includespolicyID). 12. Export with the plain account template → verify the file is delivered (request has nopolicyID).Offline tests
QA Steps
Preconditions (same as Tests):
{expense:category:glcode}/{expense:tag:glcode}column.{expense:category}/{expense:tag}columns.Account-level templates (Search/Expenses bulk export):
Workspace-level template (Search/Expenses bulk export): 5. Select expenses and Export using the workspace template → verify the file is delivered.
Single-report export: 6. Open an expense report on the GL-code workspace → report header → Export → GL-code account template → verify correct GL codes. 7. Same report → Export → plain account template → verify the file is delivered.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
CSV files can be verified on desktop only
Android: mWeb Chrome
CSV files can be verified on desktop only
iOS: Native
CSV files can be verified on desktop only
iOS: mWeb Safari
CSV files can be verified on desktop only
MacOS: Chrome / Safari