astrid-runtime/astrid · error

our own event is delivered

Error message

our own event is delivered

What it means

This panic comes from `.expect("our own event is delivered")` on `feed_rx.recv(Some(Duration::from_secs(2)))` in `scoped_feed_drops_foreign_principal_events`. It fires when no event arrives within the 2-second window (recv timed out or the feed closed). The test expects alice's own event to be the first delivered after a foreign-principal event was dropped at enqueue.

Source

Thrown at crates/astrid-gateway/src/routes/stream.rs:310

        // Publish a foreign-principal lifecycle event FIRST, then our own.
        // The foreign one must be dropped at enqueue; the recv must surface
        // OUR event, proving the scope filters by publisher principal.
        bus.publish(ipc_event(
            "session.v1.event.created",
            "mallory",
            serde_json::json!({ "kind": "created", "session_id": "m1", "summary": null }),
        ));
        bus.publish(ipc_event(
            "session.v1.event.created",
            me,
            serde_json::json!({ "kind": "created", "session_id": "a1", "summary": null }),
        ));

        let event = feed_rx
            .recv(Some(Duration::from_secs(2)))
            .await
            .expect("our own event is delivered");
        let AstridEvent::Ipc { message, .. } = &*event else {
            panic!("expected an IPC event");
        };
        // The delivered event is OURS — the foreign one was dropped at
        // enqueue, so the very first (and only) event on the route is alice's.
        assert_eq!(message.principal.as_deref(), Some(me));
        if let IpcPayload::RawJson(v) = &message.payload {
            assert_eq!(
                v["session_id"], "a1",
                "must be our session, never mallory's"
            );
        } else {
            panic!("expected RawJson payload");
        }

        // No second event: the foreign publish never entered the route's
        // budget. A short timeout confirms the route is now empty.
        assert!(

View on GitHub (pinned to affd8760f4)

Solutions

  1. Confirm the event is published with principal matching `me` so the scoped filter keeps it.
  2. Check the scoped-feed drop-at-enqueue logic did not begin filtering out the owner's own events.
  3. Widen the 2s recv window or retry loop for slow CI environments.
  4. Distinguish timeout vs closed channel by matching on recv's None/Some result for a clearer failure.

Example fix

// before
let event = feed_rx.recv(Some(Duration::from_secs(2))).await.expect("our own event is delivered");
// after
let Some(event) = feed_rx.recv(Some(Duration::from_secs(2))).await else {
    panic!("our own event is delivered: no event within 2s (timeout or feed closed)");
};
Defensive patterns

Strategy: retry

Validate before calling

assert_eq!(event_principal, me, "publish with the feed owner's principal");

Try / catch

let Some(event) = feed_rx.recv(Some(Duration::from_secs(2))).await else {
    panic!("own event not delivered within 2s");
};

Prevention

When it happens

Trigger: The scoped feed never delivers alice's published event within 2s: the event was dropped by the principal filter, published on the wrong topic, the feed subscription filtered everything, or the receiver channel closed (recv returns None instead of Some).

Common situations: Publisher/consumer principal mismatch in the fixture; topic prefix constants changed; event-bus backpressure or slow CI causing the 2s window to be missed; the enqueue-time drop logic now also drops own events (over-filtering).

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/4bbe60194ba25df3. Report an issue: GitHub.