docs(components): accuracy fixes from deep review (batch 1)
Commons (third-party dep, 7 namespaces, retired ApiKey, repo SaveChanges carve-out), ConfigurationDatabase (5 persisted + 1 non-persisted computed col), ClusterInfrastructure (abbreviated HOCON note, RemotingPort default), Host (component matrix: CI/HealthMonitoring/ExternalSystemGateway have no actors; DeadLetterMonitorActor runs on both roles), Security (Bearer not X-API-Key; ApiKeyAdmin registered by Host), Communication (Task.Run/Sender).
This commit is contained in:
@@ -6,9 +6,9 @@ Commons is the foundational shared library that all other ScadaBridge components
|
||||
|
||||
Commons (#16) is not a runtime component. It has no actors, no hosted services, and no DI registrations of its own. Its single role is to hold the shared type vocabulary — entity shapes, interface contracts, and message definitions — so that every component agrees on the same types without depending on each other.
|
||||
|
||||
The project enforces minimal dependencies by design: only core .NET SDK. It must not reference Akka.NET, ASP.NET Core, Entity Framework Core, or any persistence or framework library, because it is referenced by all other projects and a framework dependency here becomes a transitive constraint on everything.
|
||||
The project enforces minimal dependencies by design: it references the `ZB.MOM.WW.Audit` package (for the canonical `AuditEvent` type) and the core .NET SDK. It must not reference Akka.NET, ASP.NET Core, Entity Framework Core, or any persistence or framework library, because it is referenced by all other projects and a framework dependency here becomes a transitive constraint on everything.
|
||||
|
||||
Source lives in `src/ZB.MOM.WW.ScadaBridge.Commons/`, organized into four top-level namespaces: `Types/`, `Interfaces/`, `Entities/`, and `Messages/`.
|
||||
Source lives in `src/ZB.MOM.WW.ScadaBridge.Commons/`, organized into seven top-level namespaces: `Types/`, `Interfaces/`, `Entities/`, `Messages/`, `Observability/`, `Serialization/`, and `Validators/`.
|
||||
|
||||
## Key Concepts
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Template
|
||||
|
||||
### Repository interfaces
|
||||
|
||||
Commons defines one repository interface per consuming component. Implementations live entirely in the Configuration Database component. Each interface accepts and returns the POCO entity classes from Commons, and every interface includes `SaveChangesAsync()` to support the unit-of-work pattern without requiring a dependency on EF Core.
|
||||
Commons defines one repository interface per consuming component. Implementations live entirely in the Configuration Database component. Each interface accepts and returns the POCO entity classes from Commons. Most repository interfaces expose `SaveChangesAsync()` to support the unit-of-work pattern without requiring a dependency on EF Core; the append-only audit repositories (`IAuditLogRepository`, `ISiteCallAuditRepository`) do not — they use upsert/insert-only operations that do not require an explicit save step.
|
||||
|
||||
### Message contracts and additive-only evolution
|
||||
|
||||
@@ -87,7 +87,7 @@ Namespaces mirror folders: `ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates`, `
|
||||
| `Entities/Sites/` | `Site`, `DataConnection` |
|
||||
| `Entities/ExternalSystems/` | `ExternalSystemDefinition`, `ExternalSystemMethod`, `DatabaseConnectionDefinition` |
|
||||
| `Entities/Notifications/` | `NotificationList`, `NotificationRecipient`, `SmtpConfiguration`, `Notification` |
|
||||
| `Entities/InboundApi/` | `ApiKey`, `ApiMethod` |
|
||||
| `Entities/InboundApi/` | `ApiMethod` |
|
||||
| `Entities/Security/` | `LdapGroupMapping`, `SiteScopeRule` |
|
||||
| `Entities/Deployment/` | `DeploymentRecord`, `SystemArtifactDeploymentRecord`, `DeployedConfigSnapshot` |
|
||||
| `Entities/Scripts/` | `SharedScript` |
|
||||
@@ -182,7 +182,7 @@ public interface IAuditLogRepository
|
||||
| `IDatabaseGateway` | Script-facing ADO.NET database access via named connections. | External System Gateway |
|
||||
| `IExternalSystemClient` | Script-facing `ExternalSystem.Call()` / `CachedCall()` invocation. | External System Gateway |
|
||||
| `IInstanceLocator` | Resolves instance unique name to site identifier for `Route.To()`. | Management Service |
|
||||
| `INotificationDeliveryService` | Script-facing `Notify.Send()` routing with S&F fallback. | Notification Service |
|
||||
| `IAuditActorAccessor` | Resolves the authenticated principal's actor string for audit rows (inbound API middleware). | Security & Auth |
|
||||
|
||||
Transport bundle interfaces (`IBundleExporter`, `IBundleImporter`, `IBundleSessionStore`, `IAuditCorrelationContext`) live in `Interfaces/Transport/` and are defined in Commons so the Configuration Database and Central UI can depend on the abstraction without taking a Transport component dependency.
|
||||
|
||||
@@ -279,7 +279,15 @@ public record AlarmStateChanged(
|
||||
{
|
||||
public AlarmLevel Level { get; init; } = AlarmLevel.None;
|
||||
public AlarmKind Kind { get; init; } = AlarmKind.Computed;
|
||||
public AlarmConditionState Condition { get; init; } = ...; // defaults to computed projection
|
||||
// Condition uses a private backing field so the getter can return a
|
||||
// computed default (AlarmConditionStateFactory.ForComputed(State, Priority))
|
||||
// when no explicit value has been set via the init accessor.
|
||||
private AlarmConditionState? _condition;
|
||||
public AlarmConditionState Condition
|
||||
{
|
||||
get => _condition ?? AlarmConditionStateFactory.ForComputed(State, Priority);
|
||||
init => _condition = value;
|
||||
}
|
||||
public string SourceReference { get; init; } = string.Empty;
|
||||
// ... additional native-alarm fields with empty defaults
|
||||
}
|
||||
@@ -299,7 +307,7 @@ When adding a new message contract: add an immutable `record` to the appropriate
|
||||
|
||||
## Dependencies & Interactions
|
||||
|
||||
- **No runtime dependencies** — Commons references only the core .NET SDK. It does not reference Akka.NET, ASP.NET Core, Entity Framework Core, or any third-party library.
|
||||
- **Minimal dependencies** — Commons references the core .NET SDK and the `ZB.MOM.WW.Audit` package (for the canonical `AuditEvent` type). It does not reference Akka.NET, ASP.NET Core, Entity Framework Core, or any other third-party library.
|
||||
- [Configuration Database (#17)](./ConfigurationDatabase.md) — implements every repository interface defined here (`ITemplateEngineRepository`, `IAuditLogRepository`, etc.) via EF Core Fluent API; maps the POCO entity classes to the underlying MS SQL schema.
|
||||
- **All other components** — reference Commons for shared types, entity classes, interface contracts, and message definitions. The dependency graph is strictly one-way: Commons knows nothing about its consumers.
|
||||
- [Audit Log (#23)](./AuditLog.md) — implements `IAuditWriter`, `ICentralAuditWriter`, `ISiteAuditQueue`, `ICachedCallLifecycleObserver`, and `ICachedCallTelemetryForwarder`; consumes `ScadaBridgeAuditEventFactory`, `AuditDetailsCodec`, `AuditRowProjection`, and the audit message contracts defined here.
|
||||
|
||||
Reference in New Issue
Block a user