Skip to content

feat(limits): emit limit webhook events from LimitsService - #864

Merged
Jambox11 merged 1 commit into
mux-labs:mainfrom
Xaxxoo:fix/770-emit-limit-webhook-events
Sep 4, 2026
Merged

feat(limits): emit limit webhook events from LimitsService#864
Jambox11 merged 1 commit into
mux-labs:mainfrom
Xaxxoo:fix/770-emit-limit-webhook-events

Conversation

@Xaxxoo

@Xaxxoo Xaxxoo commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add LIMIT_UPDATED, LIMIT_EXCEEDED, LIMIT_WARNING event types to WebhookEventType enum
  • Add emitLimitUpdated, emitLimitExceeded, emitLimitWarning methods to WebhookEventEmitterService
  • Make WebhookEventEmitterService injection @Optional() in LimitsService with safe optional chaining so the service remains functional in test isolation without webhooks
  • Add unit tests covering webhook emission on limit set, exceeded, and warning scenarios

Closes #770

Test plan

  • Verify emitLimitUpdated is called when limits are created or changed via setLimits()
  • Verify emitLimitExceeded is called when per-transaction or daily limits are exceeded
  • Verify emitLimitWarning is called when daily usage approaches 80% threshold
  • Verify service works without webhook emitter (optional injection)
  • Verify webhook dispatch failures do not propagate to callers

🤖 Generated with Claude Code

Add limit event types (LIMIT_UPDATED, LIMIT_EXCEEDED, LIMIT_WARNING)
to WebhookEventType enum and corresponding emitter methods to
WebhookEventEmitterService.

LimitsService already bridged internal events to the webhook emitter
but the target methods and event types did not exist. This commit adds
them and makes the webhook emitter injection @optional() with safe
optional chaining so the service remains functional without webhooks.

Closes mux-labs#770

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Jambox11
Jambox11 merged commit b7cf050 into mux-labs:main Sep 4, 2026
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.

2 participants