fix(deploy): include ElementDataType in RevisionHashService.HashableAttribute (#290)
Fold a List attribute's ElementDataType into the hashable projection so a change to the element type (e.g. Int32 -> Double) with identical JSON-encoded values is detected as a staleness/revision change. Inserted in alphabetical position; null ElementDataType (scalars) is omitted by the canonical serializer (WhenWritingNull), so scalar-only configs hash identically to before. DiffService.AttributesEqual gains the same comparison to keep the structured diff in parity with the staleness hash. Adds tests for differing vs. equal ElementDataType (hash + diff) and the scalar no-op guard.
This commit is contained in:
@@ -119,6 +119,11 @@ public class DiffService
|
||||
a.CanonicalName == b.CanonicalName &&
|
||||
a.Value == b.Value &&
|
||||
a.DataType == b.DataType &&
|
||||
// #290: ElementDataType is part of the revision hash, so the diff must
|
||||
// treat a List element-type change (e.g. Int32 → Double) with identical
|
||||
// JSON-encoded values as a Changed attribute — keeping the structured
|
||||
// diff in parity with the staleness hash.
|
||||
a.ElementDataType == b.ElementDataType &&
|
||||
a.Description == b.Description &&
|
||||
a.IsLocked == b.IsLocked &&
|
||||
a.DataSourceReference == b.DataSourceReference &&
|
||||
|
||||
@@ -53,6 +53,7 @@ public class RevisionHashService
|
||||
CanonicalName = a.CanonicalName,
|
||||
Value = a.Value,
|
||||
DataType = a.DataType,
|
||||
ElementDataType = a.ElementDataType,
|
||||
Description = a.Description,
|
||||
IsLocked = a.IsLocked,
|
||||
DataSourceReference = a.DataSourceReference,
|
||||
@@ -174,6 +175,16 @@ public class RevisionHashService
|
||||
/// </summary>
|
||||
public string? Description { get; init; }
|
||||
/// <summary>
|
||||
/// For List attributes: the element scalar type name; null otherwise.
|
||||
/// Folded into the hash (#290) so a List element-type change (e.g.
|
||||
/// Int32 → Double) with identical JSON-encoded values is detected as a
|
||||
/// staleness/revision change. Null for scalar attributes — and because
|
||||
/// the serializer ignores null properties
|
||||
/// (<see cref="JsonIgnoreCondition.WhenWritingNull"/>), scalar-only
|
||||
/// configurations hash identically to before this field was added.
|
||||
/// </summary>
|
||||
public string? ElementDataType { get; init; }
|
||||
/// <summary>
|
||||
/// Whether the attribute is locked.
|
||||
/// </summary>
|
||||
public bool IsLocked { get; init; }
|
||||
|
||||
Reference in New Issue
Block a user