Skip to content

feat(credit-risk) - create reserves when COR is selected#760

Open
gabrielseco wants to merge 40 commits intomainfrom
pbyr-3518-build-credit-risk-flow-for-cor
Open

feat(credit-risk) - create reserves when COR is selected#760
gabrielseco wants to merge 40 commits intomainfrom
pbyr-3518-build-credit-risk-flow-for-cor

Conversation

@gabrielseco
Copy link
Collaborator

@gabrielseco gabrielseco commented Feb 27, 2026

I was able to create the reserve invoice in the sandbox environment but I have asked internally how to achieve employment.status created_reserve_paid


Note

Medium Risk
Adds a new submission path that calls the credit-risk reserve invoice endpoint for COR employments, changing the primary action taken from the review step and expanding possible success states. Risk is mainly around triggering the wrong mutation (invite vs reserve) and handling pending/disabled states during onboarding.

Overview
When a contractor employment is Contractor of Record and not read-only, the review-step action now creates a risk reserve invoice (via useCreateReserveInvoice -> /v1/risk-reserve) instead of sending an invite; success callbacks can now return created_awaiting_reserve and the button label switches to "Create Reserve".

OnboardingInvite has been moved/rewired to the contractor onboarding flow (types.ts import change), its render prop now receives status: 'invite' | 'create_reserve', and the button disables while either invite or reserve mutations are pending. Contractor onboarding hook usage is tightened by fetching contract documents using internalEmploymentId.

Tests are updated/expanded to cover the COR reserve path, new button labeling/disabled behavior, and to reduce flakiness by waiting for spinners and mocking missing schema endpoints.

Written by Cursor Bugbot for commit f875626. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 199.85 kB 199.73 kB +127 B (+0.1%) 🔴
Total (raw) 528.59 kB 528.28 kB +310 B (+0.1%) 🔴
CSS (gzip) 19.32 kB 19.32 kB 0 B (0%) 🟢
CSS (raw) 100 kB 100 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 199.85 kB / 200 kB (99.9%)
  • ✅ Total raw: 528.59 kB / 550 kB (96.1%)
  • ✅ CSS gzipped: 19.32 kB / 25 kB (77.3%)

Largest Files (Top 5)

  1. chunk-7EONM7HL.js - 12.44 kB (0 B (0%))
  2. styles.css - 9.66 kB (0 B (0%))
  3. index.css - 9.66 kB (0 B (0%))
  4. index.js - 6.04 kB (0 B (0%))
  5. chunk-WQ4H5V7U.js - 5.77 kB (0 B (0%))
View All Files (310 total)
File Size (gzip) Change
chunk-7EONM7HL.js 12.44 kB 0 B (0%)
styles.css 9.66 kB 0 B (0%)
index.css 9.66 kB 0 B (0%)
index.js 6.04 kB 0 B (0%)
chunk-WQ4H5V7U.js 5.77 kB 0 B (0%)
chunk-CSFEZCCY.js 4.22 kB new
chunk-JIW2JK7J.js 4.06 kB 0 B (0%)
chunk-6EAABHVV.js 3.34 kB 0 B (0%)
chunk-T7O3YYOG.js 3.29 kB 0 B (0%)
chunk-EMP4ZIVB.js 3.21 kB new

✅ Bundle size check passed

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

Deploy preview for remote-flows ready!

✅ Preview
https://remote-flows-e8w97h8rf-remotecom.vercel.app

Built with commit f875626.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

Deploy preview for remote-flows-example-app ready!

✅ Preview
https://remote-flows-example-c0o55wlro-remotecom.vercel.app

Built with commit f875626.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

📊 Coverage Report

✅ Coverage increased! 🎉

Metric Current Previous Change Status
Lines 89.32% 89.29% +0.03% 🟢
Statements 89.01% 88.98% +0.03% 🟢
Functions 86.56% 86.56% 0%
Branches 79.14% 79.09% +0.05% 🟢

Detailed Breakdown

Lines Coverage
  • Covered: 3414 / 3822
  • Coverage: 89.32%
  • Change: +0.03% (11 lines)
Statements Coverage
  • Covered: 3475 / 3904
  • Coverage: 89.01%
  • Change: +0.03% (11 statements)
Functions Coverage
  • Covered: 947 / 1094
  • Coverage: 86.56%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 2132 / 2694
  • Coverage: 79.14%
  • Change: +0.05% (10 branches)

✅ Coverage check passed

@gabrielseco gabrielseco changed the title Pbyr 3518 build credit risk flow for cor feat(credit-risk) - create reserves when COR is selected Mar 11, 2026
@gabrielseco gabrielseco reopened this Mar 13, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

}) => void;
onSubmit?: () => void | Promise<void>;
render: (props: { employmentStatus: 'invited' }) => ReactNode;
render: (props: { status: 'invited' | 'create_reserve' }) => ReactNode;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Render prop property renamed, breaking consumer API

High Severity

The render prop callback property was renamed from employmentStatus to status in the ContractorOnboarding's OnboardingInvite. Existing consumers destructuring employmentStatus from the render callback will now silently receive undefined. The Onboarding version's OnboardingInvite still uses employmentStatus, creating an inconsistency between two parallel components. This is a breaking change to the public render prop API without a BREAKING CHANGE: commit annotation.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: Code Review Guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant