feat(mqtt): allow standalone mqtt_bridge as client-proxy target (#3134)#3136
Conversation
Closes #3134. `mqtt_bridge` sources no longer require a parent `mqtt_broker` — when `config.brokerSourceId` is omitted, the bridge runs as a pure upstream MQTT client. Deleting an `mqtt_broker` now detaches its dependent bridges (clears their `brokerSourceId`) instead of returning 409, and a `meshtastic_tcp` source's `mqttLink` can now target either a broker or a (standalone) bridge for the device-side MQTT client-proxy use case. UI updated so both source types appear in the per-device "Quick configure" dropdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job Code Review Complete ✅I've completed a comprehensive review of PR #3136. This is a well-implemented feature that adds valuable flexibility to the MQTT bridge functionality. Here are my findings: ✅ StrengthsArchitecture & Design:
Code Quality:
Security & Robustness:
🔍 Minor ObservationsPerformance:
Edge Cases Handled:
🎯 UI/UX ImprovementsDashboard Form (
MQTT Config Section:
🧪 Test Coverage AnalysisNew Test File (
Bridge Manager Tests (
🔒 Security Assessment
📈 Performance & Scalability
Recommendation: ✅ APPROVEThis PR successfully addresses issue #3134 with a well-designed solution that:
The implementation follows MeshMonitor's architectural patterns and coding standards. No blocking issues identified. |
Rewrites docs/features/mqtt-broker.md to cover both source types in depth: what each one does, when to pick each, and a side-by-side feature matrix (broker vs attached bridge vs standalone bridge). Adds a use-case recipes section, expands the device-reach table to three paths now that standalone bridges can serve as client-proxy targets, and updates the broker-delete troubleshooting note to reflect the auto-detach behavior. Nav and landing-page card retitled to "Embedded MQTT Broker & Bridge". Part of #3134. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job Code Review Complete ✅I've completed a comprehensive review of PR #3136. This is a well-implemented feature that adds valuable flexibility to the MQTT bridge functionality. Here are my findings: ✅ StrengthsArchitecture & Design:
Code Quality:
Security & Robustness:
🔍 Minor ObservationsPerformance:
Edge Cases Handled:
🎯 UI/UX ImprovementsDashboard Form (
MQTT Config Section:
🧪 Test Coverage AnalysisNew Test File (
Bridge Manager Tests (
🔒 Security Assessment
📈 Performance & Scalability
Recommendation: ✅ APPROVEThis PR successfully addresses issue #3134 with a well-designed solution that:
The implementation follows MeshMonitor's architectural patterns and coding standards. No blocking issues identified. |
…ish (#3145) Version bump and CHANGELOG entry for 4.6.5. Highlights: - #3143 MQTT Bridge mirror dashboard (read-only Open button on bridge cards; suppresses every TX surface; MqttBridgeManager now exposes the Meshtastic-shaped methods the consolidated /api/poll + /api/connection endpoints expect). - #3142 MeshCore Telemetry dashboard tab via source-agnostic Dashboard. - #3141 MeshCore: preserve LPP channel byte in remote telemetry rows. - #3140 DM: skip PKI flag when keyMismatchDetected. - #3138 docs reorganization. - #3137 unified: merge nodes across sources so labels show in the unified Nodes view. - #3136 mqtt: allow standalone mqtt_bridge as client-proxy target. CLAUDE.md version line updated to 4.6.5. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
mqtt_bridgesources can now run without a parentmqtt_broker(issue [BUG] mqtt broker cannot be removed #3134). Whenconfig.brokerSourceIdis omitted, the bridge runs as a pure upstream MQTT client — useful for monitoring a remote broker, or for serving as a target for ameshtastic_tcpsource's MQTT client-proxymqttLink.mqtt_brokerno longer returns409 Conflictwhen bridges depend on it (the original bug in [BUG] mqtt broker cannot be removed #3134). Instead, dependent bridges are automatically detached (brokerSourceIdcleared, manager restarted) and the broker is deleted.MeshtasticManager.setupMqttLinknow accepts either anmqtt_brokeror anmqtt_bridgeas the link target. Both source types exposepublish()and emitlocal-packet, so the existing proxy-message paths work unchanged for either.Why
mqtt_bridgeoriginally required anmqtt_brokerparent so it could republish upstream traffic locally and forward device traffic upstream. That coupling was the right model for a true broker-to-broker bridge, but it blocked two valid setups:mqtt.meshtastic.org) when you have no locally-connected devices.mqtt.proxy_to_client_enabled = truewhose MQTT traffic should be relayed straight upstream by MeshMonitor with no embedded broker in between.Both now work natively.
Files changed
src/server/routes/sourceRoutes.tsbrokerSourceIdis optional. DELETE on a broker auto-detaches dependent bridges.src/server/mqttBridgeManager.tsbrokerSourceIdtyped optional;attachParentBroker()is a no-op when unset; newpublish()method; emitslocal-packeton downlink.src/server/meshtasticManager.tssetupMqttLinkacceptsmqtt_brokerormqtt_bridgeas link target.src/pages/DashboardPage.tsxbrokerSourceIdwhen blank.src/components/configuration/MQTTConfigSection.tsxproxyLinkMisconfiguredaccepts bridges.src/server/routes/sourceRoutes.standaloneBridge.test.ts(new)src/server/mqttBridgeManager.test.tslocal-packet+publish()reaches upstream;publish()throws when disconnected.Test plan
npx tsc --noEmit— cleanvitest run src/server— 162 files / 2796 tests passvitest run src/components src/pages— 470 tests passnpm run build— cleanpublish()+local-packetemission on a real Aedes upstream broker — 2 passmeshtastic_tcpsource'smqttLinkat a standalone bridge, enableproxy_to_clienton the device firmware, verify device MQTT traffic flows upstreammqtt_brokerthat has dependent bridges, verify bridges keep running standalone and the broker is removed🤖 Generated with Claude Code