Merge #998: ZTag/SAPID + historian-tagname duplicate gate rules, DanglingReference rule, filtered unique indexes fixed, RowVersion on ClusterNode/ServerCluster

This commit is contained in:
Joseph Doherty
2026-12-03 10:50:14 -05:00
24 changed files with 2833 additions and 171 deletions
+10
View File
@@ -144,6 +144,16 @@ removed (terminal Bad, then `RemoveVariableNode`, which severs the backing raw n
inverse `Organizes` edge) **before** the equipment subtree, and the subtree removal severs
the same edge for anything it reaches itself (archreview 03/P5 + 03/S20).
## Deploy-gate integrity rules (lmxopcua#998)
The parent links of the config tables (Tag→Device/TagGroup, Device→DriverInstance, Equipment→UnsLine, reference→Tag/Equipment, ...) are
**logical** foreign keys only, and the service-layer "is it empty?" delete checks are not serialised against a concurrent add. The deploy gate
(`DraftValidator.ValidateDanglingReferences`) therefore names every orphan as `DanglingReference` instead of letting each composer silently skip a
row with no path. Also enforced at the gate: fleet-wide `Equipment.ZTag` / `SAPID` uniqueness (`BadDuplicateExternalIdentifier`; see
`docs/Reservations.md`) and duplicate owned historian tagnames (`HistorianTagnameDuplicate`, `.claude/rules/historian.md`). The never-firing
`PathTooLong` and `EquipmentUuidImmutable` rules were deleted (the UnsSegment charset already bounds the path at 164 chars; no prior-generation
table exists to diff).
## The `Calculation` driver
Signal-level calculated tags are ordinary raw tags bound to a `Calculation` driver
+11
View File
@@ -1,5 +1,16 @@
# External-ID Reservations
> **Status (lmxopcua#998, 2026-12): the reservation ledger has no writer.** `sp_PublishGeneration`, the only code
> that inserted `ExternalIdReservation` rows, was retired with the generation model (it now only `RAISERROR`s), so the
> table stays empty and the pre-flight below can only fire against rows an operator inserted by hand. **Fleet-wide
> ZTag / SAPID uniqueness is now enforced by the deploy gate itself**: `DraftValidator.ValidateEquipmentExternalIdUniqueness`
> groups every equipment row in the (whole-DB) draft snapshot by trimmed, case-insensitive ZTag and by SAPID and
> reports each duplicate as `BadDuplicateExternalIdentifier` naming the other equipment (same cluster or not).
> Blank values mean "no identifier". The permanent-claim semantics described below (a retired asset's id staying
> reserved) are **not** provided; the table, `/reservations` page and release procedure remain for any rows that
> already exist. The equipment page's field hint says "rejected when you deploy", matching this. A filtered unique
> index on `Equipment.ZTag` / `SAPID` was not added (needs a duplicate pre-clean migration); the gate is the authority.
The reservation subsystem guarantees that an asset's **external identifiers**
— its `ZTag` and `SAPID` — belong to exactly one piece of equipment across the
entire fleet, for all time. It is the mechanism that stops two pieces of