Repository navigation
feat(client): emit() — the publish verb; the four-method facade is complete - #1666
Merged
Merged
Conversation
joelteply
added a commit
that referenced
this pull request
Jun 17, 2026
…4th SDK verb) (#1668) The client-side emit() (BigMama, #1666) builds an AircEventPublish envelope; this is its peer-side landing — the ConsumerAdapter that receives a publish, gates it, fans it out to every matching subscriber, and acks the delivered count. Completes the Event primitive's write half on the core: subscribe (read) + publish (write), the twin of execute + provide on the Command side. Built from the lowest shared level outward, mirroring the subscribe path line-for-line so a reader who knows one knows the other: protocol (continuum-airc-protocol, already on canary): AircEventPublish, AircEventPublishAck, EVENT_PUBLISH_BODY_HINT, resolve_publish, decode_publish_ack — the single source of truth for the wire shape. routing/airc_event_protocol.rs + mod.rs: re-export the publish symbols alongside the subscribe ones. routing/airc_event_publisher.rs: ParsedPublish + parse_publish_envelope (twin of parse_subscribe_envelope) + build_publish_ack (twin of build_subscribe_ack, carrying the fan-out count). routing/airc_event_adapters.rs: EventPublishAdapter — gate_publish (the pure WRITE-gate seam) + process_publish (gate → AircEventPublisher::publish fan-out → ack) + the ConsumerAdapter impl claiming EVENT_PUBLISH_BODY_HINT. Publish is a WRITE: unlike subscribe (registers the caller's own interest), a publish MUTATES every subscriber's stream. So it is gated through the same AuthPolicy chokepoint on the synthetic URI events/<topic>/publish — without it any reachable peer could inject events onto ANY topic, including internal substrate signals other personas act on. Empty topic refused upfront ([[no-fallbacks-ever]]). Tests (routing::airc_event_adapters::tests, mirroring the subscribe suite): - gate_publish_threads_caller_into_gate — the verified sender reaches the gate (no silent privilege escalation) - gate_publish_refuses_empty_topic_with_typed_error - gate_publish_refuses_when_policy_forbids - gate_publish_decision_path_is_stable — pins events/<topic>/publish - build_publish_ack_carries_topic_and_delivered_count - adapter name + body_hint pinned to the protocol constants The async fan-out half composes AircEventPublisher::publish, whose composition is covered without airc by build_publish_envelopes tests. Boot wiring (register_consumer_adapter for the whole event surface) is the same not-yet-present integration step the subscribe/unsubscribe adapters await — this lands the publish adapter ready to register beside them. Co-authored-by: Claude Opus 4.8 <[email protected]>
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.
What
emit— the publish side of the Event primitive, and the fourth and final facade verb. With this the SDK facade is complete:execute(#1663)provide(#1664)subscribe(#1663)emit(this)Two primitives × two directions = four verbs. The platform tracks (mobile/cli/nodejs, all held until the facade completes) can now build against the full surface + the conformance spec.
How (mirrors the subscribe wire path — zero drift)
continuum-airc-protocol/event.rs(the wire type — unblocks M5's substrate-side adapter):AircEventPublish { topic, payload }+AircEventPublishAck { topic, delivered }+EVENT_PUBLISH_BODY_HINT+resolve_publish/decode_publish_ack— the publish twins of the subscribe envelopes/helpers (empty-topic refused upfront, same as subscribe).continuum-client:Transport::emit+AircIpcTransport::emit(resolve_publish →airc.request→ await → decode the fan-out ack; same shared helpers the substrate'sEventPublishAdapterwill receive) +MockTransport::emit+Connection::emit.ContinuumClient::emit(class, payload_json) -> Result<(), FfiError>(the trivial publish verb — no callback).Composition with M5's substrate work
This ships the client side; the live fan-out lights up when M5's
EventPublishAdapter(the receive-door twin ofEventSubscribeAdapter) lands — it receives theAircEventPublishwire type added here and hands it to the existingAircEventPublisher::publish. The wire type is the contract between them.Validation
cargo fmt+cargo clippy -D warnings+cargo test— continuum-airc-protocol 18, continuum-client 18, facade 8 (the new emit test publishes to a subscriber via the mock fan-out, end-to-end). Plus 5 new protocol tests (publish/ack roundtrip, resolve_publish envelope + empty-topic refusal, decode_publish_ack).Next
Facade complete → the uniffi
.udlbinds all four verbs in one pass → native swift/kotlin SDKs (Android here, xcframework on macOS CI). The three parallel-outlier platform tracks unblock against the shared conformance spec.🤖 Generated with Claude Code