feat(webhooks): add lifecycle-event webhooks support - #4
Open
col wants to merge 8 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tidy test Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the E2B lifecycle-event webhooks API — both halves:
E2bEx.Webhooks) — CRUD over/events/webhooks(list/1,create/2,get/2,update/3,delete/2), mirroring the existingE2bEx.Volumesresource and funnelling through the singleE2bEx.RequestHTTP chokepoint. Decoded into the newE2bEx.Webhookstruct.E2bEx.WebhookEvent) — a pure, HTTP-free module that decodes the delivered (snake_case) event payload and verifies its signature:verify_signature/3— plain SHA256 ofsecret <> raw_body, standard base64, trailing=stripped, constant-time compared to thee2b-signatureheader.parse/3— verify-then-decode →{:ok, %WebhookEvent{}} | {:error, :invalid_signature | :invalid_payload}.Notes
openapi.yml(absent from both this repo's copy and upstream E2B's), and the JS/Python SDKs don't implement webhook management either. Source of truth is the E2B docs. Recorded as a gotcha inCLAUDE.md.CLAUDE.md): the inbound payload is already snake_case soWebhookEvent.from_api/1reads keys directly (no camelCase conversion); andparse/3returns atom error reasons rather than%E2bEx.Error{}, since signature/JSON validation is local, not an HTTP failure (mirrors howCommandsdiverges).create/2/update/3return{:error, %E2bEx.Error{reason: :empty_response_body}}instead of crashing if the API returns an empty body (the response shape for these is unconfirmed).Process
Built via the project's superpowers workflow: spec → plan → subagent-driven TDD, with per-task spec+quality reviews and a final whole-branch review.
Test plan
mix test— 150 tests, 0 failures.mix compile --warnings-as-errors— clean.WebhookEvent.from_api/1decoding, and signature/parsecases (valid, tampered body, wrong secret, length mismatch, non-JSON-with-valid-sig).🤖 Generated with Claude Code