Skip to content

feat(wiza): add wiza plugin - #427

Merged
devjain32 merged 25 commits into
corsairdev:mainfrom
yuvrxj-afk:feat/wiza-plugin
Aug 8, 2026
Merged

feat(wiza): add wiza plugin#427
devjain32 merged 25 commits into
corsairdev:mainfrom
yuvrxj-afk:feat/wiza-plugin

Conversation

@yuvrxj-afk

@yuvrxj-afk yuvrxj-afk commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Implements the Wiza integration (Fixes #423). Wiza finds and exports accurate contact data for prospects from LinkedIn: verified emails, phone numbers, and enriched professional information.

Endpoints (api_key auth, no webhooks):

  • credits.get — remaining API credits
  • individualReveals.start / individualReveals.get — real-time single-contact enrichment (async: start returns an ID, poll get until finished)
  • lists.get — list processing status and details
  • prospects.search — prospect counts and sample profiles by job title, location, company, industry

Results persist to plugin entities (reveals, lists, prospects). 14 unit tests validate inputs and documented response shapes. Registered and exercised via demo/testing locally (kept out of the diff per plugin PR scope rules).

Checklist

  • I have run pnpm lint and all checks pass
  • I have run pnpm typecheck and there are no TypeScript errors
  • I have run pnpm build and all packages build successfully
  • I have run pnpm test and all tests pass
  • I have added or updated tests where applicable
  • I have added or updated necessary documentation

Screenshots / Demos (if applicable)

https://github.com/user-attachments/assets/wiza-demo.mp4 (placeholder — final walkthrough recording before merge)

Additional Notes

Built from the claim at corsair.dev/oss.

Summary by CodeRabbit

  • New Features

    • Added Wiza as a supported provider with API-key authentication.
    • Added credits, individual reveals, lists, and prospect search capabilities.
    • Added persistence for reveals, lists, and prospect profiles.
    • Added request and response validation.
    • Added automatic retry handling for rate-limit errors.
  • Documentation

    • Added setup guidance, authentication details, endpoint references, and usage examples.
  • Tests

    • Added coverage for validation, API requests, persistence, logging, and error handling.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@yuvrxj-afk is attempting to deploy a commit to the corsair Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the core Changes in packages/corsair label Jul 9, 2026
@yuvrxj-afk
yuvrxj-afk marked this pull request as ready for review July 9, 2026 13:58
@github-actions github-actions Bot added the docs Docs / Mintlify / markdown changes label Jul 9, 2026
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the Wiza integration plugin. The main changes are:

  • Wiza provider registration in core constants.
  • API-key auth and endpoint wiring for credits, reveals, lists, and prospect search.
  • Zod schemas for endpoint inputs, outputs, and persisted entities.
  • Handler tests for provider calls, persistence, logging, and error propagation.
  • Package build, test, and README files for @corsair-dev/wiza.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/wiza/client.ts Builds Wiza API requests against the real provider host and preserves framework API errors.
packages/wiza/index.ts Registers the Wiza plugin, endpoint schemas, auth config, endpoint metadata, and empty webhook handling.
packages/wiza/schema.test.ts Adds schema and endpoint handler tests for the implemented Wiza API surface.
packages/wiza/endpoints/credits.ts Adds the credits endpoint handler and completion logging.
packages/wiza/endpoints/individual-reveals.ts Adds reveal start and fetch handlers with persistence and logging.
packages/wiza/endpoints/lists.ts Adds list status retrieval with persistence and logging.
packages/wiza/endpoints/prospects.ts Adds prospect search with profile persistence and logging.

Reviews (20): Last reviewed commit: "fix(wiza): address CodeRabbit findings" | Re-trigger Greptile

Comment thread packages/wiza/client.ts Outdated
Comment thread packages/wiza/client.ts
Comment thread packages/wiza/webhooks/tenant-matcher.ts Outdated
Comment thread packages/wiza/schema.test.ts
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
DRY RUN — would post:

Hey @yuvrxj-afk, thanks for the contribution! 🏴‍☠️ Before a maintainer reviews, please fix the items below — the review re-runs automatically on your next push.

Must fix

  • P1 packages/wiza/client.ts:15Placeholder Host Handles Requests
    Every implemented endpoint calls makeWizaRequest, so a valid Wiza API key still sends traffic to https://api.example.com/api/.... The request never reaches Wiza, and all endpoint calls fail with a network or host error instead of returning provider data.

Rule Used: Flag boilerplate residue from the plugin generator... (source)

  • P1 packages/wiza/client.ts:56Rate Limit Metadata Disappears
    When corsair/http throws an ApiError for a 429, this catch block replaces it with WizaAPIError and drops status and retryAfter. The plugin’s rate-limit handler then cannot match the error reliably, so Wiza throttling can fall through to the default no-retry path and surface as a failed endpoint call.

Rule Used: Every endpoint must validate inputs and outputs wi... (source)

  • P1 packages/wiza/webhooks/tenant-matcher.ts:3Generated Webhook Stub Remains
    The PR describes API-key auth with no webhooks, but this generated tenant matcher and the OAuth link resolver are still registered from the plugin. If the webhook matching path is later enabled, the generic tenant_external_id matcher can route unrelated payloads, and the TODO stub also violates the plugin rule against generator residue.

Rule Used: Flag boilerplate residue from the plugin generator... (source)

  • P1 packages/wiza/schema.test.ts:13Endpoint Handlers Stay Untested
    The tests assert schema parsing, but none of the five implemented endpoint handlers are invoked. Bugs in the actual request path, persistence writes, logging, and error propagation can pass the package tests even though the plugin rules require tests for implemented endpoints.

Rule Used: Flag any types on exported or public surfaces as... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

If anything remains after your next push, a bot commit will clean it up; a maintainer always does the final review and merge.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

DRY RUN — would mark round 2 and run the fix agent now.

Comment thread packages/wiza/client.ts Outdated
Comment thread packages/wiza/client.ts
Comment thread packages/wiza/index.ts Outdated
Comment thread packages/wiza/schema.test.ts
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

DRY RUN — would mark round 2 and run the fix agent now.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

DRY RUN — would mark round 2 and run the fix agent now.

Comment thread packages/wiza/client.ts Outdated
Comment thread packages/wiza/client.ts
Comment thread packages/wiza/index.ts Outdated
Comment thread packages/wiza/schema.test.ts
Comment thread packages/wiza/client.ts Outdated
Comment thread packages/wiza/client.ts
Comment thread packages/wiza/index.ts Outdated
Comment thread packages/wiza/schema.test.ts
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

DRY RUN — would mark round 2 and run the fix agent now.

@github-actions github-actions Bot added the bot:round-2 Review bot pushed an automated fix label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Remaining findings are being fixed by a bot commit — it will be re-reviewed automatically.

Comment thread packages/wiza/webhooks/tenant-matcher.ts Outdated
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Maintainer review needed

Automated rounds are exhausted. Remaining findings:

  • P1 packages/wiza/webhooks/tenant-matcher.tsRemove webhook stubs
    This API-key-only plugin no longer registers webhook resolvers, but the generated webhook files still contain live tenant-matching template code. If this file is imported or wired back into the plugin later, a generic tenant_external_id field can still route unrelated payloads to Wiza. Delete the unused webhooks stubs instead of leaving the generated matcher in the package.

Rule Used: Flag boilerplate residue from the plugin generator... (source)

@github-actions github-actions Bot added the needs-maintainer Automated rounds exhausted - human review needed label Jul 9, 2026
@yuvrxj-afk
yuvrxj-afk requested a review from devjain32 July 9, 2026 19:34

@ambikeesshh ambikeesshh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. you can merge it safely @devjain32

@ambikeesshh

Copy link
Copy Markdown
Collaborator

@greptileai review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ambikeesshh, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1fa92db1-7aec-4832-8962-96c4a5373f59

📥 Commits

Reviewing files that changed from the base of the PR and between bfb2580 and e0072c4.

📒 Files selected for processing (2)
  • packages/wiza/error-handlers.ts
  • packages/wiza/schema.test.ts
📝 Walkthrough

Walkthrough

The PR adds the Wiza provider to Corsair. It defines typed endpoint contracts, API-key authentication, request handling, persistence for Wiza entities, retry behavior, tests, documentation, and package configuration.

Changes

Wiza integration

Layer / File(s) Summary
Provider and data contracts
packages/corsair/core/constants.ts, packages/wiza/endpoints/types.ts, packages/wiza/schema/*
Registers wiza, defines endpoint input/output schemas, and adds reveal, list, and prospect database entities.
Client and plugin runtime
packages/wiza/client.ts, packages/wiza/index.ts, packages/wiza/error-handlers.ts, packages/wiza/package.json, packages/wiza/*config*
Adds authenticated Wiza requests, API-key resolution, plugin construction, retry handlers, exports, and build configuration.
Endpoint execution and persistence
packages/wiza/endpoints/*
Adds credits, individual reveal, list, and prospect search handlers with completion events and database persistence.
Validation and documentation
packages/wiza/schema.test.ts, packages/wiza/README.md
Tests schemas, requests, responses, persistence, events, and API errors. Documents authentication and endpoint behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant WizaPlugin
  participant WizaEndpoint
  participant WizaAPI
  participant Database
  Application->>WizaPlugin: call endpoint
  WizaPlugin->>WizaEndpoint: resolve API key and invoke handler
  WizaEndpoint->>WizaAPI: send authenticated request
  WizaAPI-->>WizaEndpoint: return response
  WizaEndpoint->>Database: persist reveal, list, or prospect data
  WizaEndpoint-->>Application: return validated response
Loading

Possibly related PRs

  • corsairdev/corsair#327 — Adds a structurally similar provider plugin with provider registration.
  • corsairdev/corsair#344 — Adds a provider plugin with analogous client, endpoint, schema, and error-handler structures.
  • corsairdev/corsair#375 — Adds a provider plugin with API-key authentication, schemas, error handling, persistence, and provider registration.

Suggested labels: plugin

Suggested reviewers: devjain32

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: adding the Wiza plugin.
Linked Issues check ✅ Passed The PR adds the requested Wiza integration with API authentication, core endpoints, persistence, tests, and no required webhook support.
Out of Scope Changes check ✅ Passed The changes remain within the Wiza integration scope, including implementation, schemas, tests, documentation, and package configuration.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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: 7

🧹 Nitpick comments (3)
packages/wiza/client.ts (1)

4-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The code parameter of WizaAPIError is never set.

Both throw sites construct WizaAPIError with a message only. Either populate code from the caught error, or remove the parameter until a caller needs it.

Also applies to: 57-60

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/wiza/client.ts` around lines 4 - 12, Update WizaAPIError and its
throw sites consistently: either pass the caught error’s code into the
constructor wherever errors are converted, or remove the unused optional code
parameter and property until callers require it. Ensure the chosen approach is
applied to both throw sites.
packages/wiza/error-handlers.ts (1)

27-30: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

No handler retries transient server or network failures.

DEFAULT returns maxRetries: 0. A 5xx response or a dropped connection therefore fails the call immediately. Read endpoints such as credits.get, lists.get, and prospects.search are idempotent and can retry safely.

Add a SERVER_ERROR handler for 5xx with a small retry budget. Keep maxRetries: 0 in DEFAULT for the non-idempotent individualReveals.start path, or gate retries on the HTTP method.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/wiza/error-handlers.ts` around lines 27 - 30, Add a SERVER_ERROR
handler in the error-handler configuration that matches 5xx responses and
permits a small retry budget for safe transient failures. Preserve DEFAULT with
maxRetries: 0 so non-idempotent individualReveals.start calls do not retry, and
ensure the new handler is selected before DEFAULT.
packages/wiza/schema/database.ts (1)

3-22: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Consider narrowing .loose() on persisted PII entities.

WizaReveal persists contact PII, including email, mobile_phone, and phone_number. .loose() also retains every extra field that Wiza returns. Unknown provider fields then enter storage without review, which widens the PII surface for retention and deletion requirements.

If you need forward compatibility with new Wiza fields, keep .loose() on the wire schemas in endpoints/types.ts and use a strict object for the persisted entity.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/wiza/schema/database.ts` around lines 3 - 22, The persisted
WizaReveal schema should not retain unreviewed provider fields: replace its
loose-object behavior with a strict object while preserving the explicitly
defined fields and types. Keep any forward-compatible loose parsing confined to
the wire schemas in endpoints/types.ts rather than WizaReveal.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/wiza/client.ts`:
- Around line 33-38: Verify how Corsair’s request implementation resolves
OpenAPIConfig.TOKEN in packages/corsair/http.ts. If it already emits the
Authorization Bearer header, remove the authentication TODO and commented-out
Authorization line from the HEADERS object; otherwise add an explicit Bearer
Authorization header using the configured API token.

In `@packages/wiza/endpoints/individual-reveals.ts`:
- Around line 19-29: Prevent completion reporting when persistence fails: in
packages/wiza/endpoints/individual-reveals.ts lines 19-29 and 51-58, propagate
failed upsertByEntityId calls or emit an explicit failed/partial result before
completion; in packages/wiza/endpoints/lists.ts lines 13-26, apply the same
handling for list upserts; and in packages/wiza/endpoints/prospects.ts lines
13-31, avoid reporting a fully completed search if any prospect upsert fails.
Add tests covering rejected upserts and verifying no completed event is emitted.

In `@packages/wiza/endpoints/types.ts`:
- Around line 50-59: Update the identifier refinement callback to use logical OR
checks instead of nullish coalescing for profile_url, email, full_name, company,
and domain, so empty strings fall through to valid identifiers. Preserve the
existing validation message and accepted identifier combinations.

In `@packages/wiza/error-handlers.ts`:
- Around line 6-17: Update the rate-limit matcher’s `match` function to rely on
`ApiError.status === 429` and the existing `rate_limited` message indicator,
removing the broad `msg.includes('429')` fallback. Preserve the `handler` retry
configuration and `retryAfter` propagation unchanged.

In `@packages/wiza/index.ts`:
- Line 97: Update the defaultAuthType declaration to preserve the literal type
'api_key' rather than widening it to AuthTypes, and keep the BaseWizaPlugin
initialization using that narrowed literal type.

In `@packages/wiza/README.md`:
- Around line 29-31: Update the asynchronous reveal guidance near
individualReveals.start/get to clarify that callback_url sends the completion
payload via POST to a caller-managed endpoint and is not persisted or reflected
through the Corsair plugin; readers should use polling when they need the
reveals entity updated.

In `@packages/wiza/schema/database.ts`:
- Around line 39-50: Align the persistence contract for WizaProspect with
ProspectProfileSchema by explicitly handling profiles whose linkedin_url is null
or absent. Prefer guarding in the prospect persistence flow before entity
validation and skip those profiles, or otherwise update the entity identity
design consistently; ensure valid profiles continue to persist unchanged.

---

Nitpick comments:
In `@packages/wiza/client.ts`:
- Around line 4-12: Update WizaAPIError and its throw sites consistently: either
pass the caught error’s code into the constructor wherever errors are converted,
or remove the unused optional code parameter and property until callers require
it. Ensure the chosen approach is applied to both throw sites.

In `@packages/wiza/error-handlers.ts`:
- Around line 27-30: Add a SERVER_ERROR handler in the error-handler
configuration that matches 5xx responses and permits a small retry budget for
safe transient failures. Preserve DEFAULT with maxRetries: 0 so non-idempotent
individualReveals.start calls do not retry, and ensure the new handler is
selected before DEFAULT.

In `@packages/wiza/schema/database.ts`:
- Around line 3-22: The persisted WizaReveal schema should not retain unreviewed
provider fields: replace its loose-object behavior with a strict object while
preserving the explicitly defined fields and types. Keep any forward-compatible
loose parsing confined to the wire schemas in endpoints/types.ts rather than
WizaReveal.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9167ce9a-768c-47ae-8df4-e08fc0d4038d

📥 Commits

Reviewing files that changed from the base of the PR and between fe4d2a1 and 7eb1609.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • packages/corsair/core/constants.ts
  • packages/wiza/README.md
  • packages/wiza/client.ts
  • packages/wiza/endpoints/credits.ts
  • packages/wiza/endpoints/index.ts
  • packages/wiza/endpoints/individual-reveals.ts
  • packages/wiza/endpoints/lists.ts
  • packages/wiza/endpoints/prospects.ts
  • packages/wiza/endpoints/types.ts
  • packages/wiza/error-handlers.ts
  • packages/wiza/index.ts
  • packages/wiza/jest.config.cjs
  • packages/wiza/package.json
  • packages/wiza/schema.test.ts
  • packages/wiza/schema/database.ts
  • packages/wiza/schema/index.ts
  • packages/wiza/tsconfig.json
  • packages/wiza/tsup.config.ts

Comment thread packages/wiza/client.ts
Comment thread packages/wiza/endpoints/individual-reveals.ts Outdated
Comment thread packages/wiza/endpoints/types.ts
Comment thread packages/wiza/error-handlers.ts
Comment thread packages/wiza/index.ts Outdated
Comment thread packages/wiza/README.md Outdated
Comment thread packages/wiza/schema/database.ts
@ambikeesshh

Copy link
Copy Markdown
Collaborator

@greptileai review

@ambikeesshh ambikeesshh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

code rabbit's findings addressed
lgtm now

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/wiza/error-handlers.ts`:
- Around line 26-38: Update the SERVER_ERROR retry handling so ambiguous network
failures are retried only for idempotent requests, while preserving retries for
eligible server errors. Use the request method metadata available through the
Wiza request/error-handler flow to prevent retries of POST-based
individualReveals.start requests, unless that request is given a stable
Wiza-supported idempotency key.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8bdd813d-90e2-4694-831f-f552f91a8e16

📥 Commits

Reviewing files that changed from the base of the PR and between b7ea6da and bfb2580.

📒 Files selected for processing (10)
  • packages/wiza/README.md
  • packages/wiza/client.ts
  • packages/wiza/endpoints/individual-reveals.ts
  • packages/wiza/endpoints/lists.ts
  • packages/wiza/endpoints/prospects.ts
  • packages/wiza/endpoints/types.ts
  • packages/wiza/error-handlers.ts
  • packages/wiza/index.ts
  • packages/wiza/schema.test.ts
  • packages/wiza/schema/database.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/wiza/schema/database.ts
  • packages/wiza/README.md
  • packages/wiza/endpoints/types.ts
  • packages/wiza/client.ts
  • packages/wiza/index.ts

Comment thread packages/wiza/error-handlers.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:round-2 Review bot pushed an automated fix core Changes in packages/corsair docs Docs / Mintlify / markdown changes needs-maintainer Automated rounds exhausted - human review needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wiza Integration

3 participants