Skip to content

feat(server): forward-port publish_raw_event_to + subscriber_addresses onto 0.8.0#135

Closed
JustinKovacich wants to merge 1 commit into
feat/polled-port-onto-125from
feat/port_publish_raw_event_to_onto_0_8_0
Closed

feat(server): forward-port publish_raw_event_to + subscriber_addresses onto 0.8.0#135
JustinKovacich wants to merge 1 commit into
feat/polled-port-onto-125from
feat/port_publish_raw_event_to_onto_0_8_0

Conversation

@JustinKovacich

@JustinKovacich JustinKovacich commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Forward-ports the two targeted-delivery EventPublisher methods released in v0.7.2 (8118fde) onto the current 0.8.0 spine tip (feat/polled-port-onto-125), so the 0.8.0 release doesn't regress them.

Base corrected: originally opened against feature/phase18f_docs_and_0_8_0_finalize; retargeted to the real spine tip feat/polled-port-onto-125 and re-authored against the post-#125 caller-scratch publish API.

What

  • publish_raw_event_to_with_buffers(target, …, buf) — sends a raw (already-serialized, already-E2E-protected) event to one subscriber by endpoint, taking caller-provided scratch. Same shape as the post-Reduce async state and static pool memory in simple_someip to prevent Embassy arena exhaustion #125 publish_raw_event_with_buffers fan-out (guards keyed off buf.len(), the buf.len() < 16 floor, socket via SharedHandle::get()).
  • publish_raw_event_to(target, …)#[cfg(feature = "_alloc")] convenience wrapper that allocates UDP_BUFFER_SIZE scratch and delegates, mirroring publish_raw_event.
  • subscriber_addresses(…) — lists an event group's subscribed endpoints into a heapless::Vec<_, SUBSCRIBERS_PER_GROUP> (no_std-clean).

Enables per-recipient delivery when subscribers share a (service, instance, event_group) key but bind distinct endpoints (multiple sensors on one subnet sharing a fixed instance id). Additive; existing fan-out unchanged.

One deliberate semantic change vs v0.7.2

A send failure to a subscribed target returns Err(Error::Transport(_)) rather than the v0.7.2 Ok(0) — matching the post-#125 fan-out path, so callers can distinguish "not subscribed" (Ok(0)) from "subscribed but send failed" (Err).

Verification

  • cargo fmt -- --check — changed file is clean ✓
  • cargo clippy --features server-tokio --tests — changed file is warning-clean ✓
  • cargo nextest run --features server-tokio event_publisher — 23/23 pass (incl. 3 new) ✓
  • no_std: cargo build --target thumbv7em-none-eabihf --no-default-features --features server,bare_metal and client,server,bare_metal

Heads-up (pre-existing, not from this PR): the base tip already fails cargo fmt --all --check under rustfmt 1.9.0 (~10 drifted files: runtime.rs, sd_state.rs, client/*, etc.) and cargo clippy -Dwarnings (nits in registry.rs, lib.rs, buffer_pool.rs, …). Those are untouched by this change; this PR's fmt/clippy CI may go red on them until the base is cleaned.

🤖 Generated with Claude Code

@JustinKovacich JustinKovacich added the enhancement New feature or request label Jun 24, 2026
@JustinKovacich JustinKovacich self-assigned this Jun 24, 2026
@JustinKovacich
JustinKovacich force-pushed the feat/port_publish_raw_event_to_onto_0_8_0 branch from b78a0d7 to 385f44c Compare June 24, 2026 00:26
@JustinKovacich
JustinKovacich changed the base branch from feature/phase18f_docs_and_0_8_0_finalize to feat/polled-port-onto-125 June 24, 2026 00:26
…s onto 0.8.0

Ports the two targeted-delivery EventPublisher methods released in v0.7.2
(8118fde) onto the 0.8.0 spine tip (feat/polled-port-onto-125). Hand-adapted
to the post-#125 caller-scratch API rather than cherry-picked.

- publish_raw_event_to_with_buffers: sends a raw (already-serialized,
  already-E2E-protected) event to ONE subscriber by endpoint, taking a
  caller-provided scratch buffer (guards keyed off buf.len(), the
  buf.len() < 16 floor, socket via SharedHandle::get()) — the same shape as
  the post-#125 publish_raw_event_with_buffers fan-out.
- publish_raw_event_to: #[cfg(feature = "_alloc")] convenience wrapper that
  allocates UDP_BUFFER_SIZE scratch and delegates, mirroring publish_raw_event.
- subscriber_addresses: lists an event group's subscribed endpoints into a
  heapless::Vec capped at SUBSCRIBERS_PER_GROUP (no_std-clean).

Enables per-recipient delivery when subscribers share a
(service, instance, event_group) key but bind distinct endpoints. Additive;
existing fan-out unchanged.

Semantics aligned with the fan-out path: a send failure to a SUBSCRIBED target
surfaces Err(Error::Transport(_)) rather than the v0.7.2 Ok(0), so callers can
distinguish "not subscribed" (Ok(0)) from "subscribed but send failed" (Err).
Three tokio tests cover targeted delivery, the unsubscribed no-op, and address
listing; verified green plus thumbv7em server,bare_metal / client,server,bare_metal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JustinKovacich

Copy link
Copy Markdown
Contributor Author

Folded into #138. The 0.8.0 forward-port stack was consolidated via a linear rebase of the whole stack onto main (which now includes #130). #138 is rebased onto main and carries this branch's commits intact — closing here to collapse the stack into a single PR. Verified: 556 all-features lib tests, client_server 11/11, all 5 CI clippy lanes, no_alloc_witness, bare_metal_e2e 9/9.

@JustinKovacich
JustinKovacich deleted the feat/port_publish_raw_event_to_onto_0_8_0 branch June 29, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant