Skip to content

The datatype rules contradict each other across chapters, and the TCK enforces the wrong side #665

Done

Description

@wes-johnson

The rules about where a metric's datatype lives have drifted apart across four chapters since the metadata separation moved it out of the BIRTH. They are not consistent with each other today, and one of the inconsistencies makes the TCK fail a conforming Edge Node.

Found while reviewing #662; none of it is caused by that change, and #664 is the narrow part that could be done without touching any of this.

The contradiction

tck-id-topics-nbirth-no-metadata, -dbirth-no-metadata the BIRTH MUST NOT be used to convey metric datatype; it is conveyed only in the NMETA/NMMETA, or DMETA/DMMETA for a Device
tck-id-payloads-metric-datatype-req the datatype MUST be included with each metric definition in NBIRTH and DBIRTH messages

Two MUSTs, directly opposed, for the same field in the same message.

It is live in the TCK, not just on paper

SessionEstablishmentTest enforces the second one. Lines 676-682 (NBIRTH) and 875-882 (DBIRTH) score ID_PAYLOADS_METRIC_DATATYPE_REQ with countDataType(metrics) == metrics.size(), requiring every metric in a BIRTH to carry the field.

So an Edge Node that correctly omits the datatype from its BIRTH, as the Topics chapter requires, fails the TCK, while one that includes it — violating the Topics chapter — passes. Both log lines still read "The datatype MUST be included with each metric definition in NBIRTH and DBIRTH messages."

Nothing scores topics-nbirth-no-metadata or topics-dbirth-no-metadata, so the rule that is presumably correct is unchecked.

Two more places carrying the pre-separation model

  • Sparkplug_1_Introduction.adoc:429 — "Every Metric must include a Sparkplug Datatype in the NBIRTH or DBIRTH message depending on whether the Metric is a 'Node level' or 'Device level' metric."
  • operational-behavior-data-publish-node-metric-datatype and -device-metric-datatype require that the datatype not change "in subsequent NDATA messages", which cannot happen if NDATA carries no datatype at all.

And a duplication, which is the #651 failure mode

The same rule is stated in several places, so any fix has to touch all of them:

  • the datatype belongs in the META: topics-nmeta-metrics, topics-dmeta-metrics, payloads-nmeta-metric-defs, payloads-dmeta-metric-defs, payloads-mmeta-metric-defs;
  • the BIRTH must not carry it: topics-nbirth-no-metadata, topics-nrebirth-no-metadata, topics-dbirth-no-metadata, topics-drebirth-no-metadata, and again in payloads-nbirth-metrics, -nrebirth-metrics, -dbirth-metrics, -drebirth-metrics.

Why it is one issue

An attempt to fix payloads-metric-datatype-req alone was tried in #662 and did not hold: rewording it to name the META messages removed the contradiction but restated four assertions that already said the same thing, left Chapter 1 behind, and made the SessionEstablishmentTest failure above go live. The pieces have to move together.

This is the concrete, worked case of #446 — which components of a metric are mandatory, by message type. Suggest doing it as the first row of that matrix rather than as a separate exercise.

Activity

  1. added this to the M2 milestone on Dec 1, 2026
  2. added
    spec bug
    on Dec 1, 2026
  3. self-assigned this
    on Dec 1, 2026
  4. added 14 commits that reference this issue on Dec 2, 2026
  5. wes-johnson commented on Dec 5, 2026

    @wes-johnson
    ContributorAuthor

    Done in #666, merged to develop as 6965984. Closing by hand: the Closes #665 keyword only fires on a merge into the default branch (master), and this line merges into develop first.

    What landed

    • The contradiction: payloads-metric-datatype-req removed. The datatype is required by topics-nmeta-metrics and topics-dmeta-metrics, as the Topics chapter already said.
    • The TCK enforcing the wrong side: both BIRTH checks now score topics-nbirth-no-metadata and topics-dbirth-no-metadata, which had no test at all before. A conforming Edge Node no longer fails.
    • Sparkplug_1_Introduction.adoc:429 and the two operational-behavior-data-publish-*-metric-datatype assertions retired off the BIRTH; the latter now require the value to use the TypedValue field the declared datatype maps to, which is actually checkable from a protobuf NDATA.
    • The duplication: seven Payloads assertions removed, each replaced by a pointer to the Topics section that states the rule. Exact/superset duplicates between Chapters 4 and 6 went 2+4 → 0+0.

    Two families turned up during review that this issue didn't name, and both were the same defect in a different field:

    • Command Definitions were required "only in NBIRTH or DBIRTH" while topics-nmeta-cmd-metrics required them in the full NMETA. Moved to the META, along with operational-behavior-command-definition-meta, the Commands prose, the NCMD/DCMD name rules and three schema comments.
    • Aliases: payloads-alias-birth-requirement demanded "both a metric name and alias" in a BIRTH, against topics-nbirth-metrics. The alias-to-name binding is established in the META and is optional per metric; renamed to payloads-alias-assigned / payloads-alias-not-assigned.

    Net 664 → 657 tck-ids (11 removed, 4 added, of which 4 removals are renames).

    Gaps this leaves open

    Recording these here rather than letting them close with the issue.

    TCK coverage — the TCK has no NMETA/DMETA handling, which is the root of the first three:

    1. Nothing scores topics-nmeta-metrics / topics-dmeta-metrics, so no test checks that a metric definition declares a datatype at all. Before [#665] Make the Topics chapter canonical, and reconcile the metric definition rules with the META messages #666 that was enforced by payloads-metric-datatype-req and a hasDatatype() term in the BIRTH checks; both were correct to remove, but nothing replaced them on the META side.
    2. The alias checks (SessionEstablishmentTest, SendComplexDataTest.checkAliasInData) test only that exactly one identifier is present, not the actual rule, because the test cannot know which metrics were assigned an alias.
    3. topics-nrebirth-no-metadata and topics-drebirth-no-metadata remain unscored — the TCK has no NREBIRTH/DREBIRTH handling. Pre-existing.
    4. The inverted no-metadata predicate has no JUnit test, though it is pure and needs no broker. It was verified by executing it against hand-built metrics, which is not reproducible in CI.

    Specification

    1. 19 name-matched topics-X / payloads-X pairs remain (down from 23) — payloads-nmeta-cmd-metrics vs topics-nmeta-cmd-metrics, payloads-nmeta-no-value vs topics-nmeta-no-value, the *-defid pairs. Near-duplicates rather than identical, and not definition rules, so they belong with the Clarify which components of a Sparkplug metric are mandatory and which are optional #446 matrix rather than here.
    2. NMMETA/DMMETA is a deliberate exception to "Topics is canonical". This issue's list named payloads-mmeta-metric-defs, which does not exist; the real rule is payloads-mmeta-add, and the Topics chapter states no metric rule for NMMETA/DMMETA, so Chapter 6 stays canonical there.
    3. Rebirth rate limiting is Nothing bounds how often a Host Application may send Rebirth Requests #663. [#665] Make the Topics chapter canonical, and reconcile the metric definition rules with the META messages #666 made a previously unevaluatable rule live, and a mismatch is not self-curing — the rebirth re-reports the same declaration — so the per-message rebirth obligation needs the bound Nothing bounds how often a Host Application may send Rebirth Requests #663 covers.

    Items 1, 2 and 4 want a TCK issue of their own once NMETA/DMETA handling exists; 5 goes to #446 and 7 to #663.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

M2spec bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions