Athena

Athena Webhooks Crate

What belongs in crates/athena-webhooks and what stays wired through athena_rs adapters.

crates/athena-webhooks is the reusable webhook-domain seam for Athena. It owns the durable store, route-key catalog, and generic dispatch engine so the main server can keep compatibility wrappers while the core webhook logic lives in a publishable crate.

What Lives Here Today

  • Gateway webhook definition and delivery-log persistence.
  • Route-key constants for gateway, REST compatibility, and schema webhook events.
  • Human-readable webhook event catalog data for admin and Studio surfaces.
  • The generic outbound dispatch engine:
    • trigger construction from HttpRequest
    • template rendering
    • idempotency and state-cap resolution
    • outbound HTTP execution
    • runtime hooks for auth-pool lookup, client-pool lookup, and shared HTTP transport

What Still Stays In athena_rs

  • The AppState adapter that implements the runtime trait for the real server.
  • Management-schema payload mapping from TableEditOperation to webhook events.
  • Actix admin routes, gateway routes, and worker orchestration that call into the crate.

Current Extraction Rule

Use athena-webhooks when code is about webhook persistence, route catalogs, or delivery behavior that can run behind a small runtime trait.

Keep code in athena_rs when it needs:

  • direct AppState access
  • management DDL operation types
  • route registration and HttpResponse construction
  • worker/bootstrap wiring outside the webhook domain itself

Near-Term Direction

The next webhook-related extractions should keep the same shape:

  1. Move reusable delivery logic and store contracts into athena-webhooks.
  2. Leave thin compatibility shims in src/webhooks.rs and src/data/webhooks.rs.
  3. Keep broader runtime concerns in their dedicated crates:
    • athena-actix
    • athena-driver
    • athena-query