MTConnect driverDataType is a second, runtime-preferred spelling the AdminUI editor neither reads nor writes #550

Closed
opened 2026-08-09 22:20:16 -04:00 by dohertj2 · 1 comment
Owner

Found during #549. MTConnectTagDefinitionFactory reads driverDataType at HIGHER precedence than dataType (~line 78), but MTConnectTagConfigModel only reads/writes dataType. Consequences: (1) a blob carrying "driverDataType": "Strng" is still accepted at authoring while the runtime rejects the tag — the residual slice of #549; (2) worse, a VALID driverDataType silently overrides whatever type the editor displays and saves, so the editor shows a lie.

Fix must do BOTH halves together: read both spellings in runtime precedence order in FromJson, and normalise onto dataType in ToJson (dropping the alias), exactly as the model already does for dataItemId/address. Doing only one half silently retypes existing tags on their next save.

Found during #549. `MTConnectTagDefinitionFactory` reads `driverDataType` at HIGHER precedence than `dataType` (~line 78), but `MTConnectTagConfigModel` only reads/writes `dataType`. Consequences: (1) a blob carrying `"driverDataType": "Strng"` is still accepted at authoring while the runtime rejects the tag — the residual slice of #549; (2) worse, a VALID `driverDataType` silently overrides whatever type the editor displays and saves, so the editor shows a lie. Fix must do BOTH halves together: read both spellings in runtime precedence order in `FromJson`, and normalise onto `dataType` in `ToJson` (dropping the alias), exactly as the model already does for `dataItemId`/`address`. Doing only one half silently retypes existing tags on their next save.
Author
Owner

FIXED — merged to master as b50523b1 (branch commits 8971861b + a486a009).

MTConnectTagConfigModel now mirrors the runtime exactly, both halves in one commit:

  • Read: DataTypeKeys = ["driverDataType", "dataType"] walked with the runtime's FirstNonBlank per-key semantics — absent/null/blank falls through, a NON-string token STOPS (the runtime's string? DTO deserialise throws on it, so it can never fall through), first non-blank string wins. Both the displayed DataType and the Validate()-judged raw token come from this one read.
  • Normalise: ToJson() drops every non-canonical DataTypeKeys entry (loop keyed off the same array as the read, so a third spelling can never be read-but-not-dropped) and writes dataType as the enum name.
  • Rejections now name the offending spelling (driverDataType "Strng" …), not always dataType.

Falsified both half-fixes: read-only (no drop) → 9 red (no-drift + no-retype tests); drop-only (no precedence read) → 14 red (the Int32-blob-saves-as-String retype test + alias rejection parity). Verified on the merged tree: AdminUI 1233, MTConnect 534 + 15 integration, ControlPlane 261 — all green.

Residual found en route, filed separately: the CSV export/import round-trip preserves driverDataType in the free-form residual where it still out-ranks the MtDataType column — covered for the invalid case by #551's import gate; the valid-alias-shadows-the-column case is part of the new CSV-merge issue.

**FIXED** — merged to master as `b50523b1` (branch commits `8971861b` + `a486a009`). `MTConnectTagConfigModel` now mirrors the runtime exactly, both halves in one commit: - **Read**: `DataTypeKeys = ["driverDataType", "dataType"]` walked with the runtime's `FirstNonBlank` per-key semantics — absent/null/blank falls through, a NON-string token STOPS (the runtime's `string?` DTO deserialise throws on it, so it can never fall through), first non-blank string wins. Both the displayed `DataType` and the `Validate()`-judged raw token come from this one read. - **Normalise**: `ToJson()` drops every non-canonical `DataTypeKeys` entry (loop keyed off the same array as the read, so a third spelling can never be read-but-not-dropped) and writes `dataType` as the enum name. - Rejections now name the offending spelling (`driverDataType "Strng"` …), not always `dataType`. Falsified both half-fixes: read-only (no drop) → 9 red (no-drift + no-retype tests); drop-only (no precedence read) → 14 red (the `Int32`-blob-saves-as-`String` retype test + alias rejection parity). Verified on the merged tree: AdminUI 1233, MTConnect 534 + 15 integration, ControlPlane 261 — all green. Residual found en route, filed separately: the CSV export/import round-trip preserves `driverDataType` in the free-form residual where it still out-ranks the `MtDataType` column — covered for the *invalid* case by #551's import gate; the *valid*-alias-shadows-the-column case is part of the new CSV-merge issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#550