fix(management): compile an API method once per save — CompileForPublish replaces the validate pre-pass (review 2026-10-21 05/M1)
This commit is contained in:
@@ -3667,12 +3667,16 @@ public class ManagementActor : ReceiveActor
|
||||
var executor = sp.GetService<InboundAPI.InboundScriptExecutor>();
|
||||
if (executor is null)
|
||||
return null;
|
||||
var compiled = executor.ValidateCompilation(method, out var errors);
|
||||
// ONE compile (review 2026-10-21 05/M1): each compile pins a non-collectible script
|
||||
// assembly, so the diagnostics for the warning and the handler registration come
|
||||
// from the same compile. Registration still waits for the commit when the command
|
||||
// runs inside a configuration transaction.
|
||||
var compiled = executor.CompileForPublish(method, out var errors, out var publish);
|
||||
var actions = sp.GetService<IConfigurationCommitActions>();
|
||||
if (actions is not null)
|
||||
actions.Add(() => { executor.CompileAndRegister(method); return Task.CompletedTask; });
|
||||
actions.Add(() => { publish(); return Task.CompletedTask; });
|
||||
else
|
||||
executor.CompileAndRegister(method);
|
||||
publish();
|
||||
if (compiled)
|
||||
return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user