7.1 KiB
7.1 KiB
P07 read-only preparation — NOT implementation
P06 source and its final gate/review remain in progress. This note is a map, not approval or evidence of P07 implementation. Coordinator owns Program.cs and shared DI; settle packet interfaces before edits.
Existing boundaries
src/Server/ZB.MOM.WW.OtOpcUa.Host/Program.cs: pre-hostAddZbSecretsand SQLite migration at 118–129; role-gatedAddOtOpcUaLocalDbat 273–279;AddOtOpcUaSecretsat 629; oneAddGrpcinterceptor chain at 658–675; explicit Kestrel h2c takeover and existing-binding reconstruction at 679–783; auth middleware only on admin at 803–809; mesh maps at 817–822. Any added listener must join the binding reconstruction, preserve UI bindings, and check actual local port/host on each RPC: endpoint routing alone does not isolate listeners.Host/Configuration/MeshGrpcEndpoints.csmaps LocalDb sync, artifact/central command, telemetry/node command withAllowAnonymous; the interceptors are the fail-closed authentication boundary, and the explicit metadata bypasses admin cookie fallback. Data ingress needs its own equally explicit fail-closed auth plus listener admission; mesh services must also be barred from the data port. Disabled means unmapped. TLS HTTP/2 is dedicated; cleartext only explicit loopback development.Host/Configuration/SecretsRegistration.csselects local SQLite or opt-in pair replication and decoratesISecretCacheInvalidator.SecretChangeSignallingInvalidator.Invalidate(SecretName)calls the inner invalidator then optional Galaxy directory; compose any data change notification, do not replace either. Existing production write pattern inAdminUI/ApiKeyAck/ApiKeyGalaxyAckIdentityService.csuses_cipher.Encrypt(name, value, SecretContentType.Text) with { Description, CreatedBy, UpdatedBy },_store.UpsertAsync(row, ct), then_invalidator?.Invalidate(name). Mint target keys withIApiKeyAdminService.CreateAsync(string name, string principal, DateTime? expiresUtc, string? notes, CancellationToken ct); only the returned string contains the plaintext. Grant scoped exports separately.- Pinned
Directory.Packages.props: Secrets 0.6.2, Secrets.Abstractions 0.6.6, Secrets.Replicator.AkkaDotNet 0.6.2, Grpc.AspNetCore/Grpc.Net.Client 2.76.0, Google.Protobuf 3.34.1. Installed 0.6.2 and 0.6.6 packages contain DLL and README but no XML documentation; do not infer unverified library methods from older XML. Check the pinned package README and existing call sites for any additional operation. Runtime/DataConnections/LocalDataServices.csexposesIDataConnectionFactory.Create(DataAuthenticatedContext, DataTarget); its constructor accepts the catalog provider, hub, policy, capabilities, clock and optional caller write/subscription factories. Without a factory it does not advertise the corresponding operation.DataWriteRuntime.ForCaller(context, Func<IActorRef?>)is public, butLocalSubscriptionService,DriverHostSubscriptionDemandSource, itsSubscriptionAcquisitionCapacitydependency and session limits are internal. Add a narrow public Runtime composition seam that owns construction/lifetime; do not useInternalsVisibleTofor Host.LocalCatalogCoordinator(activation, authority, Func<ServingIdentity>)andSourceSamplePublisher(hub, Func<ServingIdentity?>, originClusterId)require the same actual boot NodeId/incarnation and current role provenance as the facade. Share authority/dispatch fence, clock and process acquisition owner with write and driver-host paths. Verify Host actor construction actually receives those instances; creating disconnected singletons is insufficient. Feature remains false until fully wired.
Packet and test-first boundaries
- Secret/trust lifecycle: Host
Configuration/DataConnectionSecretProvisioner.cs,DataConnectionCredentialResolver.cs,DataConnectionSecretChangeHandler.cs,DataConnectionTrustPolicy.csand their four manifest Host tests. Define a narrow local bundle reader, current consumer scope/reference allowlist provider, durable monotonic version/tombstone store and credential/channel retirement notifications. On removal deny and drain before deleting an unshared reference; persist tombstones and current allowlist so an old mounted bundle cannot resurrect it after offline DB-less restart. Validate expected owner cluster and actual consumer NodeId per bundle, encrypt into localISecretStore, never publish bearer in central deployment artifacts or offer an upload endpoint. Atomic replacement, encryption/store failure and partial updates must fail closed. Credential and independent trust versions retire matching channels/streams; retain dispatched write outcome observers without replay. Exercise existing Galaxy invalidation. Test two independently provisioned replicas and independent pairs, downgrade/wrong-scope/missing-secret, deletion and offline restart, and trust old/new/removal. - Remote client: Runtime
GrpcDataConnection.cs,DataConnectionManager.cs,ClusterEndpointSelector.cs,DataConnectionRoleAdapter.csand manifestGrpcDataConnectionClientTests,GrpcDataEndpointSelectionTests,GrpcDataConsumerScopeTests. Identity of a bounded cached channel includes endpoint, credential version and trust fingerprint. Node selection remains pinned; cluster selection authenticates capabilities and selects ready Primary, with unknown role/no primary unready and bounded backoff. Retry read/query within original causal budget; retry writes only individually typedRejectedBeforeDispatch, never unknown or a lost reply. Scope changes drain handles; stream epochs renew after channel/role changes. Construct realm roots from validated capability cluster identity. Confirm mapper and generated proto fields, version 1.1, age/readiness and decode/transport bounds before coding; no assumed field names. - Coordinator-owned ingress and composition:
Host/Grpc/DataConnectionGrpcService.cs,Configuration/DataConnectionOptions.cs,DataConnectionOptionsValidator.cs,DataConnectionAuthInterceptor.cs,DataConnectionEndpoints.cs, plus Program/shared DI and Runtime public composition seam. ManifestGrpcDataListenerTests,GrpcDataIngressAuthTests,GrpcDataServiceDispatchTestsshould prove disabled mapping, listener and method admission, cookie behavior, key/pepper/authority failures, partial batches, final per-response publication gates and bounded parsing. Stream delivery must await realWriteAsyncsuccess before acknowledging baseline; expiry/revocation closes quiet streams. Separate unary and stream timeout policies, disable automatic write retries/hedges. Integration wire tests are P10, including real TLS/cert rotation and actual caller DI for the public NodeProbe fixture; no production network-control hook.
Manifest H regressions: DriverWriteBoundsBindingTests, ApiKeyStoreRegistrationTests, ApiKeyAuthenticationTests, SecretsPreHostContentRootSourceTests; R role regressions WarmRoleAuthorityTests and PrimaryGatePolicyTests if role adapter changes. P10 also runs MeshGrpcAnonymousMetadataTests, MeshGrpcAuthStackTests, MeshGrpcBoundaryTests and the new TLS/listener wire tests. P06 focused tests and current review remain separate gates.