Skip to content

feat: publish / subscribe for Linkable contracts (#391, stage 1) - #400

Merged
lxsaah merged 1 commit into
feature/388-input-output-connectionsfrom
feature/391-publish-subscribe
Nov 2, 2026
Merged

lxsaah merged 1 commit into
feature/388-input-output-connectionsfrom
feature/391-publish-subscribe

Conversation

@lxsaah

@lxsaah lxsaah commented Nov 2, 2026

Copy link
Copy Markdown
Member

Description

Stage 1 of #391, into the #392 feature branch.

Core

  • OutboundLinkBuilder / InboundLinkBuilder gain with_schema(name, version), which reports the record's schema when the link is registered, like RecordRegistrar::schema.
  • push_outbound / push_inbound report it before validation, so a rejected link still reports it, as linked_to's schema() call did. A different schema on the same record still conflicts at build().

aimdb-data-contracts

  • publish(handle, address) / subscribe(handle, address) return a plain OutboundLink / InboundLink with T's own codec (link_codecs::Default) and T::NAME / T::VERSION as schema.
  • linked_to / linked_from / linked_*_with now register through the same helpers, via reg.output / reg.input. Their behaviour is unchanged, and their existing tests pass untouched.
  • Linkable gets #[diagnostic::on_unimplemented]: `X` is not a `Linkable` contract / `X` has no wire format.
  • The Linkable and module docs point to publish / subscribe.

Tests

  • Core with_schema_reports_the_record_schema:
    • both directions and both forms
    • a rejected link still reports the schema
    • a conflicting schema gives the existing error
  • data-contracts publish_and_subscribe_register_like_the_linked_verbs: the same URLs, config and graph schema as linked_to / linked_from, from a bare address and from a full URL.
  • MQTT publish_and_subscribe_take_the_knobs: with_qos / with_retain on publish, with_qos on subscribe.
  • A compile_fail,E0277 doctest on publish for a record type that isn't Linkable.

Checks

CI doesn't run on PRs into the feature branch, so I ran these locally:

  • aimdb-core tests with std,tracing,observability (311) and with alloc
  • the thumbv8m build
  • aimdb-data-contracts with the full feature set and with --no-default-features --features alloc,linkable
  • the MQTT link_ext_tests
  • 33 clippy lines from the Makefile for core, data-contracts and MQTT (-D warnings)
  • cargo doc with -D warnings for core and data-contracts
  • cargo check -p tokio-mqtt-connector-demo

Next

  • Stage 2: rewrite mqtt-connector-demo-common and move both demos to connect + publish / subscribe.
  • Stage 3: the embassy board module and the B1 PushButton.
  • Stage 4: docs.
  • Stage 5: changelog.

Related Issue

🤖 Generated with Claude Code

Core: OutboundLinkBuilder / InboundLinkBuilder gain with_schema(name,
version). push_outbound / push_inbound report it via reg.schema(..)
before validation, so a link carries its contract's schema like the
schema() call linked_to made before the link.

aimdb-data-contracts: publish(handle, address) / subscribe(handle,
address) return plain OutboundLink / InboundLink with T's own codec and
schema, so every connector extension (with_qos, with_link_codec, ...)
applies unchanged. linked_to / linked_from / *_with now register through
the same helpers via reg.output / reg.input; behaviour is unchanged.
Linkable gets #[diagnostic::on_unimplemented] for the not-a-contract
case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant