fix(templateengine): reject instance/script/alarm/slot names that are not valid actor names at save (review 2026-10-21 01/SR-C1)

This commit is contained in:
Joseph Doherty
2026-10-22 06:23:47 -04:00
parent 5919a71b8b
commit 7d11a1db8d
4 changed files with 149 additions and 0 deletions
@@ -4,6 +4,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
using ZB.MOM.WW.ScadaBridge.Commons.Types;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
using ZB.MOM.WW.ScadaBridge.Commons.Validation;
using ZB.MOM.WW.ScadaBridge.TemplateEngine;
namespace ZB.MOM.WW.ScadaBridge.TemplateEngine.Services;
@@ -59,6 +60,13 @@ public class InstanceService
if (string.IsNullOrWhiteSpace(uniqueName))
return Result<Instance>.Failure("Instance unique name is required.");
// The unique name becomes the site's Instance Actor name; a character Akka
// rejects would make ActorOf throw inside the Deployment Manager singleton on
// deploy (review 2026-10-21 01/SR-C1). Reject it here with a readable error.
var nameError = ActorNameRules.Describe(uniqueName);
if (nameError != null)
return Result<Instance>.Failure($"Invalid instance unique name: {nameError}");
// Verify template exists
var template = await _repository.GetTemplateByIdAsync(templateId, cancellationToken);
if (template == null)