Conversation
🦋 Changeset detectedLatest commit: 38d1ea0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe server adds business KYC onboarding through Persona and Panda. It adds business credential salts, company application schemas and APIs, subtenant headers, KYC submission and status handling, company ID persistence, and coverage for creation, retries, denial, and validation. ChangesBusiness onboarding
Estimated code review effort: 4 (Complex) | ~60 minutes Mergeability Score: 🟠 High · up to Business onboarding validation failures can currently send applicants’ identity and address information to error monitoring, creating a sensitive-data exposure risk, while missing business configuration can cause onboarding requests to fail with 500 errors. Merge should wait until these issues are addressed. Sequence Diagram(s)sequenceDiagram
participant Client
participant KYC API
participant Persona
participant Panda
participant Database
Client->>KYC API: Submit business application
KYC API->>Persona: Read business inquiry and account
Persona-->>KYC API: Approved business data
KYC API->>Panda: Create or resume company application
Panda-->>KYC API: Company identifier and status
KYC API->>Database: Store pandaCompanyId
KYC API-->>Client: Application response
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d1baf630-28b0-4fd8-a01d-ca5657465c85
📒 Files selected for processing (15)
.changeset/ten-memes-tease.mdcspell.jsonserver/api/auth/authentication.tsserver/api/auth/registration.tsserver/api/kyc.tsserver/database/schema.tsserver/hooks/persona.tsserver/test/api/kyc.test.tsserver/test/hooks/persona.test.tsserver/test/utils/createCredential.test.tsserver/test/utils/panda.test.tsserver/test/utils/persona.test.tsserver/utils/createCredential.tsserver/utils/panda.tsserver/utils/persona.ts
76d2c6b to
ede0b3c
Compare
There was a problem hiding this comment.
Actionable comments posted: 10
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 9d7a39e9-094d-41f2-9aa4-0488bf4976b7
📒 Files selected for processing (6)
server/test/api/kyc.test.tsserver/test/utils/panda.test.tsserver/test/utils/persona.test.tsserver/utils/createCredential.tsserver/utils/panda.tsserver/utils/persona.ts
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## salt #1203 +/- ##
==========================================
+ Coverage 73.86% 74.04% +0.17%
==========================================
Files 295 296 +1
Lines 13853 14100 +247
Branches 4813 4937 +124
==========================================
+ Hits 10233 10440 +207
- Misses 3283 3307 +24
- Partials 337 353 +16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5e369b4 to
c8abea1
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
server/utils/persona.ts (1)
403-410: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winFilter business account lookups by Persona account type.
The business scope currently uses account queries filtered only by
reference-id. A personal account with the same reference ID can suppress business inquiry creation or supply personal fields tobusinessApplicationFromPersona.
server/utils/persona.ts#L403-L410: query only the configured business account type before callingevaluateAccount.server/utils/panda.ts#L677-L678: makegetAccount(credentialId, "business")use the same business account-type filter.server/test/utils/persona.test.ts#L604-L657: add coverage where a personal account does not satisfy the business lookup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: bf76ec0a-b597-43e6-afb6-cb530e104ac2
📒 Files selected for processing (9)
server/api/auth/authentication.tsserver/api/auth/registration.tsserver/test/api/auth.test.tsserver/test/utils/createCredential.test.tsserver/test/utils/panda.test.tsserver/test/utils/persona.test.tsserver/utils/createCredential.tsserver/utils/panda.tsserver/utils/persona.ts
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 81399108-3707-4d7a-8107-0cd9b159f6b6
📒 Files selected for processing (4)
server/test/utils/createCredential.test.tsserver/test/utils/panda.test.tsserver/utils/createCredential.tsserver/utils/panda.ts
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a227773a-a2ac-4411-a5ed-9212717700e2
📒 Files selected for processing (9)
cspell.jsonserver/api/kyc.tsserver/test/api/auth.test.tsserver/test/api/kyc.test.tsserver/test/hooks/persona.test.tsserver/test/utils/panda.test.tsserver/test/utils/persona.test.tsserver/utils/panda.tsserver/utils/persona.ts
5e14f2b to
caa8642
Compare
0d2991b to
c22ea06
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 275e207313
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ced3cbd128
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8055c6bb7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e910575c0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9074d80522
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7579a68fd0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54827e5afd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61451ecb5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86471aed4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02988bf714
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cef1fed1a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 538b5d64c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50be457bb4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69dda266c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!current) return c.json({ code: "no credential" }, 500); | ||
| try { | ||
| if (current.pandaId) return c.json({ code: BadRequestCodes.ALREADY_STARTED }, 409); |
There was a problem hiding this comment.
Exercise the locked database-state outcomes
The business-application tests always retain the credential with pandaId unset, so neither the missing-current-credential return nor the already started conflict is exercised in this newly added critical section. Add cases for both database states to satisfy the mandatory branch-coverage requirement. .agents/rules/server.mdL69-L73
Useful? React with 👍 / 👎.
| if ( | ||
| application.applicationStatus && | ||
| ["denied", "locked", "canceled"].includes(application.applicationStatus) |
There was a problem hiding this comment.
Exercise a company response without an application status
The company response schemas permit applicationStatus to be absent or null, but the route tests cover only truthy pending and denied values. Consequently, the falsy left-hand branch of this new && remains untested; add a status-less response case and assert the returned body. .agents/rules/server.mdL69-L73
Useful? React with 👍 / 👎.
| if (error instanceof BusinessApplicationError) | ||
| return c.json({ code: error.code, legacy: error.legacy, message: [error.message] }, 400); |
There was a problem hiding this comment.
Exercise business application errors through the route
The utility tests throw BusinessApplicationError directly, but no business route test causes panda.businessApplication to reject with one, so this handler-specific catch and its serialized 400 response remain uncovered. Add a route test for one expected business validation failure and assert the complete response. .agents/rules/server.mdL69-L74
Useful? React with 👍 / 👎.
summary
add panda business onboarding application support.
changes
test plan
notes
Summary by CodeRabbit
New Features
Tests