feat(grpc-data): X0 review - tolerate any unknown bit at the artifact/catalog seam; drop diagnostics for exports and mappings
- ValidateDeployed ignores every bit outside Understood (understood subset still validated); P02's two 1<<30 rows become 'tolerated, grants nothing'. - UnknownOperationDrops: Warning + counter tagged kind=connection|export|mapping, counted once per row per accepted artifact change; collected under each lock, logged after release. Mappings masked at Stage. - Surfaced via DataConnectionDiagnosticsSnapshot (DroppedUnknownOperations, MappingsWithDroppedOperations) and NodeDiagnosticsSnapshot.DroppedExportOperations. - End-to-end test: 1<<30 through parse -> catalog compile -> mapping stage -> runtime apply. - DataConnectionProtoContract.Validate() now runs at AddOtOpcUaDataConnections.
This commit is contained in:
@@ -21,10 +21,11 @@ public static class DataConnectionValidator
|
||||
|
||||
/// <summary>
|
||||
/// Node-side re-validation of an already-deployed artifact (artifact parse, origin catalog compile). Identical to
|
||||
/// <see cref="Validate(DraftSnapshot)"/> except that the X0-RESERVED operation bits (<see cref="DataOperationSets.Reserved"/>)
|
||||
/// are IGNORED rather than rejected: a newer central may author them, and rejecting would take down every data
|
||||
/// connection/export on the node. Each consumer of the rows keeps only the bits it understands (fail closed). A bit
|
||||
/// outside both sets is still a malformed row (nothing can author it).
|
||||
/// <see cref="Validate(DraftSnapshot)"/> except that operation bits outside <see cref="DataOperationSets.Understood"/>
|
||||
/// are IGNORED rather than rejected (X0 tolerant reader): a newer central may author them, and rejecting would take
|
||||
/// down every data connection/export on the node. The understood subset is still validated (a row must be non-empty;
|
||||
/// a mapping may not grant an understood operation its connection lacks), and every consumer of the rows masks the
|
||||
/// rest away, so an unknown bit grants nothing (fail closed).
|
||||
/// </summary>
|
||||
public static IReadOnlyList<ValidationError> ValidateDeployed(DraftSnapshot draft) => Validate(draft, deployed: true);
|
||||
|
||||
@@ -34,8 +35,8 @@ public static class DataConnectionValidator
|
||||
var errors = new List<ValidationError>();
|
||||
void Add(string code, string id, string message) => errors.Add(new(code, message, id));
|
||||
bool Same(string? a, string? b) => Ids.Equals(a, b);
|
||||
var accepted = deployed ? KnownOperations | DataOperationSets.Reserved : KnownOperations;
|
||||
bool ValidOps(DataOperations operations) => operations != DataOperations.None && (operations & ~accepted) == 0;
|
||||
bool ValidOps(DataOperations operations) => operations != DataOperations.None &&
|
||||
(deployed || (operations & ~KnownOperations) == 0);
|
||||
DataOperations Understood(DataOperations operations) => deployed ? operations & DataOperationSets.Understood : operations;
|
||||
bool NodesValid(IEnumerable<string> ids, string owner)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user