merge: #549 — authoring never accepts a TagConfig enum the runtime rejects (6 models, one shared authority)

This commit is contained in:
Joseph Doherty
2026-08-09 22:15:46 -04:00
20 changed files with 466 additions and 25 deletions
@@ -154,6 +154,28 @@ public static class MTConnectTagDefinitionFactory
return warnings;
}
/// <summary>
/// <b>The single authority on which coercion-type spellings an MTConnect tag may carry</b>, consulted
/// by the runtime + deploy gate (through <see cref="TryFromTagConfig"/> / <see cref="Inspect"/>) and
/// by the AdminUI's authoring model (<c>MTConnectTagConfigModel.Validate</c>) alike.
/// <para>
/// It is public for exactly that second caller. The authoring model used to read the type with a
/// lenient enum parse that fell back to <c>String</c> on ANY unrecognised value, so a misspelled
/// name ("Strng") from a hand-authored blob, a CSV import or the API was accepted at authoring —
/// and silently rewritten — while this parse rejected it and the tag died at the driver
/// (Gitea #549). A second copy of the rule in the AdminUI would have reopened that gap the
/// moment either side moved, so there is one rule and both sides ask it.
/// </para>
/// <para>
/// A blank/absent value is ACCEPTED: it declares no override, and <see cref="TryFromTagConfig"/>
/// then falls back to the Agent's <c>/probe</c> declaration rather than rejecting the tag.
/// </para>
/// </summary>
/// <param name="raw">The authored type text, or <see langword="null"/>/blank when none was authored.</param>
/// <returns><see langword="true"/> when the driver would accept this authored type.</returns>
public static bool IsAcceptedDataTypeName(string? raw)
=> string.IsNullOrWhiteSpace(raw) || TryParseDataType(raw.Trim(), out _);
/// <summary>
/// Parses an authored coercion type by NAME. A digits-only value is rejected outright, BEFORE the
/// parse: <see cref="Enum.TryParse{TEnum}(string, bool, out TEnum)"/> accepts <c>"8"</c> as readily