perf(deployment): staleness/comparison paths no longer Roslyn-compile every script — deploy gate remains the authoritative compile

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
Joseph Doherty
2026-07-09 15:48:45 -04:00
parent 730bf19162
commit 854a6a8c0b
9 changed files with 226 additions and 15 deletions
@@ -95,6 +95,14 @@ public class ValidationService
/// <c>$ref</c> are unaffected (behavior unchanged), and a <c>$ref</c> with no
/// resolver is treated as dangling (the safe option).
/// </param>
/// <param name="validateScriptCompilation">
/// <c>true</c> (default) runs the authoritative Roslyn <see cref="ValidateScriptCompilation"/>
/// stage — the single most expensive check (a non-collectible assembly load per script).
/// <c>false</c> skips ONLY that stage; every other structural/semantic check still runs.
/// Read-only staleness/comparison callers (DeploymentManager's FlatteningPipeline on its
/// comparison/probe paths) pass <c>false</c> because they need only the flattened config and
/// revision hash, not a compile. The deploy gate keeps the default (<c>true</c>).
/// </param>
/// <returns>A merged <see cref="ValidationResult"/> aggregating all pipeline stage outcomes.</returns>
public ValidationResult Validate(
FlattenedConfiguration configuration,
@@ -102,7 +110,8 @@ public class ValidationService
IReadOnlySet<string>? alarmCapableConnectionNames = null,
bool enforceConnectionBindings = false,
IReadOnlySet<string>? siteConnectionNames = null,
Func<string, string?>? resolveSchemaRef = null)
Func<string, string?>? resolveSchemaRef = null,
bool validateScriptCompilation = true)
{
ArgumentNullException.ThrowIfNull(configuration);
@@ -110,7 +119,13 @@ public class ValidationService
{
ValidateFlatteningSuccess(configuration),
ValidateNamingCollisions(configuration),
ValidateScriptCompilation(configuration),
// The Roslyn compile is the single most expensive validation stage (a
// non-collectible InteractiveAssemblyLoader assembly load per script).
// Read-only staleness/comparison callers pass validateScriptCompilation:
// false to skip ONLY this stage; every other structural/semantic check
// still runs. The deploy gate keeps the default (true) — it is the
// authoritative compile.
validateScriptCompilation ? ValidateScriptCompilation(configuration) : ValidationResult.Success(),
ValidateAlarmTriggerReferences(configuration),
ValidateScriptTriggerReferences(configuration),
ValidateExpressionTriggers(configuration),