fix(adminui): reject AbLegacy array length >256 at author-time (review I-3)
v2-ci / build (push) Failing after 1m3s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped

This commit is contained in:
Joseph Doherty
2026-06-16 22:31:42 -04:00
parent 3bb2031d1d
commit 0f92e9e238
2 changed files with 45 additions and 1 deletions
@@ -99,4 +99,34 @@ public sealed class AbLegacyTagConfigModelTests
json.ShouldContain("\"deviceHostAddress\":\"ab://host\"");
}
// Array-length cap (review I-3): authored arrayLength > 256 on an AbLegacy array tag must be
// rejected at author-time to prevent a Part 6 §5.3.2 ArrayDimensions mismatch at runtime.
[Fact]
public void Validate_returns_error_when_array_length_exceeds_256()
{
var m = AbLegacyTagConfigModel.FromJson("""{"address":"N7:0","isArray":true,"arrayLength":300}""");
var error = m.Validate();
error.ShouldNotBeNull();
error.ShouldContain("256");
}
[Fact]
public void Validate_returns_null_when_array_length_exactly_256()
{
var m = AbLegacyTagConfigModel.FromJson("""{"address":"N7:0","isArray":true,"arrayLength":256}""");
m.Validate().ShouldBeNull();
}
[Fact]
public void Validate_returns_null_for_scalar_tag_regardless_of_no_array_length()
{
var m = AbLegacyTagConfigModel.FromJson("""{"address":"N7:0"}""");
m.Validate().ShouldBeNull();
}
}