feat(wiza): add wiza plugin - #427
Conversation
|
@yuvrxj-afk is attempting to deploy a commit to the corsair Team on Vercel. A member of the Team first needs to authorize it. |
4ae629c to
1198e53
Compare
1198e53 to
d507e72
Compare
Greptile SummaryThis PR adds the Wiza integration plugin. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (20): Last reviewed commit: "fix(wiza): address CodeRabbit findings" | Re-trigger Greptile |
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
Rule Used: Flag boilerplate residue from the plugin generator... (source)
Rule Used: Every endpoint must validate inputs and outputs wi... (source)
Rule Used: Flag boilerplate residue from the plugin generator... (source)
Rule Used: Flag 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. |
|
DRY RUN — would mark round 2 and run the fix agent now. |
|
DRY RUN — would mark round 2 and run the fix agent now. |
|
DRY RUN — would mark round 2 and run the fix agent now. |
|
DRY RUN — would mark round 2 and run the fix agent now. |
|
Remaining findings are being fixed by a bot commit — it will be re-reviewed automatically. |
Maintainer review neededAutomated rounds are exhausted. Remaining findings:
Rule Used: Flag boilerplate residue from the plugin generator... (source) |
ambikeesshh
left a comment
There was a problem hiding this comment.
LGTM. you can merge it safely @devjain32
|
@greptileai review |
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe 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. ChangesWiza integration
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
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (3)
packages/wiza/client.ts (1)
4-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueThe
codeparameter ofWizaAPIErroris never set.Both throw sites construct
WizaAPIErrorwith a message only. Either populatecodefrom 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 winNo handler retries transient server or network failures.
DEFAULTreturnsmaxRetries: 0. A 5xx response or a dropped connection therefore fails the call immediately. Read endpoints such ascredits.get,lists.get, andprospects.searchare idempotent and can retry safely.Add a
SERVER_ERRORhandler for 5xx with a small retry budget. KeepmaxRetries: 0inDEFAULTfor the non-idempotentindividualReveals.startpath, 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 winConsider narrowing
.loose()on persisted PII entities.
WizaRevealpersists contact PII, includingmobile_phone, andphone_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 inendpoints/types.tsand 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
packages/corsair/core/constants.tspackages/wiza/README.mdpackages/wiza/client.tspackages/wiza/endpoints/credits.tspackages/wiza/endpoints/index.tspackages/wiza/endpoints/individual-reveals.tspackages/wiza/endpoints/lists.tspackages/wiza/endpoints/prospects.tspackages/wiza/endpoints/types.tspackages/wiza/error-handlers.tspackages/wiza/index.tspackages/wiza/jest.config.cjspackages/wiza/package.jsonpackages/wiza/schema.test.tspackages/wiza/schema/database.tspackages/wiza/schema/index.tspackages/wiza/tsconfig.jsonpackages/wiza/tsup.config.ts
|
@greptileai review |
ambikeesshh
left a comment
There was a problem hiding this comment.
code rabbit's findings addressed
lgtm now
There was a problem hiding this comment.
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
📒 Files selected for processing (10)
packages/wiza/README.mdpackages/wiza/client.tspackages/wiza/endpoints/individual-reveals.tspackages/wiza/endpoints/lists.tspackages/wiza/endpoints/prospects.tspackages/wiza/endpoints/types.tspackages/wiza/error-handlers.tspackages/wiza/index.tspackages/wiza/schema.test.tspackages/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
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 creditsindividualReveals.start/individualReveals.get— real-time single-contact enrichment (async: start returns an ID, poll get until finished)lists.get— list processing status and detailsprospects.search— prospect counts and sample profiles by job title, location, company, industryResults 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
pnpm lintand all checks passpnpm typecheckand there are no TypeScript errorspnpm buildand all packages build successfullypnpm testand all tests passScreenshots / 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
Documentation
Tests