refactor(executor): use action.ConfigSchema directly + dispose transient JsonDocuments

This commit is contained in:
Claude
2026-08-30 10:59:01 +00:00
parent 70f556aff5
commit 85e2339c1d

View File

@@ -254,7 +254,7 @@ public sealed class Executor
JsonElement coercedConfig;
try
{
coercedConfig = CoerceToSchema(templatedConfig, _nodes.Get(node.TypeId).ConfigSchema);
coercedConfig = CoerceToSchema(templatedConfig, action.ConfigSchema);
}
catch (Exception ex)
{
@@ -350,7 +350,8 @@ public sealed class Executor
}
w.WriteEndObject();
}
return JsonDocument.Parse(buffer.ToArray()).RootElement.Clone();
using var doc = JsonDocument.Parse(buffer.ToArray());
return doc.RootElement.Clone();
}
private static string? TypeOf(JsonElement schema)
@@ -374,7 +375,7 @@ public sealed class Executor
var buffer = new System.IO.MemoryStream();
using (var writer = new Utf8JsonWriter(buffer))
WriteInterpolated(source, input, writer);
var doc = JsonDocument.Parse(buffer.ToArray());
using var doc = JsonDocument.Parse(buffer.ToArray());
return doc.RootElement.Clone();
}