feat(config): remove the SystemPlatform NamespaceKind (capstone) — Galaxy is Equipment-kind

This commit is contained in:
Joseph Doherty
2026-06-12 22:18:56 -04:00
parent 0945f19a50
commit dcbaf63ab1
8 changed files with 60 additions and 73 deletions
@@ -136,7 +136,7 @@ public sealed class DraftValidatorTests
DriverInstances = [new DriverInstance { DriverInstanceId = "d-1", ClusterId = "c", NamespaceId = "ns-1", Name = "drv", DriverType = "GalaxyMxGateway", DriverConfig = "{}" }],
};
DraftValidator.Validate(draft).ShouldNotContain(e => e.Code == "DriverNamespaceKindMismatch");
DraftValidator.Validate(draft).ShouldBeEmpty();
}
/// <summary>Verifies that all validation errors are reported simultaneously.</summary>
@@ -165,32 +165,15 @@ public sealed class DraftValidatorTests
// ------------------------------------------------------------------------------------
/// <summary>Probe for the deploy-path gate activation: a full, realistic config modelling
/// the REAL deployed shape (a SystemPlatform namespace + GalaxyMxGateway driver + SystemPlatform
/// Tags with EquipmentId=null from the OtOpcUa seed, PLUS an Equipment namespace + Modbus driver
/// + UNS area/line + canonical Equipment rows + VirtualTags from the company overlay) must
/// the REAL deployed shape. Galaxy is now a standard Equipment-kind driver (the SystemPlatform
/// namespace split is retired), so the GalaxyMxGateway driver + its Galaxy-hierarchy Tags
/// (EquipmentId=null from the seed) live in the Equipment namespace alongside a Modbus driver
/// + UNS area/line + canonical Equipment rows + VirtualTags from the company overlay. This must
/// produce ZERO validation errors so the reject-on-any-error gate is safe to activate.</summary>
[Fact]
public void Full_realistic_config_passes_all_rules()
{
// SystemPlatform side (OtOpcUa seed shape): Galaxy hierarchy, no Equipment, Tags carry EquipmentId=null.
var spNamespace = new Namespace
{
NamespaceId = "MAIN-OPCUA-systemplatform",
ClusterId = "MAIN",
Kind = NamespaceKind.SystemPlatform,
NamespaceUri = "urn:zb:main:systemplatform",
};
var spDriver = new DriverInstance
{
DriverInstanceId = "main-galaxy",
ClusterId = "MAIN",
NamespaceId = spNamespace.NamespaceId,
Name = "Galaxy",
DriverType = "GalaxyMxGateway",
DriverConfig = "{}",
};
// Equipment side (company overlay): Modbus driver in an Equipment namespace + UNS + canonical equipment.
// Equipment side: Galaxy + Modbus drivers in a single Equipment namespace + UNS + canonical equipment.
var eqNamespace = new Namespace
{
NamespaceId = "MAIN-OPCUA-equipment",
@@ -198,6 +181,18 @@ public sealed class DraftValidatorTests
Kind = NamespaceKind.Equipment,
NamespaceUri = "urn:zb:main:equipment",
};
// Galaxy hierarchy (OtOpcUa seed shape): GalaxyMxGateway driver, Tags carry EquipmentId=null.
var spDriver = new DriverInstance
{
DriverInstanceId = "main-galaxy",
ClusterId = "MAIN",
NamespaceId = eqNamespace.NamespaceId,
Name = "Galaxy",
DriverType = "GalaxyMxGateway",
DriverConfig = "{}",
};
var eqDriver = new DriverInstance
{
DriverInstanceId = "main-modbus",
@@ -242,14 +237,14 @@ public sealed class DraftValidatorTests
GenerationId = 0,
ClusterId = string.Empty, // global snapshot — matches DraftSnapshotFactory.FromConfigDbAsync
// Enterprise/Site left null — matches the deploy path's conservative fallback
Namespaces = [spNamespace, eqNamespace],
Namespaces = [eqNamespace],
DriverInstances = [spDriver, eqDriver],
UnsAreas = [area],
UnsLines = [line],
Equipment = [rinser, filler],
Tags =
[
// SystemPlatform tags from the seed: EquipmentId null, Galaxy folder hierarchy.
// Galaxy-hierarchy tags from the seed: EquipmentId null, Galaxy folder hierarchy.
BuildTag(equipmentId: null, name: "PV", folderPath: "Area.Tank01"),
BuildTag(equipmentId: null, name: "SP", folderPath: "Area.Tank01"),
],
@@ -118,7 +118,7 @@ public sealed class DriverTypeRegistryTests
var registry = new DriverTypeRegistry();
registry.Register(SampleMetadata("Modbus"));
registry.Register(SampleMetadata("S7"));
registry.Register(SampleMetadata("Galaxy", NamespaceKindCompatibility.SystemPlatform));
registry.Register(SampleMetadata("Galaxy", NamespaceKindCompatibility.Equipment));
var all = registry.All();
@@ -132,12 +132,14 @@ public sealed class DriverTypeRegistryTests
[Fact]
public void NamespaceKindCompatibility_FlagsAreBitmask()
{
// Per decision #111 — driver types like OpcUaClient may be valid for multiple namespace kinds.
var both = NamespaceKindCompatibility.Equipment | NamespaceKindCompatibility.SystemPlatform;
// Per decision #111 — driver types may be valid for multiple namespace kinds.
var both = NamespaceKindCompatibility.Equipment | NamespaceKindCompatibility.Simulated;
both.HasFlag(NamespaceKindCompatibility.Equipment).ShouldBeTrue();
both.HasFlag(NamespaceKindCompatibility.SystemPlatform).ShouldBeTrue();
both.HasFlag(NamespaceKindCompatibility.Simulated).ShouldBeFalse();
both.HasFlag(NamespaceKindCompatibility.Simulated).ShouldBeTrue();
// A single-flag value does not carry the other flag — proves these are real bitmask bits.
NamespaceKindCompatibility.Equipment.HasFlag(NamespaceKindCompatibility.Simulated).ShouldBeFalse();
}
/// <summary>