@@ -63,6 +63,9 @@ public static MmsReportSemanticProjectionContext Create(LiveIedModelDiscoveryDoc
6363 accumulated = $ "{ accumulated } .{ part } ";
6464 current = current . GetOrAdd ( part , accumulated ) ;
6565 }
66+ // Only a type backed by exact model evidence can veto a
67+ // wire leaf. Partial discovery must remain compatible.
68+ current . ObserveExactType ( ExactMmsKind ( attribute ) ) ;
6669 }
6770
6871 if ( root . Children . Count == 0 )
@@ -194,6 +197,16 @@ private static bool TryFlatten(
194197 return false ;
195198 }
196199
200+ if ( schema . HasTypeConflict )
201+ {
202+ reason = $ "typed schema conflict for { schema . Reference } : exact model sources disagree";
203+ return false ;
204+ }
205+ if ( schema . ExactKind is MmsDataKind expected && expected != value . Kind )
206+ {
207+ reason = $ "typed MMS leaf mismatch at { schema . Reference } : expected { expected } , received { value . Kind } ";
208+ return false ;
209+ }
197210 leaves . Add ( new ExpandedLeaf ( schema . Reference , value ) ) ;
198211 reason = string . Empty ;
199212 return true ;
@@ -253,6 +266,30 @@ private static string NormalizeDataSetReference(string value)
253266 return normalized [ .. ( slash + 1 ) ] + normalized [ ( slash + 1 ) .. ] . Replace ( '$' , '.' ) ;
254267 }
255268
269+ // Strictly known, model-qualified MMS kinds only. SCL bType alone is not
270+ // live MMS type authority; unknown/partial types retain existing fallback.
271+ private static MmsDataKind ? ExactMmsKind ( LiveIedDataAttributeModel attribute )
272+ {
273+ if ( attribute . TypeConfidence != LiveIedDiscoveryConfidenceLevel . Exact ||
274+ string . IsNullOrWhiteSpace ( attribute . MmsType ) )
275+ return null ;
276+
277+ return attribute . MmsType . Trim ( ) . ToLowerInvariant ( ) . Replace ( '_' , '-' ) switch
278+ {
279+ "floating-point" or "floatingpoint" => MmsDataKind . FloatingPoint ,
280+ "bit-string" or "bitstring" => MmsDataKind . BitString ,
281+ "utc-time" or "utctime" => MmsDataKind . UtcTime ,
282+ "boolean" => MmsDataKind . Boolean ,
283+ "integer" or "signed-integer" => MmsDataKind . Integer ,
284+ "unsigned" or "unsigned-integer" => MmsDataKind . Unsigned ,
285+ "octet-string" or "octetstring" => MmsDataKind . OctetString ,
286+ "visible-string" or "visiblestring" => MmsDataKind . VisibleString ,
287+ "mms-string" or "mmsstring" => MmsDataKind . MmsString ,
288+ "binary-time" or "binarytime" => MmsDataKind . BinaryTime ,
289+ _ => null
290+ } ;
291+ }
292+
256293 private sealed class SchemaNode
257294 {
258295 private readonly Dictionary < string , SchemaNode > _byName = new ( StringComparer . OrdinalIgnoreCase ) ;
@@ -263,6 +300,18 @@ public SchemaNode(string reference)
263300
264301 public string Reference { get ; }
265302 public IReadOnlyList < SchemaNode > Children => _children ;
303+ public MmsDataKind ? ExactKind { get ; private set ; }
304+ public bool HasTypeConflict { get ; private set ; }
305+
306+ public void ObserveExactType ( MmsDataKind ? kind )
307+ {
308+ if ( ! kind . HasValue )
309+ return ;
310+ if ( ExactKind . HasValue && ExactKind != kind )
311+ HasTypeConflict = true ;
312+ else
313+ ExactKind = kind ;
314+ }
266315
267316 public SchemaNode GetOrAdd ( string name , string reference )
268317 {
@@ -302,6 +351,7 @@ public static MmsReportValueProjection Project(
302351
303352 var baseline = MmsReportValueProjector . Project ( frame ) ;
304353 var semanticReplacementPositions = new HashSet < int > ( ) ;
354+ var rejectedTypedPositions = new HashSet < int > ( ) ;
305355 var semanticUpdates = new List < MmsReportSignalUpdate > ( ) ;
306356 var semanticWarnings = new List < string > ( ) ;
307357
@@ -323,7 +373,17 @@ public static MmsReportValueProjection Project(
323373 out var resolvedMemberReference ,
324374 out var expansionReason ) )
325375 {
326- if ( baselineWasRaw )
376+ // A positively contradictory exact MMS type is not permission
377+ // for the generic positional fallback to invent process values.
378+ // Preserve the original frame and explicit rejection evidence,
379+ // but exclude this member's candidate value/quality/timestamp.
380+ if ( expansionReason . StartsWith ( "typed MMS leaf mismatch" , StringComparison . Ordinal ) ||
381+ expansionReason . StartsWith ( "typed schema conflict" , StringComparison . Ordinal ) )
382+ {
383+ rejectedTypedPositions . Add ( valuePosition ) ;
384+ semanticWarnings . Add ( $ "REPORT_SEMANTIC_REJECTED: { reportedMemberReference } ; { expansionReason } ; no scalar projection from this member.") ;
385+ }
386+ else if ( baselineWasRaw )
327387 {
328388 semanticWarnings . Add ( $ "REPORT_SEMANTIC_FALLBACK: { reportedMemberReference } remained raw; { expansionReason } . Exact scalar MMS fallback remains eligible.") ;
329389 }
@@ -369,7 +429,7 @@ public static MmsReportValueProjection Project(
369429 semanticWarnings . Add ( $ "REPORT_SEMANTIC_STRUCT: { resolvedMemberReference } { expansionReason } ; exact static DataSet schema overrode generic structured-value heuristics.") ;
370430 }
371431
372- if ( semanticReplacementPositions . Count == 0 )
432+ if ( semanticReplacementPositions . Count == 0 && rejectedTypedPositions . Count == 0 )
373433 {
374434 return new MmsReportValueProjection
375435 {
@@ -383,7 +443,8 @@ public static MmsReportValueProjection Project(
383443 ReceivedAt = frame . ReceivedAt ,
384444 Header = frame . Header ,
385445 Values = frame . Values
386- . Where ( ( _ , index ) => ! semanticReplacementPositions . Contains ( index ) )
446+ . Where ( ( _ , index ) => ! semanticReplacementPositions . Contains ( index ) &&
447+ ! rejectedTypedPositions . Contains ( index ) )
387448 . ToArray ( ) ,
388449 DecoderMode = frame . DecoderMode ,
389450 Message = frame . Message
0 commit comments