Skip to content

fix: publish under the standard kebab component token + envelope-projection stance - #5

Merged
mbreissi merged 1 commit into
mainfrom
fix/component-token
Jul 28, 2026
Merged

fix: publish under the standard kebab component token + envelope-projection stance#5
mbreissi merged 1 commit into
mainfrom
fix/component-token

Conversation

@mbreissi

Copy link
Copy Markdown
Contributor

The bug

A default run of this adapter published under MtconnectAdapter:

ecv1/demo-thing/MtconnectAdapter/okuma/data/axes-axes/linear-x/lx1actm

while every document in this repository — the messaging reference, the tutorial, the metrics
reference, the how-to guides — says mtconnect-adapter.

Why

libs/rust/src/config/identity.rs resolves the UNS component token as component.token when
configured, otherwise the short form of the component name (the segment after the last .).
This adapter passes the Greengrass component name com.mbreissi.edgecommons.MtconnectAdapter, so
the fallback yields PascalCase. No configuration here set component.token.

The standard is lower-kebab on the wire — the canonical config schema pins
component.token to ^[a-z0-9]+(?:-[a-z0-9]+)*$ and describes it as "First-party EdgeCommons
components use lower-kebab tokens (for example, opcua-adapter) while their Greengrass component
names use the com.mbreissi.edgecommons.<Name> pattern." The reference adapters follow it:
opcua-adapter and modbus-adapter set component.token in every configuration they ship.

The fix

Same mechanism as the siblings — component.token, no code change — applied to every configuration
surface this component ships: test-configs/config.json, test-configs/mtconnect.json,
k8s/configmap.yaml, and recipe.yaml (the Greengrass default configuration).

Documentation follows the now-true token: the README quick start (its config, its captured topics,
and its envelope example), the four sample configurations, and the configuration and messaging
references — which now also record where the token comes from, and that the Greengrass component
name never appears on the wire.

Envelope JSON-projection stance

The messaging reference's envelope section now opens with the canonical stance: the envelope is
documented in its JSON projection — the canonical field names and shapes; the MQTT/IPC wire encoding
is the protobuf envelope (proto/edgecommons/v1), which round-trips this projection exactly.

Validation

cargo test — 362 tests, all green.

Live run against EMQX on localhost:1883 (--platform HOST --transport MQTT, -c FILE ./test-configs/config.json -t demo-thing), subscriber on ecv1/#:

ecv1/demo-thing/mtconnect-adapter/cfg
ecv1/demo-thing/mtconnect-adapter/state
ecv1/demo-thing/mtconnect-adapter/device-1/data/temperature-1
ecv1/demo-thing/mtconnect-adapter/device-1/data/pressure-1
ecv1/demo-thing/mtconnect-adapter/device-1/evt/info/device-connected
ecv1/demo-thing/mtconnect-adapter/device-1/evt/critical/device-unreachable

The protobuf payloads carry the matching identity: path factory-1/demo-thing, component
mtconnect-adapter, instance device-1.

…ection stance

The adapter published under `MtconnectAdapter`: with no `component.token` set, the
library falls back to the short form of the Greengrass component name
(`com.mbreissi.edgecommons.MtconnectAdapter`), which is PascalCase. Every doc in
this repo already said `mtconnect-adapter`, and the sibling reference adapters
(opcua-adapter, modbus-adapter) set `component.token` explicitly for exactly this
reason. Set it here too, in every configuration surface: both test-configs, the
Greengrass recipe, and the Kubernetes ConfigMap.

Documentation follows the now-true token: the README quick start (its config, its
captured topics, and its envelope example), the sample configurations, and the
configuration/messaging references, which now also say where the token comes from
and that the Greengrass component name never reaches the wire.

Also adopts the envelope JSON-projection stance atop the messaging reference's
envelope section, matching the core southbound contract.
@mbreissi
mbreissi merged commit 41a657e into main Jul 28, 2026
4 checks passed
@mbreissi
mbreissi deleted the fix/component-token branch July 28, 2026 17:09
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