feat(sdk): WebhooksAPI.registerTenantWebhook — E9.3 SDK cell - #93
Conversation
…ge register route)
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_87ae2a98-0fc6-4e1f-aa9d-a37b5df64dc8) |
|
Warning Review limit reachedNext included review available in 14 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 90 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Comment |
Reviewer's GuideThis PR completes the E9.3 SDK cell by adding a typed, client-backed tenant webhook registration API, exposing it as wave.webhooks, and covering its construction and POST contract with tests. Sequence diagram for tenant webhook registrationsequenceDiagram
participant App
participant WebhooksAPI
participant WaveClient
participant MailEdge
App->>WebhooksAPI: registerTenantWebhook(request)
WebhooksAPI->>WaveClient: post("/v1/comms/webhooks", request)
WaveClient->>MailEdge: POST /v1/comms/webhooks
MailEdge-->>WaveClient: TenantWebhookRegisterResult
WaveClient-->>WebhooksAPI: TenantWebhookRegisterResult
WebhooksAPI-->>App: { ok, inbox }
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Summary by QodoAdd WebhooksAPI.registerTenantWebhook for mail-edge tenant webhook registration
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
|
The import src/index.ts |
|
Note Automatic reviews are paused because your team has used its included automatic processing for this billing period (headroom scales with your seat count). You can still comment "Gitar review" to run one anytime, and automatic reviews resume on their own by September 1. Add seats for more headroom. Code Review ✅ ApprovedAdds tenant webhook registration to the SDK with dedicated types and client wiring for the mail-edge communications endpoint. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
Failed to generate code suggestions for PR |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a new internal-secret-gated webhook-registration capability and exposes it through the shared Wave client, but the mail-edge-only endpoint conflicts with the client’s single-base-URL model when gateway APIs are also used. The required Unreleased changelog entry is also missing. Not approved because:
Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more. |
Code Review by Qodo
1. CHANGELOG missing webhooks entry
|
| export { WebhooksAPI, createWebhooksAPI } from "./webhooks"; | ||
| export type { TenantWebhookRegisterRequest, TenantWebhookRegisterResult } from "./webhooks"; |
There was a problem hiding this comment.
1. Changelog missing webhooks entry 📘 Rule violation § Compliance
This PR adds a new user-facing API surface (WebhooksAPI / wave.webhooks) but does not add an entry under CHANGELOG.md [Unreleased]. Users will not be able to discover this new SDK feature from release notes.
Agent Prompt
## Issue description
A user-facing SDK change was introduced (new `WebhooksAPI` exports / `wave.webhooks`) without documenting it in `CHANGELOG.md` under the `[Unreleased]` section.
## Issue Context
Compliance requires documenting user-facing changes in the `CHANGELOG.md` Unreleased section.
## Fix Focus Areas
- CHANGELOG.md[7-7]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| // Mail (E5) | ||
| this.mail = new MailAPI(this.client); | ||
| this.comms = new CommsAPI(this.client); | ||
| this.webhooks = new WebhooksAPI(this.client); |
There was a problem hiding this comment.
2. Single baseurl blocks webhooks 🐞 Bug ≡ Correctness
Wave wires WebhooksAPI to the same WaveClient instance as other APIs, but WebhooksAPI is documented to live on the mail-edge origin (not the gateway). Because WaveClient only supports one baseUrl, a Wave configured for the gateway baseUrl cannot successfully call registerTenantWebhook without breaking other gateway-backed APIs on the same instance.
Agent Prompt
### Issue description
`Wave` attaches `webhooks` using the same `WaveClient` instance used for all other APIs. However, `WebhooksAPI` explicitly documents that `/v1/comms/webhooks` is on the mail-edge origin (not the gateway), while other comms endpoints are described as gateway-enforced. Since `WaveClient` has a single `baseUrl`, a single `Wave` instance cannot reliably use both gateway-backed APIs (e.g. `comms`) and mail-edge-only webhooks.
### Issue Context
- `WaveClient` has exactly one `baseUrl`.
- `Wave` constructs exactly one `WaveClient` and passes it to all API surfaces.
- `WebhooksAPI` documents that it must be called against mail-edge, not gateway.
### Fix Focus Areas
Choose one:
1) **Separate client/config for webhooks**: extend `Wave` configuration to accept a dedicated `webhooksBaseUrl` (and likely a dedicated `webhooksApiKey`, since this endpoint is internal-secret gated) and construct `this.webhooks` with a second `WaveClient`.
2) **Do not attach webhooks to `Wave`**: remove `wave.webhooks` wiring and require consumers to use `new WebhooksAPI(createClient({ baseUrl: mailEdgeUrl, apiKey: internalSecret }))` so gateway usage isn’t accidentally broken.
3) **If gateway actually proxies it**: update the `WebhooksAPI` docs to remove the “not the gateway” claim.
- src/index.ts[546-606]
- src/webhooks.ts[1-10]
- src/client.ts[156-172]
- src/comms.ts[4-7]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_890b3d1a-3ad7-4615-81a2-03010b3f5c88) |
Qodo Fixer🍒 Ready to be cherry-picked — ✅ Merged (0) · ☑ Fixed (2) 🔗 Fix PR: #94 This fix PR was closed automatically. Its branch is preserved so you can cherry pick the changes into the original PR. Prompt for coding agent Process — 2 fixed
|


User description
feat(sdk): WebhooksAPI.registerTenantWebhook — E9.3 SDK cell
WHAT
wave.webhooks.registerTenantWebhook({ inbox, url, secret })POSTs the mail-edge's POST /v1/comms/webhooks (internal-secret-gated tenant-webhook registration; the E9.3 fan-out API). Types carry the contract: inbox email, https URL, 32+ char HMAC secret; the result is { ok, inbox }. The endpoint lives on the mail-edge origin, so construct the client with baseUrl pointed at it — the doc comment says so, and the default gateway client would 404 on this path (named, not silent).WHY
The four-renderings law: E9.3 shipped its API cell (wave-mail-edge, deployed + live-probed) and its CLI cell (wave-cli PR #64, in CI). This closes the SDK cell. The console cell is deliberately skipped — webhook registration is a control-plane action; the SDK + CLI are the right surfaces (recorded in the epic).
HOW
VERIFICATION
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Additive thin HTTP wrapper and exports with unit tests; no changes to existing client or auth logic in the SDK.
Overview
Adds the E9.3 SDK cell for tenant webhook registration:
wave.webhooks.registerTenantWebhook({ inbox, url, secret })POSTs/v1/comms/webhooksvia a newWebhooksAPImodule, with typed request/result exports andcreateWebhooksAPIfactory.The
Waveclient now exposeswebhooksalongsidecomms, wired in the constructor like other API cells. Docs on the module call out that this route is on the mail-edge origin (not the default gateway), so callers must pointbaseUrlat mail-edge and use the internal secret as the client API key.Tests cover construction (class + factory) and that registration sends the expected path and JSON body.
Reviewed by Cursor Bugbot for commit b020836. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by Sourcery
Add tenant webhook registration to the SDK as a mail-edge-backed Webhooks API.
New Features:
Tests:
PR Type
Enhancement
Description
Adds WebhooksAPI for tenant webhook registration
Implements registerTenantWebhook method with type safety
Adds test suite for API construction and endpoint interaction
Exposes webhooks API surface via Wave class
Diagram Walkthrough
File Walkthrough
webhooks.test.ts
WebhooksAPI test implementationsrc/tests/webhooks.test.ts
index.ts
WebhooksAPI export integrationsrc/index.ts
webhooks.ts
WebhooksAPI implementationsrc/webhooks.ts