Skip to content

✨ server: add business onboarding applications - #1203

Open
aguxez wants to merge 1 commit into
saltfrom
panda-b2b
Open

✨ server: add business onboarding applications#1203
aguxez wants to merge 1 commit into
saltfrom
panda-b2b

Conversation

@aguxez

@aguxez aguxez commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

summary

add panda business onboarding application support.

changes

  • add the panda company identifier to the database schema
  • identify the configured business client
  • create trusted business credentials
  • support the persona business template and field mapping
  • create and query panda company applications
  • route business kyc through the company application flow
  • add application-focused tests and a server changeset

test plan

  • run the full workspace test
  • run the server typescript check
  • run the server eslint check
  • pass 280 focused server tests
  • build the workspace

notes

  • the approval webhook, company-user adoption, card creation, and approval finalization will follow in a stacked pull request
  • the local business onboarding script is not part of this pull request

Summary by CodeRabbit

  • New Features

    • Added business onboarding applications with submission, resumption, retries, and status checks.
    • Expanded identity verification for business accounts, representatives, beneficial owners, and company details.
    • Added validation, idempotent submissions, and clearer application errors and statuses.
    • Improved credential handling for business accounts and repeat application attempts.
  • Tests

    • Added coverage for business applications, validation, persistence, retries, denial scenarios, and identity verification flows.

@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 38d1ea0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@exactly/server Patch

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

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The 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.

Changes

Business onboarding

Layer / File(s) Summary
Business credential salts
server/utils/createCredential.ts, server/api/auth/..., server/database/schema.ts, server/test/utils/createCredential.test.ts, server/test/api/auth.test.ts
Credentials can use random business salts. Authentication and registration accept accountType=business. Credentials persist the selected salt.
Business Persona inquiries
server/utils/persona.ts, server/hooks/persona.ts, server/test/utils/persona.test.ts, server/test/hooks/persona.test.ts
Persona supports business templates, account types, inquiry fields, business account evaluation, and ignored-template handling.
Panda company applications
server/utils/panda.ts, server/test/utils/panda.test.ts
Added corporate schemas, Persona conversion, subtenant-aware requests, idempotency, status retrieval, and typed business errors.
Business KYC flow
server/api/kyc.ts, server/test/api/kyc.test.ts, .changeset/ten-memes-tease.md, cspell.json
KYC accepts business submissions, creates or resumes company applications, persists company IDs, reports status, maps business errors, and validates request payloads.

Estimated code review effort: 4 (Complex) | ~60 minutes

Mergeability Score: 🟠 High · up to fd84c

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
Loading

Possibly related PRs

  • exactly/exa#1202: Extends the same Panda business onboarding implementation across authentication, KYC, credentials, Persona, and Panda utilities.
  • exactly/exa#1143: Provides related credential-salt handling used by authentication and registration.
  • exactly/exa#948: Modifies the KYC and Panda application flows extended here.

Suggested reviewers: nfmelendez, cruzdanilo

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding business onboarding applications to the server.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch panda-b2b
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch panda-b2b

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@aguxez aguxez changed the title ✨ server: add panda business onboarding ✨ server: add business onboarding applications Aug 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2336ae2 and df8a62b.

📒 Files selected for processing (15)
  • .changeset/ten-memes-tease.md
  • cspell.json
  • server/api/auth/authentication.ts
  • server/api/auth/registration.ts
  • server/api/kyc.ts
  • server/database/schema.ts
  • server/hooks/persona.ts
  • server/test/api/kyc.test.ts
  • server/test/hooks/persona.test.ts
  • server/test/utils/createCredential.test.ts
  • server/test/utils/panda.test.ts
  • server/test/utils/persona.test.ts
  • server/utils/createCredential.ts
  • server/utils/panda.ts
  • server/utils/persona.ts

Comment thread server/api/auth/authentication.ts Outdated
Comment thread server/test/api/kyc.test.ts Outdated
Comment thread server/test/utils/panda.test.ts Outdated
Comment thread server/utils/createCredential.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/persona.ts Outdated
Comment thread server/utils/persona.ts Outdated
Comment thread server/utils/persona.ts Outdated
@aguxez
aguxez force-pushed the panda-b2b branch 3 times, most recently from 76d2c6b to ede0b3c Compare August 11, 2026 12:21

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between df8a62b and ede0b3c.

📒 Files selected for processing (6)
  • server/test/api/kyc.test.ts
  • server/test/utils/panda.test.ts
  • server/test/utils/persona.test.ts
  • server/utils/createCredential.ts
  • server/utils/panda.ts
  • server/utils/persona.ts

Comment thread server/test/api/kyc.test.ts Outdated
Comment thread server/test/utils/panda.test.ts Outdated
Comment thread server/test/utils/persona.test.ts Outdated
Comment thread server/utils/createCredential.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/persona.ts Outdated
Comment thread server/utils/persona.ts Outdated
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.04%. Comparing base (2a21a1e) to head (69dda26).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
server/api/kyc.ts 88.39% 3 Missing and 10 partials ⚠️
server/api/auth/registration.ts 80.00% 2 Missing ⚠️
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     
Flag Coverage Δ
e2e 74.04% <89.65%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aguxez
aguxez force-pushed the panda-b2b branch 2 times, most recently from 5e369b4 to c8abea1 Compare August 11, 2026 14:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
server/utils/persona.ts (1)

403-410: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Filter 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 to businessApplicationFromPersona.

  • server/utils/persona.ts#L403-L410: query only the configured business account type before calling evaluateAccount.
  • server/utils/panda.ts#L677-L678: make getAccount(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

📥 Commits

Reviewing files that changed from the base of the PR and between ede0b3c and c8abea1.

📒 Files selected for processing (9)
  • server/api/auth/authentication.ts
  • server/api/auth/registration.ts
  • server/test/api/auth.test.ts
  • server/test/utils/createCredential.test.ts
  • server/test/utils/panda.test.ts
  • server/test/utils/persona.test.ts
  • server/utils/createCredential.ts
  • server/utils/panda.ts
  • server/utils/persona.ts

Comment thread server/utils/createCredential.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/panda.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between c8abea1 and ffe4ca4.

📒 Files selected for processing (4)
  • server/test/utils/createCredential.test.ts
  • server/test/utils/panda.test.ts
  • server/utils/createCredential.ts
  • server/utils/panda.ts

Comment thread server/utils/panda.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between ffe4ca4 and fd84ca6.

📒 Files selected for processing (9)
  • cspell.json
  • server/api/kyc.ts
  • server/test/api/auth.test.ts
  • server/test/api/kyc.test.ts
  • server/test/hooks/persona.test.ts
  • server/test/utils/panda.test.ts
  • server/test/utils/persona.test.ts
  • server/utils/panda.ts
  • server/utils/persona.ts

Comment thread server/api/kyc.ts Outdated
Comment thread server/utils/panda.ts Outdated
@aguxez
aguxez force-pushed the panda-b2b branch 4 times, most recently from 5e14f2b to caa8642 Compare August 14, 2026 08:51
@aguxez
aguxez force-pushed the panda-b2b branch 5 times, most recently from 0d2991b to c22ea06 Compare August 15, 2026 11:00
@aguxez
aguxez changed the base branch from salt to main August 16, 2026 13:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/panda.ts Outdated
Comment thread server/api/kyc.ts Outdated
Comment thread server/api/kyc.ts Outdated
Comment thread server/utils/panda.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/database/schema.ts
Comment thread infra/utils/modules.ts Outdated
Comment thread server/api/kyc.ts
Comment thread server/api/kyc.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/authChallenge.ts Outdated
Comment thread server/hooks/persona.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/api/kyc.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/panda.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/panda.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/panda.ts
Comment thread server/api/kyc.ts
Comment thread server/utils/panda.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread infra/utils/modules.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread infra/utils/modules.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/persona.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/createCredential.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/api/kyc.ts
Comment thread server/utils/panda.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/utils/panda.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread server/api/kyc.ts
Comment on lines +566 to +568
if (!current) return c.json({ code: "no credential" }, 500);
try {
if (current.pandaId) return c.json({ code: BadRequestCodes.ALREADY_STARTED }, 409);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment thread server/api/kyc.ts
Comment on lines +583 to +585
if (
application.applicationStatus &&
["denied", "locked", "canceled"].includes(application.applicationStatus)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment thread server/api/kyc.ts
Comment on lines +591 to +592
if (error instanceof BusinessApplicationError)
return c.json({ code: error.code, legacy: error.legacy, message: [error.message] }, 400);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

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.

server: integrate panda b2b

2 participants