feat(engine): events_emit_raw — deliver provider-shaped webhook bodies - #55
Merged
Conversation
Some providers' webhook receivers parse the delivery as the provider's
own event object (Stripe's id/object/type/data, GitHub's event JSON),
so the {type, payload} envelope breaks their SDK parsers even when the
signature verifies. EmitRaw delivers an exact pre-marshaled body with
Emit's retry/header/validation semantics; the events_emit_raw builtin
exposes it to Starlark. Found by dogfooding a real stripe-node receiver
against the stripe-style adapter.
stripe-style _signed_emit now delivers the full Stripe event object —
the same bytes are MAC'd and POSTed, so webhooks.constructEvent and
signature checks both run against the real shape. Engine test proves
raw delivery is verbatim while events_emit keeps the envelope; stripe
webhook tests assert data.object payloads now.
Also corrects the stunt llm reference: the predeclared json module is
json.decode/json.encode, not loads/dumps.
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.
Some webhook receivers parse the delivery as the provider's own event object (Stripe:
{"id","object":"event","type","data":{"object":…}}; GitHub similar) — the engine's{type, payload}envelope broke their SDK parsers even where the signature verified.Emitter.EmitRaw— delivers exact pre-marshaled bytes with Emit's retry/header/validation semantics;Emitnow delegates to it after envelope marshal (byte-identical behavior for every existing adapter).events_emit_raw(event_type, body, headers?)builtin._signed_emitdelivers the full Stripe event object; the same serialized bytes feed the HMAC and the POST, sowebhooks.constructEvent(payload, sig, secret)verifies AND parses on the receiver — found by dogfooding a real stripe-node webhook receiver end-to-end.events_emitunchanged; stripe webhook tests now assertdata.objectpayloads.stunt llmreference corrected: the predeclared json module isjson.decode/json.encode, not loads/dumps.Gates: full suite, adapter lint (94), gofmt, vet — green.