fix(adminui): the MQTT tag editor writes a meaningless payloadFormat into a Sparkplug tag blob #513

Open
opened 2026-07-27 13:50:31 -04:00 by dohertj2 · 0 comments
Owner

MqttTagConfigEditor writes a payloadFormat key into the tag's TagConfig JSON even when the tag is in
SparkplugB mode, where the key has no meaning — payloadFormat (Json/Raw/Scalar) is a Plain-mode
concept.

Cosmetic only, and confirmed so. The tag factory routes Sparkplug tags on the Sparkplug keys
(groupId/edgeNodeId/deviceId/metricName) and ignores payloadFormat entirely, so nothing is
mis-bound — the value is noise in the stored blob, not a behaviour.

Why fix it anyway. The blob is operator-visible (it is what the raw-JSON textarea shows and what a config
export contains), and a key that looks like it selects a decode path but does not is a trap for the next
person reading a Sparkplug tag's config — including anyone diagnosing a decode problem.

Fix. Have the editor's ToJson omit payloadFormat when mode is SparkplugB. Keep the
preserve-unknown-keys behaviour intact (the editors deliberately round-trip keys they do not own — do not let
this change start dropping foreign keys).

Acceptance. A Sparkplug tag authored through the editor round-trips without a payloadFormat key; a Plain
tag still carries it; unknown keys are still preserved on both paths.

`MqttTagConfigEditor` writes a `payloadFormat` key into the tag's `TagConfig` JSON even when the tag is in **SparkplugB** mode, where the key has no meaning — `payloadFormat` (`Json`/`Raw`/`Scalar`) is a **Plain**-mode concept. **Cosmetic only, and confirmed so.** The tag factory routes Sparkplug tags on the Sparkplug keys (`groupId`/`edgeNodeId`/`deviceId`/`metricName`) and ignores `payloadFormat` entirely, so nothing is mis-bound — the value is noise in the stored blob, not a behaviour. **Why fix it anyway.** The blob is operator-visible (it is what the raw-JSON textarea shows and what a config export contains), and a key that looks like it selects a decode path but does not is a trap for the next person reading a Sparkplug tag's config — including anyone diagnosing a decode problem. **Fix.** Have the editor's `ToJson` omit `payloadFormat` when mode is SparkplugB. Keep the preserve-unknown-keys behaviour intact (the editors deliberately round-trip keys they do not own — do not let this change start dropping foreign keys). **Acceptance.** A Sparkplug tag authored through the editor round-trips without a `payloadFormat` key; a Plain tag still carries it; unknown keys are still preserved on both paths.
dohertj2 added the driver/mqtt label 2026-07-27 13:50:31 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#513