Merge #937: scripted-alarm Part 9 methods report the engine's verdict (BadInvalidState / BadTimeout outcome-unknown), refused changes reverted, broadcast to the peer only after a local Applied/Unknown; MaxNodesPerMethodCall quota; 2 review rounds
v2-ci / unit-tests (push) Failing after 12m14s

This commit is contained in:
Joseph Doherty
2026-11-28 12:47:33 -05:00
30 changed files with 1996 additions and 57 deletions
+11 -1
View File
@@ -192,7 +192,7 @@ try
var root = mutation.RootElement;
string[] allowedFields = ["connection_id", "target_mode", "target_node_id", "consistency", "consumer_node_ids", "connection_enabled", "connection_allowed_operations",
"mapping_enabled", "write_through", "allowed_operations", "export_id", "export_enabled", "export_allowed_operations", "source_redundancy_mode", "consumer_redundancy_mode",
"control_redundancy_mode", "rename_tag", "upsert_tag", "upsert_reference", "remove_tag_id", "disable_feature", "key_action", "key_expiry_seconds", "upsert_connection", "upsert_mapping", "upsert_export", "remove_mapping_id", "maintenance_mode", "acl_permissions", "bump_mapping_revision"];
"control_redundancy_mode", "rename_tag", "upsert_tag", "upsert_reference", "remove_tag_id", "disable_feature", "key_action", "key_expiry_seconds", "upsert_connection", "upsert_mapping", "upsert_export", "remove_mapping_id", "maintenance_mode", "acl_permissions", "bump_mapping_revision", "scripted_predicate"];
if (root.ValueKind != JsonValueKind.Object || root.EnumerateObject().Any(property => !allowedFields.Contains(property.Name, StringComparer.Ordinal)))
throw new InvalidOperationException("unknown fixture mutation field");
await using var db = await factory.CreateDbContextAsync();
@@ -214,6 +214,16 @@ try
var maintenanceNode = await db.ClusterNodes.SingleAsync(x => x.NodeId == maintenanceNodeId);
maintenanceNode.MaintenanceMode = maintenance.GetProperty("enabled").GetBoolean();
}
if (root.TryGetProperty("scripted_predicate", out var scriptedPredicate))
{
// #937 live leg: replace the conditions profile's ScalarHigh predicate. Compile is not deploy-gated, so an
// uncompilable source deploys and fails the SOURCE engine's load (the engine then refuses operator commands).
var source = scriptedPredicate.GetString() is { Length: > 0 and <= 4096 } text ? text
: throw new InvalidOperationException("scripted predicate source required");
var script = await db.Scripts.SingleAsync(x => x.ScriptId == "source-scalar-high");
script.SourceCode = source;
script.SourceHash = Convert.ToHexString(System.Security.Cryptography.SHA256.HashData(System.Text.Encoding.UTF8.GetBytes(source)));
}
if (root.TryGetProperty("upsert_connection", out var newConnection))
{
var candidate = JsonSerializer.Deserialize<DataConnection>(newConnection.GetRawText()) ?? throw new InvalidOperationException();