Skip to content

fix(webhooks): count test webhooks towards usage limit - #2143

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/bill
Dec 1, 2025
Merged

fix(webhooks): count test webhooks towards usage limit#2143
waleedlatif1 merged 1 commit into
stagingfrom
fix/bill

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • count test webhooks towards usage limit

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Dec 1, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedDec 1, 2025 4:04am

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Removed the skipUsageLimits parameter that was being set based on testMode in webhook preprocessing, ensuring test webhooks now count towards usage limits.

Key Changes:

  • Test webhooks previously bypassed usage limit checks by passing skipUsageLimits: testMode to preprocessExecution()
  • After this change, test webhooks go through the full usage validation in checkServerSideUsageLimits()
  • Test webhooks still have testMode flag set for other processing logic and logging purposes
  • Rate limiting and deployment checks remain active for test webhooks (unchanged)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a simple, well-scoped bug fix that correctly enforces usage limits on test webhooks
  • The change is a single-line removal that closes a loophole where test webhooks could bypass usage limits. The logic is straightforward: removing skipUsageLimits: testMode ensures the default behavior (usage checks enabled) applies to all webhook executions including tests. This aligns with the PR's stated goal and doesn't introduce any breaking changes to the existing flow.
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/lib/webhooks/processor.ts5/5Removed skipUsageLimits: testMode parameter from preprocessing to ensure test webhooks count towards usage limits

Sequence Diagram

sequenceDiagram
participant Client
participant TestAPI as Test Webhook API
participant Processor as Webhook Processor
participant Preprocessing as preprocessExecution
participant UsageMonitor as Usage Monitor
participant Queue as Execution Queue
Client->>TestAPI: POST /api/webhooks/test/{id}
TestAPI->>TestAPI: verifyTestWebhookToken()
TestAPI->>Processor: checkWebhookPreprocessing(testMode=true)
Note over Processor: Before PR: skipUsageLimits=testMode<br/>After PR: skipUsageLimits removed
Processor->>Preprocessing: preprocessExecution({<br/>checkRateLimit: true,<br/>checkDeployment: true<br/>})
Preprocessing->>Preprocessing: Validate workflow exists
Preprocessing->>Preprocessing: Check deployment status
Preprocessing->>Preprocessing: Resolve billing actor
Preprocessing->>Preprocessing: Get user subscription
Preprocessing->>Preprocessing: Check rate limits
alt Before PR (skipUsageLimits=true)
Preprocessing-->>Preprocessing: Skip usage check
else After PR (skipUsageLimits not set)
Preprocessing->>UsageMonitor: checkServerSideUsageLimits(actorUserId)
UsageMonitor-->>Preprocessing: Usage status
alt Usage exceeded
Preprocessing-->>TestAPI: Error 402: Usage limit exceeded
TestAPI-->>Client: 402 Payment Required
end
end
Preprocessing-->>Processor: Success
Processor->>Queue: queueWebhookExecution(testMode=true)
Queue-->>Client: 200 OK: Webhook processed
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
waleedlatif1 merged commit 7f62467 into stagingDec 1, 2025
9 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/bill branch December 1, 2025 05:14
waleedlatif1 added a commit that referenced this pull request Dec 1, 2025
… sendgrid, linkedin, more tools (#2148)
* feat(tools): added smtp, sendgrid, mailgun, linkedin, fixed permissions in context menu (#2133)
* feat(tools): added twilio sendgrid integration
* feat(tools): added smtp, sendgrid, mailgun, fixed permissions in context menu
* added top level mocks for sporadically failing tests
* incr type safety
* fix(team-plans): track departed member usage so value not lost (#2118)
* fix(team-plans): track departed member usage so value not lost
* reset usage to 0 when they leave team
* prep merge with stagig
* regen migrations
* fix org invite + ws selection'
---------
Co-authored-by: Waleed <walif6@gmail.com>
* feat(i18n): update translations (#2134)
Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>
* feat(creators): add verification for creators (#2135)
* feat(tools): added apify block/tools (#2136)
* feat(tools): added apify
* cleanup
* feat(i18n): update translations (#2137)
Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>
* feat(env): added more optional env var examples (#2138)
* feat(statuspage): added statuspage, updated list of tools in footer, renamed routes (#2139)
* feat(statuspage): added statuspage, updated list of tools in footer, renamed routes
* ack PR comments
* feat(tools): add generic search tool (#2140)
* feat(i18n): update translations (#2141)
* fix(sdks): bump sdk versions (#2142)
* fix(webhooks): count test webhooks towards usage limit (#2143)
* fix(bill): add requestId to webhook processing (#2144)
* improvement(subflow): remove all associated edges when moving a block into a subflow (#2145)
* improvement(subflow): remove all associated edges when moving a block into a subflow
* ack PR comments
* fix(polling): mark webhook failed on webhook trigger errors (#2146)
* fix(deps): declare core transient deps explicitly (#2147)
* fix(deps): declare core transient deps explicitly
* ack PR comments
---------
Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@waleedlatif1