fix(grpc-data): H2 review 8 - history timeout rides the artifact, not the trust-scope fingerprint

DataConnectionScopeRevision covers consumer/connection/secret scope only; limits (TimeoutMilliseconds and now
HistoryTimeoutMilliseconds) reach DB-less nodes and the LocalDb cache in the artifact's entity JSON. Dropping the field
also avoids a one-time scope-version bump on upgrade. Plan 6 corrected.
This commit is contained in:
Joseph Doherty
2026-11-23 21:53:58 -05:00
parent e0956a55d6
commit 6a621423f4
3 changed files with 9 additions and 9 deletions
@@ -962,7 +962,7 @@ NodeId: accepted under owner decision Q2, as removal + addition + RefreshRequire
| A2 (host options, not ConfigDb) | — | `DataConnections:MaxImportedConditionNodes` (122500), `DataConnections:MaxImportedConditionBytes` (400 MiB), `DataConnections:ConditionKnownSignalTimeout:<DriverType>` (origin; 120 s), `DataConnections:ConditionKnownSettle:OpcUaClient` (origin backstop for upstreams without ConditionRefresh; 60 s), `DataConnections:ConditionKeySecret` (secret) |
Each migration phase also adds the bits to `KnownOperations`, extends `DeploymentArtifact.DataConnections.cs`, and includes the
new fields in `DataConnectionScopeRevision` (so DB-less nodes and the LocalDb artifact cache receive them). It also adds
new fields in the artifact (limits ride the artifact's entity JSON to DB-less nodes and the LocalDb artifact cache, like `TimeoutMilliseconds`; they are NOT part of the trust-scope fingerprint `DataConnectionScopeRevision`, which covers consumer/connection/secret scope only — H2 review). It also adds
validator rules: mapping bits ⊆ connection bits, limits positive, `AllowGalaxyServiceAck` only with `AlarmAcknowledge`, and
(A2) a warning when Σ `MaxConditions` of a consumer node's mappings × 49 (the counted worst-case subtree) exceeds
`MaxImportedConditionNodes`. Each also grows `LocalDataServices.cs:47` `Implemented(target)`.
@@ -15,9 +15,7 @@ public static class DataConnectionScopeRevision
var entries = connections.Where(c => c.Enabled).SelectMany(c => c.ConsumerNodeIds.Select(node => new
{
Owner = c.ClusterId.ToUpperInvariant(), Consumer = node.ToUpperInvariant(),
Connection = c.DataConnectionId.ToUpperInvariant(), SecretOwner = c.SecretScopeClusterId.ToUpperInvariant(), Secret = c.SecretReference,
// H2 (plan §6): new connection fields are part of the scope so DB-less nodes and the LocalDb cache re-scope on a change.
c.HistoryTimeoutMilliseconds
Connection = c.DataConnectionId.ToUpperInvariant(), SecretOwner = c.SecretScopeClusterId.ToUpperInvariant(), Secret = c.SecretReference
})).OrderBy(x => x.Owner, StringComparer.Ordinal).ThenBy(x => x.Consumer, StringComparer.Ordinal)
.ThenBy(x => x.Connection, StringComparer.Ordinal).ThenBy(x => x.SecretOwner, StringComparer.Ordinal).ThenBy(x => x.Secret, StringComparer.Ordinal).ToArray();
var fingerprint = Convert.ToHexString(SHA256.HashData(JsonSerializer.SerializeToUtf8Bytes(entries)));
@@ -67,18 +67,20 @@ public sealed class GrpcDataHistoryConfigurationTests
}
[Fact]
public void The_scope_revision_includes_the_history_timeout()
public void Limits_ride_the_artifact_so_the_trust_scope_revision_ignores_the_history_timeout()
{
// The scope fingerprint covers credential/trust scope only (consumer, connection, secret); limits such as
// TimeoutMilliseconds and HistoryTimeoutMilliseconds travel in the artifact's entity JSON (GrpcDataArtifactReadTests).
var connection = new DataConnection
{
DataConnectionId = "c", ClusterId = "a", Enabled = true, ConsumerNodeIds = ["n"], SecretScopeClusterId = "a", SecretReference = "s",
};
var first = DataConnectionScopeRevision.Advance(0, null, [connection]);
DataConnectionScopeRevision.Advance(first.Version, first.Fingerprint, [connection]).Version.ShouldBe(first.Version);
connection.HistoryTimeoutMilliseconds = 5000;
var changed = DataConnectionScopeRevision.Advance(first.Version, first.Fingerprint, [connection]);
changed.Fingerprint.ShouldNotBe(first.Fingerprint);
changed.Version.ShouldBe(first.Version + 1);
connection.TimeoutMilliseconds = 7000;
var same = DataConnectionScopeRevision.Advance(first.Version, first.Fingerprint, [connection]);
same.Fingerprint.ShouldBe(first.Fingerprint);
same.Version.ShouldBe(first.Version);
}
[Fact]