Skip to content

refactor(connectors)!: MQTT knobs out of core builders; prune ConnectorConfig (034 Phase 2, #134)#139

Merged
lxsaah merged 3 commits into
mainfrom
refactor/034-phase2-134-mqtt-knobs
Jun 10, 2026
Merged

refactor(connectors)!: MQTT knobs out of core builders; prune ConnectorConfig (034 Phase 2, #134)#139
lxsaah merged 3 commits into
mainfrom
refactor/034-phase2-134-mqtt-knobs

Conversation

@lxsaah

@lxsaah lxsaah commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Closes #134. Part of design 034 Phase 2 (review doc §3.6); last of three stacked PRs (#130#133#134). Stacked on #138 — will be re-targeted to main once that merges; only the last commit is this PR's diff until then.

What

Core knows schemes and key/value options, never protocol semantics.

  • Deleted from core's generic link builders: OutboundConnectorBuilder::with_qos/with_retain, InboundConnectorBuilder::with_qos. with_timeout_ms survives with protocol-neutral docs; with_config(key, value) (already existed) is documented as the generic option spine. The issue suggested adding with_option — not needed, with_config already is that method.
  • New aimdb-mqtt-connector::link_ext (compiled on every feature leg — std/tokio, embassy/no_std, alloc-only):
    • MqttLinkExt::with_qos(u8) — outbound and inbound (publish/subscribe QoS)
    • MqttOutboundLinkExt::with_retain(bool) — outbound only (retain is a publish-side flag; the old core API had the same asymmetry)
    • Impls call with_config("qos", …) / with_config("retain", …) — the same keys both MQTT clients have always parsed from protocol_options (tokio: MqttSink::opt, embassy: opt_u8/opt_bool, defaults QoS 1 / no retain) → wire behavior unchanged.
  • ConnectorConfig pruned: typed qos: u8/retain: bool fields deleted (verified unread by every connector in-tree), Kafka/HTTP/shmem interpretation docs deleted; keeps timeout_ms + protocol_options. The Connector trait example now reads knobs from protocol_options.
  • OutboundConnectorBuilder/InboundConnectorBuilder re-exported from aimdb_core root (needed by the extension-trait impls).
  • examples/tokio-mqtt-connector-demo exercises the traits explicitly (.with_qos(1).with_retain(false) outbound, .with_qos(1) inbound — wire-identical to defaults).
  • The five aimdb-pro weather-station demos (.with_retain(true)) were updated alongside (separate repo, import-only change) and compile against this branch.

Acceptance criteria (from #134)

  • grep -rn "qos\|retain" aimdb-core/src → only generic pass-through/doc mentions remain
  • MQTT publishes with identical QoS/retain behavior — same keys on the wire (pinned by tests/link_ext_tests.rs: ext methods push exactly ("qos","2")/("retain","true") into the link config)
  • ConnectorConfig mentions no protocol that lacks an in-tree connector
  • make check and make examples pass (incl. the thumbv7em-none-eabihf embassy+defmt clippy leg for the new module)

🤖 Generated with Claude Code

lxsaah and others added 2 commits June 10, 2026 05:09
… configuration errors (#133)

One failure model instead of two: builder methods never panic on user
mistakes. TypedRecord setters, the connector-link finish() methods, and
configure() record a ConfigError (skipping the conflicting
registration) and build() returns a single
DbError::InvalidConfiguration carrying every finding — record key and
connector URL included — so one run surfaces every mistake.

The spawn-time factory panics (missing buffer, record lookup) become
build()-time checks; .buffer() after .link_to()/.link_from() is now
legal. Duplicate keys and dependency-graph findings fold into the same
collected report. Remaining panics on the builder path are internal
invariants worded 'this is a bug in aimdb-core'.

AnyRecord gains has_buffer() and drain_config_errors().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nnectorConfig (#134)

Core knows schemes and key/value options, never protocol semantics:
with_qos/with_retain are deleted from the generic link builders and now
live in aimdb-mqtt-connector as MqttLinkExt (qos, outbound + inbound)
and MqttOutboundLinkExt (retain, publish-side only) — pushing the same
config keys the MQTT clients have always read from protocol_options,
so wire behavior is unchanged. with_timeout_ms stays with
protocol-neutral docs; with_config(key, value) is the generic spine.

ConnectorConfig drops its never-read typed qos/retain fields and the
speculative Kafka/HTTP/shmem interpretation docs; it keeps timeout_ms +
protocol_options. Outbound/InboundConnectorBuilder are re-exported from
core's root for the extension-trait impls.

The tokio MQTT demo exercises the new traits explicitly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Base automatically changed from refactor/034-phase2-133-build-validation to main June 10, 2026 14:46
@lxsaah

lxsaah commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

@lxsaah lxsaah merged commit b02ec70 into main Jun 10, 2026
Copilot stopped work on behalf of lxsaah due to an error June 10, 2026 14:49
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.

refactor(connectors): move MQTT-specific knobs out of core builders; prune speculative ConnectorConfig fields

1 participant