feat: host tls data service and route node and cluster connections

This commit is contained in:
Joseph Doherty
2026-11-16 11:07:34 -05:00
parent af30a0266a
commit 47960a6d57
95 changed files with 9878 additions and 87 deletions
@@ -390,6 +390,24 @@ public sealed class AdminOperationsActor : ReceiveActor
private async Task<ComposeOutcome> ComposeDeploymentAsync(StartDeployment msg, string sourceNode)
{
await using var db = await _dbFactory.CreateDbContextAsync();
// The singleton update obtains a write lock BEFORE reading the draft. The revision and
// deployment row remain in this same transaction until the sealed artifact is committed.
await using var transaction = db.Database.IsRelational()
? await db.Database.BeginTransactionAsync(System.Data.IsolationLevel.Serializable)
: null;
DataConnectionScopeState scopeState;
if (transaction is not null)
{
var locked = await db.Database.ExecuteSqlRawAsync("UPDATE DataConnectionScopeState SET ScopeVersion = ScopeVersion WHERE Id = 1");
if (locked != 1) throw new InvalidOperationException("Authoritative data scope state is unavailable.");
scopeState = await db.DataConnectionScopeStates.SingleAsync(x => x.Id == 1);
}
else
{
// Nonrelational providers are used by isolated unit fixtures only.
scopeState = await db.DataConnectionScopeStates.SingleOrDefaultAsync(x => x.Id == 1) ?? new DataConnectionScopeState();
if (db.Entry(scopeState).State == EntityState.Detached) db.DataConnectionScopeStates.Add(scopeState);
}
// Full pre-seal gate: run the complete DraftValidator (one pass, all rules) and reject
// on ANY validation error. The config is now canonical — the company overlay loader emits
@@ -523,6 +541,10 @@ public sealed class AdminOperationsActor : ReceiveActor
// Composed from the validated snapshot, never from a second read: an edit that lands between
// validation and here is simply not in this artifact (R03:3.2).
var scope = DataConnectionScopeRevision.Advance(scopeState.ScopeVersion, scopeState.Fingerprint, draft.DataConnections);
scopeState.ScopeVersion = scope.Version;
scopeState.Fingerprint = scope.Fingerprint;
draft.DataConnectionScopeVersion = scope.Version;
var artifact = ConfigComposer.Compose(draft);
var deploymentId = DeploymentId.NewId();
var revHash = RevisionHash.Parse(artifact.RevisionHash);
@@ -547,6 +569,7 @@ public sealed class AdminOperationsActor : ReceiveActor
});
await db.SaveChangesAsync();
if (transaction is not null) await transaction.CommitAsync();
// Accepted message = the compile-cost advisory (if any) + any Warn-mode TagConfig warnings, so
// the operator sees the non-blocking strictness findings on a successful deploy.