App icon indicating copy to clipboard operation
App copied to clipboard

[$175] TriNet - Missing Final Approver when user select Custom Approval

Open applause-bot[bot] opened this issue 1 month ago • 31 comments

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


Version Number: v9.5.7-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/folder/49506715/test-cases/112855922 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Web App Component: Other

Action Performed:

Precondition: account connected to TriNet

  1. Open the link www.staging.new.expensify.com
  2. Logged in [email protected]
  3. Go to Approval mode >> Select Manager Approval >> Click modal "Change approval mode"
  4. Wait for the sync to finish
  5. Verify the "Final approver" is displayed
  6. Go to Approval mode >> Select Custom Approval >> Click modal "Change approval mode"
  7. Wait for the sync to finish
  8. Verify the "Final approver" is displayed

Expected Result:

the "Final approver" is should be displayed when user select approval mode "Custom approval"

Actual Result:

the "Final approver" is NOT displayed when user select approval mode "Custom approval" Note: not able to check on IOS due to no latest build

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Image Image

View all open jobs on GitHub

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

Upwork Automation - Do Not Edit

applause-bot[bot] avatar Oct 12 '26 14:10 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/09b4065e8ebef94a12a81d07de1b7f55f75644c62087124801750e180c4be0a0

https://platform.applause.com/services/links/v1/external/204442339f46465af11e55161db473473f88bbe71348016b7e3219c44c1b6a83

applause-bot[bot] avatar Oct 12 '26 14:10 applause-bot[bot]

Issue Analysis

Root Cause: This is expected behavior, not a bug. [Payment due @mkhutornyi] Keep approval workflow rules working with HR integrations (merged 2026-10-06) hides the Final approver row on purpose when the approval mode is Custom. In Custom mode, the HR connection sets no approvers, so there is no final approver to show (src/pages/workspace/hr/utils.ts:214-227).

Recommended Fix: No code change. Update the regression test case (BrowserStack TC 112855922) so step 8 checks that Final approver is not shown in Custom approval. Then close this issue.

Investigation details
  • The TriNet card is built from STATIC_HR_PROVIDERS (key: 'zenefits'). getHRCards returns no finalApprover row when getHRApprovalMode(...) === CONST.ZENEFITS.APPROVAL_MODE.CUSTOM. Gusto and Merge HR follow the same rule (utils.ts:263-276).
  • The change came in commit 6a5a59e ("Hide final approver in custom approval mode") in that PR. The PR's QA steps say: "Verify the Gusto card shows no Final approver row. (new)". tests/unit/HrUtilsTest.ts covers it too.
  • The help site agrees. Custom Approval means "approval workflows are managed manually in Expensify" (TriNet.md:68, TriNet.md:81). In this mode, an admin sets the approvers on the Workflows page.
  • Steps 3–5 (Manager approval shows Final approver) still pass. Only step 8 conflicts with the new design.

Next Steps: Reply with @MelvinBot <your feedback> if you think Final approver should still show in Custom approval.


view run

MelvinBot avatar Oct 12 '26 14:10 MelvinBot

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

melvin-bot[bot] avatar Oct 12 '26 14:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 12 '26 14:10 melvin-bot[bot]

Proposal

What is the root cause of that problem?

Every place that shows the HR final approver only checks for Manager mode, so Custom mode never gets it. getHRAdvancedModeFinalApprover returns the final approver only when approvalMode === MANAGER, so getWorkflowsFromPolicy (and the matching builder further down) never appends the final approver to the approver chain in Custom mode. https://github.com/Expensify/App/blob/6502fece05b0fc79e99ba6781c5f919c665aba9f/src/libs/merge/HRUtils.ts#L175-L187 https://github.com/Expensify/App/blob/6502fece05b0fc79e99ba6781c5f919c665aba9f/src/libs/WorkflowUtils.ts#L281-L291 isHRAdvancedMode is also true only for Manager mode, and WorkflowsApprovalsTab passes isHRAdvancedMode and hrFinalApproverEmail (only when advanced) to ApprovalWorkflowSection. https://github.com/Expensify/App/blob/6502fece05b0fc79e99ba6781c5f919c665aba9f/src/libs/merge/HRUtils.ts#L166-L173 https://github.com/Expensify/App/blob/6502fece05b0fc79e99ba6781c5f919c665aba9f/src/pages/workspace/workflows/tabs/WorkflowsApprovalsTab.tsx#L424-L426 In approverTitle, the "Final approver" title is only reached inside if (isHRAdvancedMode), so Custom mode falls through to the generic "Approver" / "1st approver" titles. https://github.com/Expensify/App/blob/6502fece05b0fc79e99ba6781c5f919c665aba9f/src/components/ApprovalWorkflowSection.tsx#L74-L83

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

  • In HRUtils.ts, make getHRAdvancedModeFinalApprover return the configured finalApprover for Manager and Custom modes for Gusto, Zenefits and Merge HR. Basic mode is already covered by getHRFinalApprover.
  • Add a small helper, e.g. isHRFinalApproverMode(policy), true for Manager or Custom, and use it in WorkflowsApprovalsTab to decide whether to pass hrFinalApproverEmail. Keep isHRAdvancedMode unchanged, because it also drives the manager-chain labels and other behaviour.
  • In ApprovalWorkflowSection.approverTitle, check the final-approver match before the isHRAdvancedMode branch, so the last approver gets "Final approver" whenever hrFinalApproverEmail is set. The "Manager" label stays Manager-mode only.
  • Check that the Custom mode workflows still render and edit as they do now (via isAnyHRReadOnlyWorkflowMode) after the final approver is appended.
  • Unit tests: add a Zenefits Custom-mode case to the WorkflowUtils tests (final approver appended to the chain) and one to the HRUtils tests. Add an ApprovalWorkflowSection test that the last approver is titled "Final approver" in Custom mode.

What alternative solutions did you explore? (Optional)

  • Show the label in ApprovalWorkflowSection only, without changing the workflow data. This fails when the final approver is not already in the chain, since the row would not exist.
  • Always show the final approver in every HR mode. This would also change Basic and Optional behaviour that nobody asked for.

haiquywork avatar Oct 12 '26 14:10 haiquywork

Proposal

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

On a TriNet connected workspace, the Final approver row disappears from the HR > TriNet card as soon as the approval mode is switched to Custom approval.

What is the root cause of that problem?

The TriNet card rows are built in getHRCards. Since commit 6a5a59e (PR #102750), the Final approver row is only added when the approval mode is not Custom. In Custom mode finalApproverRows is just an empty array, so the card renders only the Approval mode row:

https://github.com/Expensify/App/blob/7e2c443f97b6548d5c8b806f2c209a7a64138853/src/pages/workspace/hr/utils.ts#L214-L227

The Merge HR loop has the same gate, so BambooHR etc. behave the same way:

https://github.com/Expensify/App/blob/7e2c443f97b6548d5c8b806f2c209a7a64138853/src/pages/workspace/hr/utils.ts#L263-L276

The stored value is not lost. config.finalApprover stays on the connection after the switch (the unit test even sets finalApprover: '[email protected]' in Custom mode), and the final approver page and updateZenefitsFinalApprover don't check the mode at all. Only the row that leads to them is removed, so the admin can't see or reach the setting in Custom mode.

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

  1. In getHRCards, drop the isCustomApproval check and always add the Final approver row for connected cards, in both the static provider loop (Gusto / TriNet) and the Merge HR loop. To avoid keeping two copies, move the row into one small helper used by both loops:
function getFinalApproverRow(config, route, ...) : MergeProviderConfigRow {
    return {
        field: 'finalApprover',
        description: translate('workspace.merge.finalApprover'),
        title: getMergeFinalApproverDisplayName(config?.finalApprover, policyEmployeePersonalDetails, translate, formatPhoneNumber),
        route,
        pendingAction: config?.pendingFields?.finalApprover,
        errors: config?.errorFields?.finalApprover,
    };
}

configRows: [approvalModeRow, getFinalApproverRow(config, provider.finalApproverRoute.getRoute(policyID), ...)]
  1. Nothing changes on the Approval mode page. Switching to Custom still keeps the workspace approval workflows (the shouldDeleteApprovalWorkflowRules logic stays as is), we only stop hiding the row.

  2. Tests: flip the existing case in HrUtilsTest.ts so it asserts the Final approver row is returned for Gusto, TriNet and Merge HR in Custom mode with the stored approver as its title. Also add a case that the row keeps the right route and pending/error fields after switching from Manager to Custom.

https://github.com/Expensify/App/blob/7e2c443f97b6548d5c8b806f2c209a7a64138853/tests/unit/HrUtilsTest.ts#L909-L925

What alternative solutions did you explore? (Optional)

  • Hiding the row in Custom mode looks deliberate (the comment says the connection sets no approvers in Custom). If the team wants to keep that, no code change is needed. We'd just update step 8 of the regression test case (TC 112855922) to check that Final approver is not shown in Custom approval.
  • Keep the row in Custom mode but make it read-only with a hint that approvals are managed on the Workflows tab. That keeps the stored value visible without suggesting it affects routing.

David-2002065 avatar Oct 12 '26 14:10 David-2002065

Proposal

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

In a TriNet-connected workspace, the Final approver configuration row disappears from the HR TriNet settings card when the workspace approval mode is switched to Custom approval.

What is the root cause of that problem?

In src/pages/workspace/hr/utils.ts#L214-L227, getHRCards builds the configuration rows for connected HR providers. It deliberately restricts finalApproverRows so they are only included when !isCustomApproval:

const finalApproverRows: MergeProviderConfigRow[] = !isCustomApproval && provider.finalApproverRoute
    ? [{
        field: 'finalApprover',
        description: translate('workspace.merge.finalApprover'),
        title: getMergeFinalApproverDisplayName(config?.finalApprover, policyEmployeePersonalDetails, translate, formatPhoneNumber),
        route: provider.finalApproverRoute.getRoute(policyID),
        pendingAction: config?.pendingFields?.finalApprover,
        errors: config?.errorFields?.finalApprover,
    }]
    : [];

The exact same condition exists in the Merge HR loop (lines 263–276).

However, config.finalApprover remains persisted in Onyx, and the underlying backend and final approver pages continue to operate normally. Hiding the row completely prevents administrators from inspecting, configuring, or updating their TriNet final approver while on Custom approval mode.

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

  1. In src/pages/workspace/hr/utils.ts within getHRCards, remove the !isCustomApproval restriction so that finalApproverRows is always created when provider.finalApproverRoute is available.
  2. Deduplicate the row builder by extracting a shared helper function getFinalApproverConfigRow(...) used by both the static HR provider block and the dynamic Merge HR provider loop.
  3. Update unit tests in tests/unit/HrUtilsTest.ts to verify that finalApprover row is included in the returned config rows for Gusto, TriNet, and Merge HR cards even when isCustomApproval is true.

What alternative solutions did you explore? (Optional)

  • Making the row visible but disabled in Custom mode: unnecessary since updating the final approver on the destination page is valid and doesn't conflict with custom rules.

jloa-dev avatar Oct 13 '26 04:10 jloa-dev

@ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Oct 15 '26 21:10 melvin-bot[bot]

@ZhenjaHorbach 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Oct 19 '26 21:10 melvin-bot[bot]

@ZhenjaHorbach Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

melvin-bot[bot] avatar Oct 21 '26 21:10 melvin-bot[bot]

@ZhenjaHorbach 10 days overdue. I'm getting more depressed than Marvin.

melvin-bot[bot] avatar Oct 23 '26 21:10 melvin-bot[bot]

@ZhenjaHorbach this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Oct 26 '26 21:10 melvin-bot[bot]

This issue has not been updated in over 14 days. @ZhenjaHorbach eroding to Weekly issue.

melvin-bot[bot] avatar Oct 28 '26 21:10 melvin-bot[bot]

Issue Analysis

Root Cause: This is expected behavior, not a bug. [Payment due @mkhutornyi] Keep approval workflow rules working with HR integrations (merged 2026-10-06) hides the Final approver row on purpose when the approval mode is Custom. In Custom mode, the HR connection sets no approvers, so there is no final approver to show (src/pages/workspace/hr/utils.ts:214-227).

Recommended Fix: No code change. Update the regression test case (BrowserStack TC 112855922) so step 8 checks that Final approver is not shown in Custom approval. Then close this issue.

Investigation details

  • The TriNet card is built from STATIC_HR_PROVIDERS (key: 'zenefits'). getHRCards returns no finalApprover row when getHRApprovalMode(...) === CONST.ZENEFITS.APPROVAL_MODE.CUSTOM. Gusto and Merge HR follow the same rule (utils.ts:263-276).
  • The change came in commit 6a5a59e ("Hide final approver in custom approval mode") in that PR. The PR's QA steps say: "Verify the Gusto card shows no Final approver row. (new)". tests/unit/HrUtilsTest.ts covers it too.
  • The help site agrees. Custom Approval means "approval workflows are managed manually in Expensify" (TriNet.md:68, TriNet.md:81). In this mode, an admin sets the approvers on the Workflows page.
  • Steps 3–5 (Manager approval shows Final approver) still pass. Only step 8 conflicts with the new design.

Next Steps: Reply with @MelvinBot <your feedback> if you think Final approver should still show in Custom approval.

view run

@Gonals @trjExpensify Can you confirm this, please? And if it's correct Let's close this!

ZhenjaHorbach avatar Oct 30 '26 11:10 ZhenjaHorbach

@ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 02 '26 23:11 melvin-bot[bot]

@ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!

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

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

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

@ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!

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

Not overdue

ZhenjaHorbach avatar Nov 04 '26 21:11 ZhenjaHorbach

Issue Analysis

Root Cause: This is expected behavior, not a bug. [Payment due @mkhutornyi] Keep approval workflow rules working with HR integrations (merged 2026-10-06) hides the Final approver row on purpose when the approval mode is Custom. In Custom mode, the HR connection sets no approvers, so there is no final approver to show (src/pages/workspace/hr/utils.ts:214-227). Recommended Fix: No code change. Update the regression test case (BrowserStack TC 112855922) so step 8 checks that Final approver is not shown in Custom approval. Then close this issue. Investigation details

  • The TriNet card is built from STATIC_HR_PROVIDERS (key: 'zenefits'). getHRCards returns no finalApprover row when getHRApprovalMode(...) === CONST.ZENEFITS.APPROVAL_MODE.CUSTOM. Gusto and Merge HR follow the same rule (utils.ts:263-276).
  • The change came in commit 6a5a59e ("Hide final approver in custom approval mode") in that PR. The PR's QA steps say: "Verify the Gusto card shows no Final approver row. (new)". tests/unit/HrUtilsTest.ts covers it too.
  • The help site agrees. Custom Approval means "approval workflows are managed manually in Expensify" (TriNet.md:68, TriNet.md:81). In this mode, an admin sets the approvers on the Workflows page.
  • Steps 3–5 (Manager approval shows Final approver) still pass. Only step 8 conflicts with the new design.

Next Steps: Reply with @MelvinBot <your feedback> if you think Final approver should still show in Custom approval. view run

@Gonals @trjExpensify Can you confirm this, please? And if it's correct Let's close this!

CC: @Gonals @trjExpensify

ZhenjaHorbach avatar Nov 04 '26 21:11 ZhenjaHorbach