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
@@ -54,7 +54,8 @@ public class FlatteningPipeline : IFlatteningPipeline
/// <inheritdoc />
public async Task<Result<FlatteningPipelineResult>> FlattenAndValidateAsync(
int instanceId,
CancellationToken cancellationToken = default)
CancellationToken cancellationToken = default,
bool validateScripts = true)
{
// Load instance with full graph
var instance = await _templateRepo.GetInstanceByIdAsync(instanceId, cancellationToken);
@@ -158,13 +159,19 @@ public class FlatteningPipeline : IFlatteningPipeline
// on the site — blocks the deployment. (The template DESIGN-TIME validate path in
// ManagementActor leaves this non-blocking by NOT enforcing, since bindings are
// set later at instance/deploy time.)
// validateScripts == false is the read-only staleness/comparison path: skip
// only the expensive Roslyn ValidateScriptCompilation (which loads a
// non-collectible InteractiveAssemblyLoader assembly per script). Structural
// and semantic validation still run so a genuinely broken flatten is surfaced;
// the deploy path (validateScripts: true) remains the authoritative compile gate.
var validation = _validationService.Validate(
config,
resolvedSharedScripts,
alarmCapableConnectionNames,
enforceConnectionBindings: true,
siteConnectionNames: siteConnectionNames,
resolveSchemaRef: resolveSchemaRef);
resolveSchemaRef: resolveSchemaRef,
validateScriptCompilation: validateScripts);
// Compute revision hash
var hash = _revisionHashService.ComputeHash(config);