feat(commons/transport): ScriptArtifactsChanged invalidation contract + post-commit publish from bundle import (consumer lands in plan 06)

New Commons seam: ScriptArtifactsChanged record + ScriptArtifactKinds + the
IScriptArtifactChangeBus pub/sub interface. Host ships InProcessScriptArtifactChangeBus
(lock-free copy-on-write, swallow-and-log per subscriber) registered as a central-role
singleton. BundleImporter gains an optional IScriptArtifactChangeBus? and, AFTER
tx.CommitAsync, publishes one notification per script-bearing kind (ApiMethod/
SharedScript/Template) whose resolution was Overwrite/Rename, using post-resolution
names — fully guarded so a bad subscriber can't fail a committed import. Contract +
plan-06 handoff table documented. No consumer yet (additive; publisher is correct).

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
Joseph Doherty
2026-07-09 17:27:40 -04:00
parent 38edfefc42
commit 2c839def33
8 changed files with 527 additions and 0 deletions
@@ -0,0 +1,27 @@
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Scripting;
namespace ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Scripting;
/// <summary>
/// In-process, per-node publish/subscribe seam for
/// <see cref="ScriptArtifactsChanged"/>. Producers (e.g. the Transport bundle
/// importer, the ManagementActor script-editing paths) publish AFTER their mutating
/// transaction commits; consumers (e.g. the Inbound API compiled-handler cache)
/// subscribe and evict.
/// <para>
/// A conforming implementation MUST swallow-and-log any exception thrown by a
/// subscriber's handler — a misbehaving consumer must never fault a producer's
/// commit path.
/// </para>
/// </summary>
public interface IScriptArtifactChangeBus
{
/// <summary>Publishes a change notification to every current subscriber. Never throws on a subscriber fault.</summary>
/// <param name="notification">The change notification to deliver.</param>
void Publish(ScriptArtifactsChanged notification);
/// <summary>Subscribes a handler; dispose the returned token to unsubscribe.</summary>
/// <param name="handler">The handler invoked for each published notification.</param>
/// <returns>A disposable that removes the subscription when disposed.</returns>
IDisposable Subscribe(Action<ScriptArtifactsChanged> handler);
}