fix(transport): drop the external-definition lookup cache after a committed bundle import (ScadaBridge#83)

The bundle importer writes external systems, methods and database connections
through the raw DbContext, bypassing the ManagementActor handlers that
invalidate ExternalDefinitionLookupCache (#65), so the importing node served
pre-import definitions for up to DefinitionCacheTtl. New Commons seam
IExternalDefinitionCacheInvalidator, implemented by the cache and registered as
the same singleton; BundleImporter takes it optionally and invalidates once
after every committed import (never on rollback; never throws).

Peer-central-node invalidation (the other half of #83) is NOT done here: the
issue leaves open whether the 10 s TTL bound is acceptable for the peer.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 12:40:43 -05:00
parent 6d5bb6189f
commit 03de3dcc14
6 changed files with 132 additions and 2 deletions
@@ -0,0 +1,15 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
/// <summary>
/// Drops the node-local cache of external-system / method / database-connection definitions
/// (<c>ExternalSystemGateway.ExternalDefinitionLookupCache</c>) after a committed write to
/// those definitions, so the editing node serves the new definition immediately instead of
/// after the cache TTL. Lives in Commons so a writer that cannot reference the gateway (the
/// Transport bundle importer, Gitea #83) can still signal it. Scope is THIS node only — a
/// peer central node converges within the TTL.
/// </summary>
public interface IExternalDefinitionCacheInvalidator
{
/// <summary>Drops every cached definition on this node.</summary>
void InvalidateAll();
}