Skip to content

feat: implement webhook signing and delivery#482

Merged
niteshpurohit merged 52 commits intomainfrom
feat/versioned-outbound-event-schemas-and-webhook-signing-conventions
May 2, 2026
Merged

feat: implement webhook signing and delivery#482
niteshpurohit merged 52 commits intomainfrom
feat/versioned-outbound-event-schemas-and-webhook-signing-conventions

Conversation

@niteshpurohit
Copy link
Copy Markdown
Member

@niteshpurohit niteshpurohit commented Apr 30, 2026

  • Introduced Karya::OutboundEvents module to handle versioned outbound events.
  • Added WebhookSigner and WebhookVerifier classes for signing and verifying webhook payloads.
  • Implemented CloudEvents-compatible JSON envelope for outbound events.
  • Created Dispatcher class to manage delivery of signed events.
  • Enhanced Worker and WorkerSupervisor runtimes to support outbound event dispatching.
  • Added tests for outbound event functionality, including signing, verification, and error handling.
  • Updated documentation to include outbound events and webhook signing conventions.

closes: #372
closes: #397
closes: #391

- Introduced Karya::OutboundEvents module to handle versioned outbound events.
- Added WebhookSigner and WebhookVerifier classes for signing and verifying webhook payloads.
- Implemented CloudEvents-compatible JSON envelope for outbound events.
- Created Dispatcher class to manage delivery of signed events.
- Enhanced Worker and WorkerSupervisor runtimes to support outbound event dispatching.
- Added tests for outbound event functionality, including signing, verification, and error handling.
- Updated documentation to include outbound events and webhook signing conventions.

closes: #372
@niteshpurohit niteshpurohit self-assigned this Apr 30, 2026
Copilot AI review requested due to automatic review settings April 30, 2026 02:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a canonical, versioned outbound event contract for Karya runtime instrumentation, with CloudEvents-compatible envelopes and optional HMAC-based webhook signing/verification, and wires dispatching into Worker and WorkerSupervisor runtimes.

Changes:

  • Added Karya::OutboundEvents with schema cataloging, CloudEvents envelope building, delivery serialization, and dispatcher plumbing.
  • Implemented webhook signing (WebhookSigner/WebhookSignature) and verification (WebhookVerifier) conventions.
  • Updated worker/supervisor runtimes, RBS, docs, and added specs covering outbound event behavior.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/pages/runtime/outbound-events.md New documentation page defining outbound event envelope, versioning, and signing headers.
docs/pages/runtime/index.md Adds Outbound Events to runtime navigation and scope list.
docs/pages/observability.md References outbound event schema versioning and links to outbound events docs.
docs/pages/architecture.md Positions outbound eventing + signing as part of the core runtime contract.
docs/index.md Adds Outbound Events entry to top-level docs index.
core/karya/spec/karya_spec.rb Ensures global outbound event dispatcher config is restored between specs.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds coverage for outbound dispatch success + failure logging in supervisor runtime.
core/karya/spec/karya/worker/runtime_spec.rb Adds coverage for outbound dispatch success + failure logging in worker runtime.
core/karya/spec/karya/outbound_events_spec.rb New unit specs for schema cataloging, envelopes, signing, verification, dispatcher, and normalizers.
core/karya/lib/karya/worker_supervisor/runtime.rb Adds outbound_event_dispatcher support and emits outbound events on instrumentation.
core/karya/lib/karya/worker/runtime.rb Adds outbound_event_dispatcher support and emits outbound events on instrumentation.
core/karya/lib/karya/outbound_events.rb Introduces the OutboundEvents entrypoint and error classes.
core/karya/lib/karya/outbound_events/schema_catalog.rb Defines supported event mappings and payload validation/normalization.
core/karya/lib/karya/outbound_events/schema.rb Adds immutable schema identity value object.
core/karya/lib/karya/outbound_events/event.rb Adds CloudEvents-compatible envelope + JSON serialization.
core/karya/lib/karya/outbound_events/delivery.rb Adds serialized delivery with canonical headers/body and optional signature.
core/karya/lib/karya/outbound_events/dispatcher.rb Adds dispatcher to build/sign deliveries and hand them off to a handler.
core/karya/lib/karya/outbound_events/values.rb Adds normalizers for strings, timestamps, and JSON-compatible payloads.
core/karya/lib/karya/outbound_events/webhook_signature.rb Adds immutable signature metadata + header rendering.
core/karya/lib/karya/outbound_events/webhook_signer.rb Adds HMAC signature generation for webhook bodies.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Adds signature parsing + constant-time verification + timestamp skew enforcement.
core/karya/lib/karya/base.rb Adds global outbound_event_dispatcher configuration entrypoint.
core/karya/lib/karya.rb Requires karya/outbound_events.
core/karya/sig/karya/base.rbs Adds global outbound_event_dispatcher reader/configure signature.
core/karya/sig/karya.rbs Adds outbound-event-related types and dispatcher callable type alias.
core/karya/sig/karya/outbound_events.rbs Adds RBS for outbound events module and its classes.
core/karya/sig/karya/worker/runtime.rbs Adds outbound_event_dispatcher option/reader typing.
core/karya/sig/karya/worker_supervisor/runtime.rbs Adds outbound_event_dispatcher option/reader typing.
Comments suppressed due to low confidence (2)

core/karya/lib/karya/worker/runtime.rb:65

  • Runtime#instrument now returns the return value of emit_outbound_event (e.g., a Karya::OutboundEvents::Delivery from the dispatcher). This changes the method’s contract and also conflicts with the RBS signature which declares a nil return. Consider explicitly returning nil after emitting (or update the RBS + any callers if a non-nil return is intended).
      def instrument(event, payload)
        emit_instrumentation(event, payload)
        emit_outbound_event(event, payload)
      rescue StandardError => e
        logger.error('instrumentation failed', event:, error_class: e.class.name, error_message: e.message)
        nil
      end

core/karya/lib/karya/worker_supervisor/runtime.rb:121

  • Runtime#instrument now returns the return value of emit_outbound_event (e.g., a Karya::OutboundEvents::Delivery from the dispatcher), which changes the method’s contract and conflicts with the RBS signature declaring nil. Consider explicitly returning nil after emitting (or update the RBS + any callers if a non-nil return is intended).
      def instrument(event, payload)
        emit_instrumentation(event, payload)
        emit_outbound_event(event, payload)
      rescue StandardError => e
        logger.error('instrumentation failed', event:, error_class: e.class.name, error_message: e.message)
        nil
      end

Comment thread core/karya/lib/karya/outbound_events/event.rb
Comment thread core/karya/sig/karya/outbound_events.rbs Outdated
Comment thread core/karya/sig/karya.rbs Outdated
Comment thread core/karya/sig/karya.rbs Outdated
- Added support for JSON state arguments in the `to_json` method of outbound events.
- Updated `outbound_event_attributes` type to remove nil option for better type safety.
- Included a new test to verify JSON serialization with state arguments.
- Added support for an optional subject_key in the outbound_event_schema_definition.
- Improved flexibility of event schema to accommodate additional metadata.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements Karya’s outbound event delivery contract as a first-class, versioned, CloudEvents-compatible surface, including webhook signing/verification and runtime hooks for dispatching these events from worker and supervisor instrumentation.

Changes:

  • Added Karya::OutboundEvents (schema catalog, CloudEvents envelope, dispatcher, webhook signing + verification, delivery abstraction).
  • Wired outbound_event_dispatcher into Worker::Runtime and WorkerSupervisor::Runtime instrumentation paths with global configuration support.
  • Added specs, RBS signatures, and documentation for outbound event contracts and signing conventions.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
docs/pages/runtime/outbound-events.md New documentation page describing outbound events and signing conventions.
docs/pages/runtime/index.md Adds outbound events to runtime docs navigation and scope.
docs/pages/observability.md Connects outbound events to observability documentation and links to the new page.
docs/pages/architecture.md Frames outbound events/signing as part of the runtime contract.
docs/index.md Adds outbound events to the main docs index.
core/karya/spec/karya_spec.rb Extends global configuration spec coverage to include outbound event dispatcher.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds coverage for supervisor runtime outbound event dispatch and error swallowing.
core/karya/spec/karya/worker/runtime_spec.rb Adds coverage for worker runtime outbound event dispatch and error swallowing.
core/karya/spec/karya/outbound_events_spec.rb New comprehensive specs for schemas, envelope, dispatcher, signer, verifier, and normalizers.
core/karya/sig/karya/worker_supervisor/runtime.rbs Adds outbound event dispatcher to supervisor runtime signature and option keys.
core/karya/sig/karya/worker/runtime.rbs Adds outbound event dispatcher to worker runtime signature and option keys.
core/karya/sig/karya/outbound_events.rbs New RBS signatures for the outbound events subsystem.
core/karya/sig/karya/base.rbs Adds global outbound event dispatcher config/reader to Karya base signatures.
core/karya/sig/karya.rbs Introduces outbound event payload/signature-related types and dispatcher type.
core/karya/lib/karya/worker_supervisor/runtime.rb Emits outbound events alongside instrumentation with error isolation + configuration.
core/karya/lib/karya/worker/runtime.rb Emits outbound events alongside instrumentation with error isolation + configuration.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implements webhook signature verification with timestamp skew enforcement.
core/karya/lib/karya/outbound_events/webhook_signer.rb Implements HMAC webhook signing for outbound deliveries.
core/karya/lib/karya/outbound_events/webhook_signature.rb Adds immutable signature metadata + headers builder.
core/karya/lib/karya/outbound_events/values.rb Adds value/payload normalization utilities used across outbound event construction.
core/karya/lib/karya/outbound_events/schema_catalog.rb Defines supported event mappings and builds versioned events from instrumentation.
core/karya/lib/karya/outbound_events/schema.rb Adds immutable schema identity object.
core/karya/lib/karya/outbound_events/event.rb Implements CloudEvents-compatible envelope and JSON serialization.
core/karya/lib/karya/outbound_events/dispatcher.rb Builds deliveries, optionally signs them, and calls the delivery handler.
core/karya/lib/karya/outbound_events/delivery.rb Provides serialized body + headers for delivery.
core/karya/lib/karya/outbound_events.rb Entry point wiring outbound events files and error classes.
core/karya/lib/karya/base.rb Adds global outbound event dispatcher configuration on Karya.
core/karya/lib/karya.rb Requires the outbound events entry point.

Comment thread core/karya/sig/karya/outbound_events.rbs Outdated
Comment thread core/karya/sig/karya.rbs Outdated
Comment thread core/karya/lib/karya/outbound_events/values.rb
Comment thread core/karya/lib/karya/outbound_events/webhook_signer.rb Outdated
Comment thread core/karya/lib/karya/outbound_events/event.rb Outdated
Comment thread core/karya/lib/karya/outbound_events/dispatcher.rb
Comment thread core/karya/sig/karya/outbound_events.rbs Outdated
- Normalize signer input during Dispatcher initialization to ensure it is a valid WebhookSigner instance, improving error handling.
- Update sign method in WebhookSigner to validate body input, rejecting non-string and empty values to prevent invalid signatures.
- Modify to_json method in Event to accept a state parameter for better JSON serialization.
- Introduce new JSON::State class in json.rbs for future enhancements.
- Update type definitions in karya.rbs and outbound_events.rbs for improved type safety and clarity.
- Add tests to verify correct behavior of signing and validation logic, ensuring robustness against invalid inputs.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements Karya’s outbound runtime events as a versioned external contract, including a CloudEvents-compatible JSON envelope and webhook signing/verification to support safe delivery to external consumers (Issue #372).

Changes:

  • Added Karya::OutboundEvents (schema catalog, CloudEvents envelope, delivery builder, dispatcher) plus webhook signing/verifying primitives.
  • Wired outbound event dispatching into Worker::Runtime and WorkerSupervisor::Runtime instrumentation flow, with logging/error-swallowing behavior.
  • Added specs and documentation covering outbound event shape, versioning, and signing conventions.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/pages/runtime/outbound-events.md New runtime doc page describing outbound event contract, envelope fields, schema/versioning, and signing headers.
docs/pages/runtime/index.md Adds outbound events to the runtime section index and scope bullets.
docs/pages/observability.md Links observability to outbound event schema/versioning and verification conventions.
docs/pages/architecture.md Positions outbound eventing/signing as part of the shared runtime contract.
docs/index.md Adds a top-level docs link to the outbound events page.
core/karya/spec/karya_spec.rb Extends global configuration spec to cover outbound_event_dispatcher.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds coverage for outbound event dispatch + error swallowing in supervisor runtime.
core/karya/spec/karya/worker/runtime_spec.rb Adds coverage for outbound event dispatch + error swallowing in worker runtime.
core/karya/spec/karya/outbound_events_spec.rb New unit specs for schemas, envelope serialization, signing, verification, dispatcher, and value normalizers.
core/karya/sig/karya/worker_supervisor/runtime.rbs Adds outbound_event_dispatcher option/reader to supervisor runtime signature.
core/karya/sig/karya/worker/runtime.rbs Adds outbound_event_dispatcher option/reader to worker runtime signature.
core/karya/sig/karya/outbound_events.rbs New RBS for outbound events module (schemas, event, delivery, signer/verifier, dispatcher).
core/karya/sig/karya/base.rbs Adds global outbound_event_dispatcher config/reader typing.
core/karya/sig/karya.rbs Adds outbound event-related type aliases and dispatcher callable type.
core/karya/sig/json.rbs Adds a minimal JSON::State signature needed by Event#to_json typing.
core/karya/lib/karya/worker_supervisor/runtime.rb Adds outbound event dispatcher dependency and emission in supervisor runtime instrument.
core/karya/lib/karya/worker/runtime.rb Adds outbound event dispatcher dependency and emission in worker runtime instrument.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implements webhook verification (timestamp window + signature parsing + constant-time compare).
core/karya/lib/karya/outbound_events/webhook_signer.rb Implements webhook signing (HMAC-SHA256) and signature metadata creation.
core/karya/lib/karya/outbound_events/webhook_signature.rb Defines immutable signature metadata + header serialization.
core/karya/lib/karya/outbound_events/values.rb Adds normalizers for strings/timestamps/JSON payload values used across outbound events.
core/karya/lib/karya/outbound_events/schema_catalog.rb Maps instrumentation events to versioned outbound event schemas and builds events.
core/karya/lib/karya/outbound_events/schema.rb Defines immutable schema identity for outbound events.
core/karya/lib/karya/outbound_events/event.rb Implements CloudEvents-compatible envelope + validation and JSON serialization.
core/karya/lib/karya/outbound_events/dispatcher.rb Builds deliveries from instrumentation events, optionally signs them, and calls a delivery handler.
core/karya/lib/karya/outbound_events/delivery.rb Defines immutable delivery (body + headers) for outbound dispatch.
core/karya/lib/karya/outbound_events.rb Adds the outbound events entrypoint and error types; requires outbound event components.
core/karya/lib/karya/base.rb Adds global configure_outbound_event_dispatcher + reader.
core/karya/lib/karya.rb Requires outbound events from the main entrypoint.

Comment thread core/karya/lib/karya/outbound_events/dispatcher.rb
Comment thread core/karya/sig/karya/outbound_events.rbs
Comment thread core/karya/sig/karya.rbs
Comment thread docs/pages/runtime/outbound-events.md Outdated
Comment thread core/karya/lib/karya/outbound_events/delivery.rb Outdated
- Refactor Delivery class to serialize normalized event instead of raw input for consistency.
- Enhance dispatcher with required dependencies for better modularity.
- Update RBS definitions for webhook headers input to clarify expected types.
- Modify outbound event attributes to ensure correct data types.
- Improve documentation on webhook signing conventions for clarity on signature input structure.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements Karya’s outbound event contract as a first-class runtime surface, including a CloudEvents-compatible envelope, versioned payload schemas, and webhook signing/verification, with worker and supervisor runtimes able to dispatch signed deliveries to a configured handler.

Changes:

  • Added Karya::OutboundEvents with schema catalog, CloudEvents envelope, deliveries, dispatcher, and webhook signing/verifying.
  • Wired outbound event dispatch into Worker::Runtime and WorkerSupervisor::Runtime, plus global configuration on Karya.
  • Added specs and documentation describing the outbound event contract and signing conventions.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/pages/runtime/outbound-events.md New runtime docs page describing the outbound event envelope, versioning, and signing headers/base string.
docs/pages/runtime/index.md Adds outbound events to the runtime docs index and scope summary.
docs/pages/observability.md Links observability story to outbound events and schema versioning.
docs/pages/architecture.md Documents outbound eventing as part of the shared runtime contract.
docs/index.md Adds top-level docs entry pointing to outbound events.
core/karya/spec/karya_spec.rb Extends global configuration spec to cover outbound event dispatcher default.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds runtime spec coverage for outbound dispatch success and failure logging.
core/karya/spec/karya/worker/runtime_spec.rb Adds runtime spec coverage for outbound dispatch success and failure logging.
core/karya/spec/karya/outbound_events_spec.rb New unit specs for schema catalog, event envelope, delivery, signer/verifier, dispatcher, and value normalizers.
core/karya/sig/karya/worker_supervisor/runtime.rbs Types new outbound_event_dispatcher runtime option/reader.
core/karya/sig/karya/worker/runtime.rbs Types new outbound_event_dispatcher runtime option/reader.
core/karya/sig/karya/outbound_events.rbs Adds RBS for outbound events API, value normalizers, and signing/verifying classes.
core/karya/sig/karya/base.rbs Adds global outbound_event_dispatcher config/reader typing.
core/karya/sig/karya.rbs Introduces outbound event-related shared types and dispatcher callable type.
core/karya/sig/json.rbs Adds minimal JSON::State type used by event JSON serialization signatures.
core/karya/lib/karya/worker_supervisor/runtime.rb Adds outbound event dispatcher option and emits outbound events alongside instrumentation.
core/karya/lib/karya/worker/runtime.rb Adds outbound event dispatcher option and emits outbound events alongside instrumentation.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implements verification of signed webhook payloads with timestamp skew enforcement.
core/karya/lib/karya/outbound_events/webhook_signer.rb Implements HMAC-based signing using timestamp/body base string.
core/karya/lib/karya/outbound_events/webhook_signature.rb Defines immutable signature metadata and canonical signature headers.
core/karya/lib/karya/outbound_events/values.rb Adds normalizers for present/optional strings, timestamps, and JSON-compatible hashes.
core/karya/lib/karya/outbound_events/schema_catalog.rb Maps internal runtime events to versioned outbound schemas and builds envelopes.
core/karya/lib/karya/outbound_events/schema.rb Defines immutable schema identity object.
core/karya/lib/karya/outbound_events/event.rb Implements CloudEvents-compatible envelope and JSON serialization.
core/karya/lib/karya/outbound_events/dispatcher.rb Builds deliveries, signs them, and hands off to configured delivery handler.
core/karya/lib/karya/outbound_events/delivery.rb Defines immutable delivery (headers + canonical JSON body).
core/karya/lib/karya/outbound_events.rb Adds outbound events entrypoint, requires, and shared error classes.
core/karya/lib/karya/base.rb Adds global configuration for outbound_event_dispatcher.
core/karya/lib/karya.rb Requires outbound events from the gem entrypoint.
Comments suppressed due to low confidence (2)

core/karya/lib/karya/worker/runtime.rb:65

  • instrument rescues instrumentation exceptions at the method level, so if emit_instrumentation raises, emit_outbound_event is never attempted. That makes outbound event delivery dependent on the instrumenter being healthy. Consider isolating error handling so outbound event dispatch still runs even when instrumentation fails (and log each failure separately).
      def instrument(event, payload)
        emit_instrumentation(event, payload)
        emit_outbound_event(event, payload)
      rescue StandardError => e
        logger.error('instrumentation failed', event:, error_class: e.class.name, error_message: e.message)
        nil
      end

core/karya/lib/karya/worker_supervisor/runtime.rb:121

  • instrument rescues at the outer method level, so an exception in emit_instrumentation prevents emit_outbound_event from running. Since outbound events are a separate external contract, it’s safer to ensure dispatch is attempted even if the instrumenter fails (with independent rescue/logging for each path).
      def instrument(event, payload)
        emit_instrumentation(event, payload)
        emit_outbound_event(event, payload)
      rescue StandardError => e
        logger.error('instrumentation failed', event:, error_class: e.class.name, error_message: e.message)
        nil
      end

Comment thread core/karya/lib/karya/outbound_events/dispatcher.rb Outdated
Comment thread core/karya/sig/karya.rbs
- Added a body parameter to the Delivery class initializer to allow custom event body serialization.
- Implemented normalize_body method to validate and freeze the body input.
- Updated dispatcher to pass the body when creating a Delivery instance.
- Enhanced tests to validate body handling and ensure correct serialization during dispatch.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a first-class outbound event contract to core/karya, including CloudEvents-compatible envelopes and webhook-style signing/verification, and wires event dispatching into worker and supervisor runtimes for external delivery.

Changes:

  • Introduces Karya::OutboundEvents (schemas, envelope, delivery, dispatcher) plus HMAC-based webhook signing and verification.
  • Extends worker + supervisor runtimes (and global Karya config) to support an outbound_event_dispatcher.
  • Adds specs and documentation for the outbound event contract and signing conventions.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
docs/pages/runtime/outbound-events.md New runtime documentation for outbound events + signing headers/base string.
docs/pages/runtime/index.md Adds outbound events to runtime section navigation and scope.
docs/pages/observability.md Links observability story to outbound event versioning.
docs/pages/architecture.md Positions outbound eventing as part of the shared runtime contract.
docs/index.md Adds outbound events to top-level docs index.
core/karya/spec/karya_spec.rb Ensures global outbound dispatcher config is reset between specs.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Tests supervisor outbound dispatch + error swallowing/logging.
core/karya/spec/karya/worker/runtime_spec.rb Tests worker outbound dispatch + error swallowing/logging.
core/karya/spec/karya/outbound_events_spec.rb Comprehensive unit tests for schema catalog, envelope, delivery, signing, verification, dispatcher, and normalizers.
core/karya/sig/karya/worker_supervisor/runtime.rbs Adds outbound_event_dispatcher option + reader typing.
core/karya/sig/karya/worker/runtime.rbs Adds outbound_event_dispatcher option + reader typing.
core/karya/sig/karya/outbound_events.rbs New RBS for the outbound events surface area.
core/karya/sig/karya/base.rbs Types global Karya.outbound_event_dispatcher configuration.
core/karya/sig/karya.rbs Adds dispatcher interface + outbound-event-related type aliases.
core/karya/sig/json.rbs Adds minimal JSON::State type for signatures.
core/karya/lib/karya/worker_supervisor/runtime.rb Emits outbound events alongside instrumentation via configured dispatcher.
core/karya/lib/karya/worker/runtime.rb Emits outbound events alongside instrumentation via configured dispatcher.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implements timestamp-window + secure-compare verification.
core/karya/lib/karya/outbound_events/webhook_signer.rb Implements HMAC signing over "#{timestamp}.#{body}".
core/karya/lib/karya/outbound_events/webhook_signature.rb Provides immutable signature metadata + canonical headers.
core/karya/lib/karya/outbound_events/values.rb Shared normalizers for strings/timestamps/JSON-hash payloads.
core/karya/lib/karya/outbound_events/schema_catalog.rb Maps instrumentation event names to versioned outbound schema definitions.
core/karya/lib/karya/outbound_events/schema.rb Immutable schema identity object.
core/karya/lib/karya/outbound_events/event.rb CloudEvents-compatible envelope + JSON serialization.
core/karya/lib/karya/outbound_events/dispatcher.rb Builds deliveries (signed/unsigned) and invokes a delivery handler.
core/karya/lib/karya/outbound_events/delivery.rb Represents immutable outbound delivery (headers/body/event).
core/karya/lib/karya/outbound_events.rb Entrypoint wiring + error classes for outbound events.
core/karya/lib/karya/base.rb Adds global configure_outbound_event_dispatcher.
core/karya/lib/karya.rb Requires outbound events from the main library entrypoint.

Comment thread core/karya/lib/karya/worker_supervisor/runtime.rb Outdated
Comment thread core/karya/lib/karya/worker_supervisor/runtime.rb
Comment thread core/karya/sig/karya/worker/runtime.rbs
Comment thread core/karya/sig/karya/worker_supervisor/runtime.rbs
Comment thread core/karya/sig/karya/outbound_events.rbs Outdated
Comment thread core/karya/lib/karya/outbound_events/dispatcher.rb Outdated
Comment thread core/karya/lib/karya/worker/runtime.rb Outdated
Comment thread core/karya/lib/karya/worker/runtime.rb
- Removed unnecessary error handling in the dispatcher methods to streamline the code.
- Added error handling for instrumentation failures and unsupported outbound events to ensure robustness.
- Updated the JSON serialization method to accept new option hashes for better flexibility.
- Enhanced tests to verify that outbound events are dispatched correctly even when errors occur.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements a first-class outbound event contract in core/karya, including CloudEvents-compatible envelopes, versioned schema mapping for supported runtime events, and HMAC-based webhook signing/verification with runtime hooks for dispatching these events.

Changes:

  • Added Karya::OutboundEvents (schema catalog, event envelope, dispatcher, delivery, signer/verifier, and value normalizers).
  • Wired outbound dispatch into Worker and WorkerSupervisor runtimes with global configuration support.
  • Added extensive specs plus documentation pages/links describing the outbound event and signing conventions.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/pages/runtime/outbound-events.md New runtime documentation for outbound events + signing.
docs/pages/runtime/index.md Adds outbound events to runtime nav/summary.
docs/pages/observability.md Links observability docs to outbound events.
docs/pages/architecture.md Notes outbound eventing as core contract.
docs/index.md Adds docs index link to outbound events.
core/karya/spec/karya_spec.rb Resets global outbound dispatcher in spec harness.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds supervisor runtime outbound dispatch specs.
core/karya/spec/karya/worker/runtime_spec.rb Adds worker runtime outbound dispatch specs.
core/karya/spec/karya/outbound_events_spec.rb New unit specs for outbound event subsystem.
core/karya/sig/karya/worker_supervisor/runtime.rbs Types new outbound_event_dispatcher runtime dependency.
core/karya/sig/karya/worker/runtime.rbs Types new outbound_event_dispatcher runtime dependency.
core/karya/sig/karya/outbound_events.rbs Adds RBS for outbound event subsystem.
core/karya/sig/karya/base.rbs Types global outbound dispatcher config/accessors.
core/karya/sig/karya.rbs Adds outbound dispatcher interface + outbound event types.
core/karya/sig/json.rbs Adds minimal JSON::State signature.
core/karya/lib/karya/worker_supervisor/runtime.rb Emits outbound events alongside instrumentation.
core/karya/lib/karya/worker/runtime.rb Emits outbound events alongside instrumentation.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implements webhook signature verification logic.
core/karya/lib/karya/outbound_events/webhook_signer.rb Implements canonical webhook signing scheme.
core/karya/lib/karya/outbound_events/webhook_signature.rb Encapsulates signature metadata + headers.
core/karya/lib/karya/outbound_events/values.rb Adds normalization helpers (strings, timestamps, JSON).
core/karya/lib/karya/outbound_events/schema_catalog.rb Maps instrumentation events to versioned schemas.
core/karya/lib/karya/outbound_events/schema.rb Defines immutable schema identity object.
core/karya/lib/karya/outbound_events/event.rb Defines CloudEvents-compatible event envelope.
core/karya/lib/karya/outbound_events/dispatcher.rb Builds/sends deliveries (optionally signed).
core/karya/lib/karya/outbound_events/delivery.rb Delivery container for body + headers + signature.
core/karya/lib/karya/outbound_events.rb Entrypoint + error types for outbound events.
core/karya/lib/karya/base.rb Adds global outbound dispatcher configuration.
core/karya/lib/karya.rb Requires outbound events from main entrypoint.

Comment thread core/karya/lib/karya/outbound_events/values.rb Outdated
Comment thread core/karya/lib/karya/outbound_events/dispatcher.rb
Comment thread core/karya/lib/karya/outbound_events/delivery.rb
Comment thread core/karya/lib/karya/outbound_events/delivery.rb Outdated
- Updated `normalize_signature` and `normalize_body` methods to improve handling of nil values.
- Introduced a new `Body` class for better encapsulation of body normalization logic.
- Enhanced error handling for invalid signatures and bodies in the `Delivery` class.
- Added tests to ensure proper error raising for invalid inputs in both `Delivery` and `Dispatcher` classes.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements Karya’s versioned outbound event contract with a CloudEvents-compatible JSON envelope, plus webhook signing/verification and runtime integration so workers/supervisors can dispatch supported events via an injected dispatcher.

Changes:

  • Add Karya::OutboundEvents (schema catalog, event/envelope, dispatcher/delivery) and webhook HMAC signing + verification.
  • Wire outbound-event dispatch into Worker::Runtime and WorkerSupervisor::Runtime, including immutable payload snapshotting for hooks.
  • Add extensive RSpec coverage + documentation for outbound events and signing conventions.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/pages/runtime/workers.md Documents immutable runtime hook payload snapshots.
docs/pages/runtime/outbound-events.md New docs page describing outbound event envelopes, versioning, and webhook signing.
docs/pages/runtime/index.md Adds outbound events to runtime documentation index.
docs/pages/observability.md Links observability story to outbound events and schema versioning.
docs/pages/architecture.md Frames outbound eventing as part of core runtime contract.
docs/index.md Adds outbound events to docs landing page navigation.
core/karya/spec/karya_spec.rb Resets global outbound dispatcher between specs; extends require smoke checks.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds runtime hook snapshot + outbound dispatch behavior coverage.
core/karya/spec/karya/worker/runtime_spec.rb Adds worker runtime snapshot + outbound dispatch behavior coverage.
core/karya/spec/karya/outbound_events_spec.rb Comprehensive unit tests for schemas, envelopes, delivery, signing, verification, dispatcher.
core/karya/spec/karya/internal/payload_input_spec.rb Tests positional/keyword payload normalization behavior.
core/karya/spec/karya/internal/immutable_hook_payload_spec.rb Tests deep-freezing snapshot behavior and validation.
core/karya/sig/karya/worker_supervisor/runtime.rbs Updates supervisor runtime types for forker + outbound dispatcher + payload keyword support.
core/karya/sig/karya/worker/runtime.rbs Updates worker runtime types for outbound dispatcher + payload keyword support.
core/karya/sig/karya/primitives/outbound_event_dispatcher.rbs Adds RBS for outbound dispatcher primitive.
core/karya/sig/karya/primitives/optional_outbound_event_dispatcher.rbs Adds RBS for optional outbound dispatcher primitive.
core/karya/sig/karya/primitives/forker.rbs Adds RBS for forker primitive.
core/karya/sig/karya/outbound_events.rbs Adds RBS for outbound events API (schemas/events/delivery/signing/verifying/dispatch).
core/karya/sig/karya/internal/payload_input.rbs Adds RBS for payload input normalizer.
core/karya/sig/karya/internal/immutable_hook_payload.rbs Adds RBS for immutable payload snapshot helper.
core/karya/sig/karya/base.rbs Adds global outbound dispatcher + new outbound-event/signature error types.
core/karya/sig/karya.rbs Extends primitive types for outbound events, payload typing, forker typing, JSON state input typing.
core/karya/sig/json.rbs Declares JSON::State for typed to_json interop.
core/karya/lib/karya/worker_supervisor/runtime.rb Adds outbound dispatch + immutable payload snapshotting to supervisor runtime instrumentation.
core/karya/lib/karya/worker_supervisor.rb Wires new primitives/helpers required by supervisor runtime.
core/karya/lib/karya/worker/runtime.rb Adds outbound dispatch + immutable payload snapshotting to worker runtime instrumentation.
core/karya/lib/karya/worker.rb Wires new primitives/helpers required by worker runtime.
core/karya/lib/karya/primitives/outbound_event_dispatcher.rb Adds primitive validator for outbound dispatcher callables.
core/karya/lib/karya/primitives/optional_outbound_event_dispatcher.rb Adds optional wrapper for outbound dispatcher validation.
core/karya/lib/karya/primitives/forker.rb Adds primitive validator for forker callables.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Adds webhook signature verification with timestamp skew enforcement.
core/karya/lib/karya/outbound_events/webhook_signer.rb Adds webhook signing (HMAC) and secret normalization.
core/karya/lib/karya/outbound_events/webhook_signature.rb Adds immutable signature metadata + canonical headers.
core/karya/lib/karya/outbound_events/values.rb Adds shared normalizers for outbound-events value coercion/validation.
core/karya/lib/karya/outbound_events/schema_catalog.rb Adds supported-event catalog and payload validation/normalization.
core/karya/lib/karya/outbound_events/schema.rb Adds immutable schema identity object.
core/karya/lib/karya/outbound_events/event.rb Adds CloudEvents-compatible event envelope.
core/karya/lib/karya/outbound_events/dispatcher.rb Adds dispatcher building deliveries (optional signing) from runtime events.
core/karya/lib/karya/outbound_events/delivery.rb Adds immutable delivery object (headers/body/signature).
core/karya/lib/karya/outbound_events.rb Adds outbound-events entrypoint requiring implementation files.
core/karya/lib/karya/internal/payload_input.rb Adds shared positional/keyword payload normalization helper.
core/karya/lib/karya/internal/immutable_hook_payload.rb Adds shared deep-freezing snapshot helper for hook payloads.
core/karya/lib/karya/base.rb Adds outbound-event error types + global outbound dispatcher configuration.
core/karya/lib/karya.rb Requires outbound events from the top-level Karya entrypoint.

Comment thread core/karya/lib/karya/outbound_events/schema_catalog.rb Outdated
Comment thread core/karya/lib/karya/outbound_events/schema_catalog.rb Outdated
- Introduced `string_keys` to the event schemas for consistent string normalization.
- Implemented `normalize_string_keys` method to ensure string values are trimmed and formatted correctly.
- Added tests to verify normalization behavior for event payloads.
- Enhanced validation to reject blank required identifier fields beyond worker and subject values.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a first-class, versioned “Outbound Events” contract in core/karya, including CloudEvents-compatible envelopes and a webhook-style signing/verifying mechanism, and wires outbound dispatch into the Worker and WorkerSupervisor runtimes as an explicit collaborator.

Changes:

  • Added Karya::OutboundEvents (schema catalog, event/envelope types, dispatcher, webhook signing/verifying) plus supporting primitives and internal helpers.
  • Extended worker and supervisor runtimes to optionally dispatch supported outbound events alongside instrumentation, using immutable payload snapshots.
  • Added comprehensive specs and updated docs to describe the outbound-event contract and webhook conventions.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/pages/runtime/workers.md Documents immutable hook payload snapshots and read-only contract guidance.
docs/pages/runtime/outbound-events.md New documentation page defining outbound event envelope + signing/verification conventions.
docs/pages/runtime/index.md Links outbound events into the runtime docs section and scope.
docs/pages/observability.md Connects outbound events to observability story and links docs.
docs/pages/architecture.md Positions outbound events as canonical runtime contract (not framework glue).
docs/index.md Adds outbound events to the top-level docs index.
core/karya/spec/karya_spec.rb Ensures global outbound dispatcher config is resettable and constants load via entrypoints.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds coverage for payload snapshot behavior + outbound dispatch integration in supervisor runtime.
core/karya/spec/karya/worker/runtime_spec.rb Adds coverage for payload snapshot behavior + outbound dispatch integration in worker runtime.
core/karya/spec/karya/outbound_events_spec.rb Comprehensive unit specs for schema catalog, event/envelope, dispatcher, signing, and verification.
core/karya/spec/karya/internal/payload_input_spec.rb Specs for positional-vs-keyword payload normalization helper.
core/karya/spec/karya/internal/immutable_hook_payload_spec.rb Specs for deep-freezing payload snapshots and value-type validation.
core/karya/sig/karya/worker_supervisor/runtime.rbs Updates supervisor runtime signatures for outbound dispatcher + payload kwargs.
core/karya/sig/karya/worker/runtime.rbs Updates worker runtime signatures for outbound dispatcher + payload kwargs.
core/karya/sig/karya/primitives/outbound_event_dispatcher.rbs RBS for outbound dispatcher primitive validator.
core/karya/sig/karya/primitives/optional_outbound_event_dispatcher.rbs RBS for optional outbound dispatcher primitive validator.
core/karya/sig/karya/primitives/forker.rbs RBS for forker primitive validator.
core/karya/sig/karya/outbound_events.rbs RBS surface for OutboundEvents types (schemas, events, signing, dispatcher).
core/karya/sig/karya/internal/payload_input.rbs RBS for internal payload normalization helper.
core/karya/sig/karya/internal/immutable_hook_payload.rbs RBS for immutable payload snapshot helper.
core/karya/sig/karya/base.rbs Adds outbound dispatcher global config + new outbound/signature error types.
core/karya/sig/karya.rbs Adds outbound dispatcher/forker types + expands context payload typing.
core/karya/sig/json.rbs Minimal JSON::State signature support for to_json typing.
core/karya/lib/karya/worker_supervisor/runtime.rb Adds outbound dispatch integration + payload normalization + immutable snapshots for supervisor runtime hooks.
core/karya/lib/karya/worker_supervisor.rb Wires new internal helpers and primitives into supervisor entrypoint requires.
core/karya/lib/karya/worker/runtime.rb Adds outbound dispatch integration + payload normalization + immutable snapshots for worker runtime hooks.
core/karya/lib/karya/worker.rb Wires new internal helpers and primitives into worker entrypoint requires.
core/karya/lib/karya/primitives/outbound_event_dispatcher.rb Adds outbound dispatcher primitive (delegates to Callable validation).
core/karya/lib/karya/primitives/optional_outbound_event_dispatcher.rb Adds optional outbound dispatcher primitive.
core/karya/lib/karya/primitives/forker.rb Adds forker primitive (delegates to Callable validation).
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implements webhook signature verification w/ skew window + header parsing rules.
core/karya/lib/karya/outbound_events/webhook_signer.rb Implements HMAC signing over timestamp.body base string.
core/karya/lib/karya/outbound_events/webhook_signature.rb Defines immutable signature metadata + headers.
core/karya/lib/karya/outbound_events/values.rb Shared normalizers (strings, timestamps, JSON hash normalization).
core/karya/lib/karya/outbound_events/schema_catalog.rb Defines supported event catalog + payload validation/normalization and event construction.
core/karya/lib/karya/outbound_events/schema.rb Defines immutable schema identity (type/version/URI).
core/karya/lib/karya/outbound_events/event.rb Defines CloudEvents-compatible outbound event envelope + JSON serialization.
core/karya/lib/karya/outbound_events/dispatcher.rb Builds (optionally signed) deliveries for supported runtime events.
core/karya/lib/karya/outbound_events/delivery.rb Represents immutable outbound delivery body + headers.
core/karya/lib/karya/outbound_events.rb Entrypoint require file for outbound events subsystem.
core/karya/lib/karya/internal/payload_input.rb Normalizes positional/keyword payload inputs into one Hash.
core/karya/lib/karya/internal/immutable_hook_payload.rb Builds deep-frozen payload snapshots for runtime hooks.
core/karya/lib/karya/base.rb Adds outbound dispatcher global config and new error types.
core/karya/lib/karya.rb Requires outbound events from the main library entrypoint.

Comment thread core/karya/lib/karya/internal/immutable_hook_payload.rb
Comment thread core/karya/lib/karya/outbound_events/event.rb Outdated
- Updated snapshot_key method to accept Symbols and handle invalid types with an ArgumentError.
- Improved snapshot_hash method to raise errors for invalid payload keys.
- Changed time serialization in Event to use getutc for consistent UTC formatting.
- Refactored schema normalization to utilize to_h for better readability.
- Added tests to ensure proper error handling for invalid payload keys and verify frozen time serialization.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements Karya’s outbound event contract surface, including a CloudEvents-compatible JSON envelope, versioned schema catalog, signed webhook delivery/verification, and runtime support for dispatching outbound deliveries alongside instrumentation.

Changes:

  • Added Karya::OutboundEvents with schema catalog, event/envelope types, dispatcher, and webhook signing + verification.
  • Enhanced worker and worker-supervisor runtimes to emit immutable hook payload snapshots and optionally dispatch supported outbound events.
  • Added extensive unit coverage plus documentation for outbound events and webhook conventions.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/pages/runtime/workers.md Documents immutable runtime hook payload snapshots.
docs/pages/runtime/outbound-events.md New docs page defining outbound event contract + webhook signing/verifying conventions.
docs/pages/runtime/index.md Adds outbound events to runtime navigation and scope.
docs/pages/observability.md Links observability story to outbound events and schema versioning.
docs/pages/architecture.md Positions outbound eventing as shared runtime contract.
docs/index.md Adds outbound events entry to docs index.
core/karya/spec/karya_spec.rb Extends global configuration spec to include outbound dispatcher and new error type.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Adds runtime specs for snapshotting, dispatching, error isolation, and supported/unsupported outbound events.
core/karya/spec/karya/worker/runtime_spec.rb Adds worker runtime specs for snapshotting, dispatching, error isolation, and dispatcher validation.
core/karya/spec/karya/outbound_events_spec.rb Comprehensive unit coverage for schema catalog, event/envelope, deliveries, dispatcher, signer, verifier, and normalizers.
core/karya/spec/karya/internal/payload_input_spec.rb Adds coverage for positional/keyword payload normalization sentinel + merge behavior.
core/karya/spec/karya/internal/immutable_hook_payload_spec.rb Adds coverage for deep-freeze snapshot behavior and key/value validation.
core/karya/sig/karya/worker_supervisor/runtime.rbs Updates runtime RBS for new dispatcher support + payload keyword support.
core/karya/sig/karya/worker/runtime.rbs Updates runtime RBS for outbound dispatcher + payload keyword support.
core/karya/sig/karya/primitives/outbound_event_dispatcher.rbs Adds RBS for dispatcher primitive validator.
core/karya/sig/karya/primitives/optional_outbound_event_dispatcher.rbs Adds RBS for optional dispatcher primitive validator.
core/karya/sig/karya/primitives/forker.rbs Adds RBS for forker primitive validator.
core/karya/sig/karya/outbound_events.rbs Adds RBS surface for OutboundEvents module types.
core/karya/sig/karya/internal/payload_input.rbs Adds RBS for internal payload normalization helper.
core/karya/sig/karya/internal/immutable_hook_payload.rbs Adds RBS for immutable snapshot helper.
core/karya/sig/karya/base.rbs Adds new errors and global outbound dispatcher configuration to RBS.
core/karya/sig/karya.rbs Expands payload-related types and introduces dispatcher + forker primitive types.
core/karya/sig/json.rbs Adds minimal JSON::State RBS to support to_json typing.
core/karya/lib/karya/worker_supervisor/runtime.rb Adds outbound dispatch support, payload normalization, immutable snapshots, and error isolation.
core/karya/lib/karya/worker_supervisor.rb Wires new internal helpers and primitives into supervisor entrypoint.
core/karya/lib/karya/worker/runtime.rb Adds outbound dispatch support, payload normalization, immutable snapshots, and error isolation.
core/karya/lib/karya/worker.rb Wires new internal helpers and primitives into worker entrypoint.
core/karya/lib/karya/primitives/outbound_event_dispatcher.rb Adds dispatcher primitive validator (inherits Callable).
core/karya/lib/karya/primitives/optional_outbound_event_dispatcher.rb Adds optional dispatcher validator.
core/karya/lib/karya/primitives/forker.rb Adds forker validator.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implements webhook signature verification with skew checks and strict parsing.
core/karya/lib/karya/outbound_events/webhook_signer.rb Implements canonical signing (timestamp.body) via HMAC.
core/karya/lib/karya/outbound_events/webhook_signature.rb Defines immutable signature metadata and derived headers.
core/karya/lib/karya/outbound_events/values.rb Adds normalizers for present/optional strings, timestamps, and JSON-compatible hashes.
core/karya/lib/karya/outbound_events/schema_catalog.rb Defines supported event families and maps runtime events to versioned external schemas.
core/karya/lib/karya/outbound_events/schema.rb Defines immutable schema identity.
core/karya/lib/karya/outbound_events/event.rb Defines CloudEvents-compatible envelope type and JSON serialization.
core/karya/lib/karya/outbound_events/dispatcher.rb Builds deliveries, signs them, and hands off to a delivery handler.
core/karya/lib/karya/outbound_events/delivery.rb Defines immutable delivery (headers/body) wrapper.
core/karya/lib/karya/outbound_events.rb Adds OutboundEvents module entrypoint and requires.
core/karya/lib/karya/internal/payload_input.rb Adds positional + keyword payload normalization helper.
core/karya/lib/karya/internal/immutable_hook_payload.rb Adds deep-frozen snapshot helper for hook payloads.
core/karya/lib/karya/base.rb Adds new errors and global outbound dispatcher configuration.
core/karya/lib/karya.rb Requires outbound events in the canonical entrypoint.

Comment thread core/karya/lib/karya/outbound_events/event.rb
- Changed the time attribute in the event's hash representation to use `dup` before calling `getutc.iso8601`.
- This ensures that the original time object remains unmodified, preventing potential side effects.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a first-class outbound event delivery contract in core/karya, including a CloudEvents-compatible JSON envelope, versioned schema catalog, and webhook signing + verification primitives, then wires dispatching into the Worker and WorkerSupervisor runtimes and documents the contract.

Changes:

  • Add Karya::OutboundEvents with schema catalog, CloudEvents envelope, delivery/dispatcher, and HMAC-based webhook signing + verification.
  • Extend Worker and WorkerSupervisor runtimes to dispatch supported outbound events alongside instrumentation, using immutable payload snapshots.
  • Add RBS coverage, tests, and docs for outbound event contracts and signing conventions.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/pages/runtime/workers.md Document immutable runtime hook payload snapshots.
docs/pages/runtime/outbound-events.md New outbound events + signing/verification documentation.
docs/pages/runtime/index.md Add outbound events to runtime section index.
docs/pages/observability.md Link observability story to outbound event contracts.
docs/pages/architecture.md Position outbound eventing as shared runtime contract.
docs/index.md Add outbound events to docs landing page.
core/karya/spec/karya_spec.rb Ensure global outbound dispatcher config is reset/tested.
core/karya/spec/karya/worker_supervisor/runtime_spec.rb Add coverage for payload snapshots + outbound dispatch behavior.
core/karya/spec/karya/worker/runtime_spec.rb Add coverage for payload snapshots + outbound dispatch behavior.
core/karya/spec/karya/outbound_events_spec.rb New unit specs for outbound events, signing, verification, dispatcher.
core/karya/spec/karya/internal/payload_input_spec.rb New specs for positional/keyword payload normalization.
core/karya/spec/karya/internal/immutable_hook_payload_spec.rb New specs for deep-freezing snapshot behavior.
core/karya/sig/karya/worker_supervisor/runtime.rbs RBS updates for outbound dispatcher + payload keyword support.
core/karya/sig/karya/worker/runtime.rbs RBS updates for outbound dispatcher + payload keyword support.
core/karya/sig/karya/primitives/outbound_event_dispatcher.rbs New RBS for dispatcher primitive validator.
core/karya/sig/karya/primitives/optional_outbound_event_dispatcher.rbs New RBS for optional dispatcher primitive validator.
core/karya/sig/karya/primitives/forker.rbs New RBS for forker primitive validator.
core/karya/sig/karya/outbound_events.rbs New RBS surface for OutboundEvents module/types.
core/karya/sig/karya/internal/payload_input.rbs New RBS for hook payload normalization helper.
core/karya/sig/karya/internal/immutable_hook_payload.rbs New RBS for immutable hook payload snapshot helper.
core/karya/sig/karya/base.rbs Add outbound dispatcher + new outbound/signature errors to RBS.
core/karya/sig/karya.rbs Add outbound event-related types/interfaces.
core/karya/sig/json.rbs Add minimal JSON::State type for RBS.
core/karya/lib/karya/worker_supervisor/runtime.rb Add outbound dispatch + immutable payload snapshotting.
core/karya/lib/karya/worker_supervisor.rb Wire in new internal/primitives dependencies.
core/karya/lib/karya/worker/runtime.rb Add outbound dispatch + immutable payload snapshotting.
core/karya/lib/karya/worker.rb Wire in new internal/primitives dependencies.
core/karya/lib/karya/primitives/outbound_event_dispatcher.rb New primitive validator class.
core/karya/lib/karya/primitives/optional_outbound_event_dispatcher.rb New optional primitive validator class.
core/karya/lib/karya/primitives/forker.rb New forker primitive validator class.
core/karya/lib/karya/outbound_events/webhook_verifier.rb Implement signature verification + timestamp window enforcement.
core/karya/lib/karya/outbound_events/webhook_signer.rb Implement HMAC signature creation.
core/karya/lib/karya/outbound_events/webhook_signature.rb Represent signature metadata + headers.
core/karya/lib/karya/outbound_events/values.rb Shared value normalizers for outbound event contracts.
core/karya/lib/karya/outbound_events/schema_catalog.rb Map runtime events to versioned schemas + build envelopes.
core/karya/lib/karya/outbound_events/schema.rb Represent schema identity (type/version/URI).
core/karya/lib/karya/outbound_events/event.rb CloudEvents-compatible envelope model + JSON serialization.
core/karya/lib/karya/outbound_events/dispatcher.rb Build deliveries, sign bodies, call delivery handler.
core/karya/lib/karya/outbound_events/delivery.rb Immutable delivery (headers/body/signature/event).
core/karya/lib/karya/outbound_events.rb OutboundEvents entrypoint require tree.
core/karya/lib/karya/internal/payload_input.rb Normalize positional + keyword payload inputs to one Hash.
core/karya/lib/karya/internal/immutable_hook_payload.rb Deep-freeze hook payload snapshots + validate value types.
core/karya/lib/karya/base.rb Add outbound dispatcher global config + new error types.
core/karya/lib/karya.rb Require outbound events from canonical entrypoint.

Comment thread core/karya/lib/karya/outbound_events/webhook_signer.rb
- Updated the signing process to handle non-UTF-8 request body bytes without encoding failures.
- Added a test to ensure that the signing method works correctly with non-UTF-8 encoded strings.
- Improved the robustness of the WebhookSigner class to support a wider range of input formats.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 44 out of 44 changed files in this pull request and generated 3 comments.

Comment thread docs/pages/runtime/outbound-events.md
Comment thread docs/pages/runtime/workers.md
Comment thread core/karya/lib/karya/outbound_events.rb Outdated
- Reordered the require statements in outbound_events.rb for clarity.
- Added details on HMAC-SHA256 digest computation in outbound events documentation to clarify webhook signing conventions.
- Expanded workers documentation to specify allowed payload shapes and key types, ensuring clarity on runtime behavior.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 44 out of 44 changed files in this pull request and generated 4 comments.

Comment thread core/karya/sig/karya/outbound_events.rbs Outdated
Comment thread core/karya/lib/karya/worker/runtime.rb Outdated
Comment thread core/karya/lib/karya/worker_supervisor/runtime.rb
Comment thread core/karya/sig/karya/outbound_events.rbs
- Added a new HookDispatch class to handle payload normalization and event dispatching.
- Refactored the instrument method in worker and worker supervisor to utilize HookDispatch for improved clarity and maintainability.
- Introduced new types for webhook verification inputs in the RBS files to enhance type safety.
- Updated outbound event initialization to use more specific types for better validation.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 1 comment.

Comment thread core/karya/lib/karya/internal/immutable_hook_payload.rb Outdated
- Updated the `snapshot_pair` method to create a pair of snapshots, ensuring distinct top-level hashes while sharing frozen nested values.
- Introduced a new `shallow_snapshot` method to facilitate the duplication of snapshots.
- Added a test case to verify the behavior of snapshot pairs, ensuring they are distinct yet share frozen nested values.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 2 comments.

Comment thread core/karya/lib/karya/worker/runtime.rb
Comment thread core/karya/lib/karya/worker_supervisor/runtime.rb
- Added require statements for `karya/worker/runtime` and `karya/worker_supervisor/runtime` in the specs.
- This allows for direct loading of runtime classes, enhancing usability and integration in user applications.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.

Comment thread core/karya/sig/karya/primitives/forker.rbs
Comment thread core/karya/sig/karya/primitives/outbound_event_dispatcher.rbs
- Removed `initialize` and `normalize` methods from Forker class to streamline the code.
- Removed `initialize` and `normalize` methods from OptionalOutboundEventDispatcher class for clarity.
- Removed `initialize` and `normalize` methods from OutboundEventDispatcher class to enhance maintainability.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 1 comment.

Comment thread docs/pages/runtime/outbound-events.md Outdated
- Updated the dispatcher contract to ignore unsupported runtime events.
- Clarified that custom outbound event dispatcher implementations must explicitly opt out of unsupported events.
- Ensured that the external event contract remains stable and predictable.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.

Comment thread core/karya/lib/karya/outbound_events/schema_catalog.rb Outdated
Comment thread core/karya/lib/karya/outbound_events/webhook_verifier.rb
Comment thread core/karya/lib/karya/outbound_events/webhook_signer.rb
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.

Comment thread core/karya/lib/karya/worker_supervisor/runtime.rb
Comment thread core/karya/lib/karya/outbound_events/dispatcher.rb
Comment thread core/karya/lib/karya/worker/runtime.rb
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.

Comment thread core/karya/sig/karya/primitives/forker.rbs Outdated
Comment thread core/karya/sig/karya/primitives/outbound_event_dispatcher.rbs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 48 out of 48 changed files in this pull request and generated 1 comment.

Comment thread core/karya/sig/karya/outbound_events.rbs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 48 out of 48 changed files in this pull request and generated 3 comments.

Comment thread core/karya/lib/karya/worker_supervisor/runtime.rb
Comment thread core/karya/lib/karya/outbound_events/webhook_signer.rb
Comment thread core/karya/lib/karya/worker/runtime.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants