fix(deploy): #1024 warm the script compile gate at AdminOperations start; deploy trigger gets a 45 s ask timeout

This commit is contained in:
Joseph Doherty
2026-12-03 14:54:51 -05:00
parent cc7155e5e9
commit 29c44d1f04
6 changed files with 127 additions and 13 deletions
@@ -256,6 +256,48 @@ public sealed class AdminOperationsActorScriptCompileGateTests : ControlPlaneAct
checker.Calls.First().ShouldContain(new DeployScriptCheckRequest(ScriptContextKind.VirtualTag, Legit));
}
/// <summary>#1024: with warm-on-start the checker is exercised the moment the singleton starts — before any deploy.</summary>
[Fact]
public void Warm_on_start_compiles_the_scripts_before_any_deploy_arrives()
{
var checker = new RecordingChecker();
Sys.ActorOf(AdminOperationsActor.Props(
SeedDraft(new Seed()), CreateTestProbe().Ref, Enumerable.Empty<IDriverProbe>(),
scriptChecker: checker, warmScriptGateOnStart: true));
AwaitAssert(() => checker.Calls.Count.ShouldBe(1), PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
checker.Calls.Single().ShouldContain(new DeployScriptCheckRequest(ScriptContextKind.VirtualTag, Legit));
checker.Calls.Single().ShouldContain(new DeployScriptCheckRequest(ScriptContextKind.AlarmPredicate, LegitPredicate));
}
/// <summary>#1024: warm-on-start is off by default and never runs with the gate Off.</summary>
[Fact]
public void Warm_on_start_is_not_run_when_the_gate_is_off_or_not_requested()
{
var checker = new RecordingChecker();
var db = SeedDraft(new Seed());
Sys.ActorOf(AdminOperationsActor.Props(db, CreateTestProbe().Ref, Enumerable.Empty<IDriverProbe>(), scriptChecker: checker));
Sys.ActorOf(AdminOperationsActor.Props(db, CreateTestProbe().Ref, Enumerable.Empty<IDriverProbe>(),
scriptChecker: checker, scriptCompileGateMode: ScriptCompileGateMode.Off, warmScriptGateOnStart: true));
Thread.Sleep(500);
checker.Calls.ShouldBeEmpty();
}
/// <summary>#1024: a throwing warm-up never takes the actor down — a deploy still works.</summary>
[Fact]
public void A_throwing_start_warm_up_does_not_break_the_next_deploy()
{
var dbFactory = SeedDraft(new Seed());
var coordinator = CreateTestProbe();
var checker = new RecordingChecker(@throw: true);
var actor = Sys.ActorOf(AdminOperationsActor.Props(
dbFactory, coordinator.Ref, Enumerable.Empty<IDriverProbe>(),
scriptChecker: checker, scriptCompileGateMode: ScriptCompileGateMode.Warn, warmScriptGateOnStart: true));
AwaitAssert(() => checker.Calls.Count.ShouldBeGreaterThanOrEqualTo(1), PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
actor.Tell(new StartDeployment("joe", CorrelationId.NewId()));
ExpectMsg<StartDeploymentResult>(PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
}
[Fact]
public async Task Collected_uses_resolve_equip_exactly_as_the_compose_seams_do()
{