fix(site-runtime): reject invalid runtime actor names at the site gate and never let ActorOf escalate to the Deployment Manager (review 2026-10-21 01/SR-C1)
An instance unique name Akka refuses as a path element (space, '#', '/', non-ASCII) made Context.ActorOf throw on the singleton's own thread; the default Restart stopped every Instance Actor on the site. DeployCompileValidator now checks the instance + script/alarm/native-source actor names with ActorPath.IsValidPathElement (the Commons ActorNameRules mirror is stricter than Akka for " ( ), pinned by a parity sweep), CreateInstanceActor catches InvalidActorNameException and every caller reports it, and the Instance Actor skips a refused child name like a compile failure.
This commit is contained in:
+39
@@ -104,4 +104,43 @@ public class DeployCompileValidatorTests
|
||||
var errors = NewValidator().Validate(cfg);
|
||||
Assert.Contains(errors, e => e.Contains("A1") && e.Contains("DoesNotExist"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Review 2026-10-21 01/SR-C1: names that become Akka actor names are checked by the gate,
|
||||
/// with Akka's own rule (so <c>Pump(A)</c>, which Akka accepts, is not rejected).
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData("a b", true)]
|
||||
[InlineData("Furnace #3", true)]
|
||||
[InlineData("Ofen Süd", true)]
|
||||
[InlineData("$Pump", true)]
|
||||
[InlineData("Pump(A)", false)]
|
||||
[InlineData("Line-1_A.B", false)]
|
||||
public void InstanceName_IsCheckedAsAnActorName(string instanceName, bool rejected)
|
||||
{
|
||||
var errors = NewValidator().Validate(ConfigWith("return 1;"), instanceName);
|
||||
Assert.Equal(rejected, errors.Any(DeployCompileValidator.IsActorNameError));
|
||||
if (rejected)
|
||||
Assert.Contains(errors, e => e.Contains(instanceName));
|
||||
}
|
||||
|
||||
/// <summary>Script, alarm and native-source canonical names are checked too.</summary>
|
||||
[Fact]
|
||||
public void ChildNames_AreCheckedAsActorNames()
|
||||
{
|
||||
var cfg = JsonSerializer.Serialize(new FlattenedConfiguration
|
||||
{
|
||||
Scripts = [new ResolvedScript { CanonicalName = "My Script", Code = "return 1;", TriggerType = "Call" }],
|
||||
Alarms = [new ResolvedAlarm { CanonicalName = "Hi/Temp", TriggerType = "ValueMatch" }],
|
||||
NativeAlarmSources = [new ResolvedNativeAlarmSource { CanonicalName = "Src#1", ConnectionName = "c" }],
|
||||
Attributes = []
|
||||
});
|
||||
|
||||
var nameErrors = NewValidator().Validate(cfg).Where(DeployCompileValidator.IsActorNameError).ToList();
|
||||
|
||||
Assert.Equal(3, nameErrors.Count);
|
||||
Assert.Contains(nameErrors, e => e.Contains("My Script"));
|
||||
Assert.Contains(nameErrors, e => e.Contains("Hi/Temp"));
|
||||
Assert.Contains(nameErrors, e => e.Contains("Src#1"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user