Reject RTS-branded daemon transport flag
This commit is contained in:
parent
62f9bccfc1
commit
b13bf72466
4 changed files with 53 additions and 21 deletions
|
|
@ -728,10 +728,10 @@ internal sealed class AuthoritySmokeChecks
|
|||
{
|
||||
var smokeId = Guid.NewGuid().ToString("N");
|
||||
var statePath = Path.Combine(Path.GetTempPath(), $"aetheria-starbridge-daemon-{smokeId}.cc");
|
||||
var rtsPort = GetFreeUdpPort();
|
||||
var clientCultMeshPort = GetFreeUdpPort();
|
||||
const string runtimeId = "starbridge-daemon-smoke";
|
||||
|
||||
await RunDaemonOnceAsync(statePath, runtimeId, rtsPort).ConfigureAwait(false);
|
||||
await RunDaemonOnceAsync(statePath, runtimeId, clientCultMeshPort).ConfigureAwait(false);
|
||||
|
||||
using var client = await AetheriaClient
|
||||
.OpenAsync(statePath, "starbridge-smoke-client", sessionId: "authority-smoke", pullOnOpen: true)
|
||||
|
|
@ -801,7 +801,7 @@ internal sealed class AuthoritySmokeChecks
|
|||
"raven-local",
|
||||
policy,
|
||||
[ravenByRaven, hostileByRaven]).ConfigureAwait(false);
|
||||
await RunDaemonOnceAsync(ravenStatePath, "raven-local", rtsPort: 41076).ConfigureAwait(false);
|
||||
await RunDaemonOnceAsync(ravenStatePath, "raven-local", clientCultMeshPort: 41076).ConfigureAwait(false);
|
||||
var ravenFrame = await ReadPublishedFrameAsync(ravenStatePath, "raven-local").ConfigureAwait(false);
|
||||
|
||||
Require(ravenFrame.AppliedCommandIds.Contains(ravenByRaven.CommandId), "raven daemon should apply Raven-authored Raven movement");
|
||||
|
|
@ -817,7 +817,7 @@ internal sealed class AuthoritySmokeChecks
|
|||
"starfire-local",
|
||||
policy,
|
||||
[ravenByStarfire, hostileByStarfire]).ConfigureAwait(false);
|
||||
await RunDaemonOnceAsync(starfireStatePath, "starfire-local", rtsPort: 41077).ConfigureAwait(false);
|
||||
await RunDaemonOnceAsync(starfireStatePath, "starfire-local", clientCultMeshPort: 41077).ConfigureAwait(false);
|
||||
var starfireFrame = await ReadPublishedFrameAsync(starfireStatePath, "starfire-local").ConfigureAwait(false);
|
||||
|
||||
Require(starfireFrame.RejectedCommandIds.Contains(ravenByStarfire.CommandId), "starfire daemon should reject Starfire-authored Raven movement");
|
||||
|
|
@ -1137,25 +1137,25 @@ internal sealed class AuthoritySmokeChecks
|
|||
private static async Task RunDaemonOnceAsync(
|
||||
string statePath,
|
||||
string runtimeId,
|
||||
int rtsPort)
|
||||
int clientCultMeshPort)
|
||||
{
|
||||
using var process = StartDaemonProcess(statePath, runtimeId, rtsPort, once: true);
|
||||
using var process = StartDaemonProcess(statePath, runtimeId, clientCultMeshPort, once: true);
|
||||
await WaitForProcessSuccessAsync(process, runtimeId, TimeSpan.FromSeconds(90)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static Process StartDaemonProcess(
|
||||
string statePath,
|
||||
string runtimeId,
|
||||
int rtsPort,
|
||||
int clientCultMeshPort,
|
||||
bool once)
|
||||
{
|
||||
return StartDaemonProcess(statePath, runtimeId, rtsPort, once, peerEndpoints: null);
|
||||
return StartDaemonProcess(statePath, runtimeId, clientCultMeshPort, once, peerEndpoints: null);
|
||||
}
|
||||
|
||||
private static Process StartDaemonProcess(
|
||||
string statePath,
|
||||
string runtimeId,
|
||||
int rtsPort,
|
||||
int clientCultMeshPort,
|
||||
bool once,
|
||||
IReadOnlyList<string>? peerEndpoints)
|
||||
{
|
||||
|
|
@ -1195,8 +1195,8 @@ internal sealed class AuthoritySmokeChecks
|
|||
"aetheria.coop-smoke",
|
||||
"--session-id",
|
||||
"authority-smoke",
|
||||
"--rts-cultmesh-port",
|
||||
rtsPort.ToString(),
|
||||
"--client-cultmesh-port",
|
||||
clientCultMeshPort.ToString(),
|
||||
"--api-publication-interval-ms",
|
||||
"50",
|
||||
string.Join(" ", (peerEndpoints ?? Array.Empty<string>())
|
||||
|
|
|
|||
|
|
@ -2421,6 +2421,7 @@ internal sealed class AetheriaDaemonHostOptions
|
|||
var clientCultMeshAdvertiseHost = ReadOption(args, "--client-cultmesh-advertise-host");
|
||||
var clientCultMeshPort = ReadNonNegativeInt(args, "--client-cultmesh-port") ?? 3076;
|
||||
var aetheriaResourcesRoot = ReadOption(args, "--aetheria-resources-root");
|
||||
RejectRemovedOption(args, "--rts-cultmesh-port", "--client-cultmesh-port");
|
||||
RejectRemovedOption(args, "--peer-cultmesh-endpoint", "Odin-discovered CultMesh peer documents");
|
||||
RejectRemovedOption(args, "--odin-cultmesh-rudp", "--odin-cultmesh-uri");
|
||||
RejectRemovedOption(args, "--odin-cultnet-rudp", "--odin-cultmesh-uri");
|
||||
|
|
|
|||
|
|
@ -87,27 +87,30 @@ static async Task ExportFixtureSetAsync(
|
|||
.OpenAsync(statePath, runtimeId: "aetheria-freeze", startServer: false)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var frame = await node.LatestFrame().ReadAsync().ConfigureAwait(false);
|
||||
var frame = await node.MutableDocument<AetheriaRuntimeDaemonFrameDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest)
|
||||
.ReadAsync()
|
||||
.ConfigureAwait(false);
|
||||
if (frame == null)
|
||||
throw new InvalidOperationException("Freeze export cannot continue because the daemon latest frame is missing.");
|
||||
WriteArtifact(outputDirectory, manifest, "daemon-frame.latest", AetheriaRuntimeDaemonSchemas.Frame, frame);
|
||||
|
||||
if (await TryReadAsync<AetheriaRuntimeDaemonHealthDocument>(() => node.Health().ReadAsync()).ConfigureAwait(false) is { } health)
|
||||
if (await TryReadDocumentAsync<AetheriaRuntimeDaemonHealthDocument>(node, AetheriaRuntimeVerseRecordKeys.DaemonHealth).ConfigureAwait(false) is { } health)
|
||||
WriteArtifact(outputDirectory, manifest, "daemon-health.latest", AetheriaRuntimeDaemonSchemas.Health, health);
|
||||
|
||||
if (await TryReadAsync<AetheriaRuntimeDaemonProviderAdvertisementDocument>(() => node.ProviderAdvertisement().ReadAsync()).ConfigureAwait(false) is { } provider)
|
||||
if (await TryReadDocumentAsync<AetheriaRuntimeDaemonProviderAdvertisementDocument>(node, AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement).ConfigureAwait(false) is { } provider)
|
||||
WriteArtifact(outputDirectory, manifest, "daemon-provider.latest", AetheriaRuntimeDaemonSchemas.ProviderAdvertisement, provider);
|
||||
|
||||
if (await TryReadAsync<AetheriaRuntimeDaemonCommandBoundaryDocument>(() => node.CommandBoundary().ReadAsync()).ConfigureAwait(false) is { } commandBoundary)
|
||||
if (await TryReadDocumentAsync<AetheriaRuntimeDaemonCommandBoundaryDocument>(node, AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary).ConfigureAwait(false) is { } commandBoundary)
|
||||
WriteArtifact(outputDirectory, manifest, "daemon-command-boundary.latest", AetheriaRuntimeDaemonSchemas.CommandBoundary, commandBoundary);
|
||||
|
||||
if (await TryReadAsync<AetheriaRuntimeVerseAuthorityPolicyDocument>(() => node.VerseAuthorityPolicy().ReadAsync()).ConfigureAwait(false) is { } authorityPolicy)
|
||||
if (await TryReadDocumentAsync<AetheriaRuntimeVerseAuthorityPolicyDocument>(node, AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy).ConfigureAwait(false) is { } authorityPolicy)
|
||||
WriteArtifact(outputDirectory, manifest, "verse-authority-policy.latest", AetheriaRuntimeVerseAuthoritySchemas.Policy, authorityPolicy);
|
||||
|
||||
if (await TryReadAsync<AetheriaRuntimeStarbridgeSessionSummaryDocument>(() => node.StarbridgeSessionSummary().ReadAsync()).ConfigureAwait(false) is { } starbridgeSummary)
|
||||
if (await TryReadDocumentAsync<AetheriaRuntimeStarbridgeSessionSummaryDocument>(node, AetheriaRuntimeVerseRecordKeys.StarbridgeSessionSummary).ConfigureAwait(false) is { } starbridgeSummary)
|
||||
WriteArtifact(outputDirectory, manifest, "starbridge-session-summary.latest", AetheriaRuntimeDaemonSchemas.StarbridgeSessionSummary, starbridgeSummary);
|
||||
|
||||
if (await TryReadAsync<AetheriaRuntimeDaemonSoaViewDocument>(() => node.LatestSoaView().ReadAsync()).ConfigureAwait(false) is { } soaView)
|
||||
if (await TryReadDocumentAsync<AetheriaRuntimeDaemonSoaViewDocument>(node, AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest).ConfigureAwait(false) is { } soaView)
|
||||
WriteArtifact(outputDirectory, manifest, "daemon-soa-view.latest", AetheriaRuntimeDaemonSchemas.SoaView, soaView);
|
||||
|
||||
var viewport = new AetheriaRuntimeViewportBounds
|
||||
|
|
@ -117,7 +120,7 @@ static async Task ExportFixtureSetAsync(
|
|||
MaxX = options.ViewportMaxX,
|
||||
MaxY = options.ViewportMaxY
|
||||
};
|
||||
WriteArtifact(outputDirectory, manifest, "document.rts-viewport", AetheriaRuntimeDaemonSchemas.GameViewport, AetheriaRuntimeGameDocuments.Viewport(frame, viewport));
|
||||
WriteArtifact(outputDirectory, manifest, "document.game-viewport", AetheriaRuntimeDaemonSchemas.GameViewport, AetheriaRuntimeGameDocuments.Viewport(frame, viewport));
|
||||
WriteArtifact(outputDirectory, manifest, "document.objects-viewport", AetheriaRuntimeDaemonSchemas.ObjectsViewport, AetheriaRuntimeGameDocuments.ObjectsViewport(frame, viewport));
|
||||
WriteArtifact(outputDirectory, manifest, "document.gravity-viewport", AetheriaRuntimeDaemonSchemas.GravityViewport, AetheriaRuntimeGameDocuments.GravityViewport(frame, viewport));
|
||||
WriteArtifact(outputDirectory, manifest, "document.current-zone", AetheriaRuntimeDaemonSchemas.CurrentZone, AetheriaRuntimeGameDocuments.CurrentZone(frame));
|
||||
|
|
@ -148,6 +151,12 @@ static void ExportAuthorityDecisionFixtures(string outputDirectory)
|
|||
WriteJson(Path.Combine(outputDirectory, "manifest.json"), manifest);
|
||||
}
|
||||
|
||||
static Task<T?> TryReadDocumentAsync<T>(AetheriaStateNode node, GameCult.Caching.CultRecordKey recordKey)
|
||||
where T : class
|
||||
{
|
||||
return TryReadAsync(() => node.MutableDocument<T>(recordKey).ReadAsync());
|
||||
}
|
||||
|
||||
static async Task<T?> TryReadAsync<T>(Func<Task<T?>> read)
|
||||
where T : class
|
||||
{
|
||||
|
|
@ -210,7 +219,7 @@ static async Task RunDaemonOnceAsync(FreezeOptions options, string statePath, st
|
|||
$"aetheria-freeze-{scenario}",
|
||||
"--session-id",
|
||||
scenario,
|
||||
"--rts-cultmesh-port",
|
||||
"--client-cultmesh-port",
|
||||
"0"
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -16091,6 +16091,8 @@ static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
|
|||
"Runtime",
|
||||
"AetheriaRuntimeGameViewportDocuments.cs");
|
||||
var rtsLocalDocumentsPath = Path.Combine(root, "Aetheria.Rts.Web", "Electron", "aetheria-rts-local-documents.ts");
|
||||
var authoritySmokePath = Path.Combine(root, "Aetheria.State.AuthoritySmoke", "Program.cs");
|
||||
var freezePath = Path.Combine(root, "Aetheria.State.Freeze", "Program.cs");
|
||||
var snapshotDocuments = File.Exists(snapshotDocumentsPath)
|
||||
? File.ReadAllText(snapshotDocumentsPath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon projectile authority; runtime snapshot documents are missing.");
|
||||
|
|
@ -16112,6 +16114,12 @@ static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
|
|||
var rtsLocalDocuments = File.Exists(rtsLocalDocumentsPath)
|
||||
? File.ReadAllText(rtsLocalDocumentsPath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon projectile authority; Electron local projection is missing.");
|
||||
var authoritySmoke = File.Exists(authoritySmokePath)
|
||||
? File.ReadAllText(authoritySmokePath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon transport vocabulary; authority smoke harness is missing.");
|
||||
var freeze = File.Exists(freezePath)
|
||||
? File.ReadAllText(freezePath)
|
||||
: throw new InvalidOperationException("Cannot verify daemon transport vocabulary; freeze harness is missing.");
|
||||
|
||||
var requiredProjectileAuthoritySymbols = new Dictionary<string, string[]>
|
||||
{
|
||||
|
|
@ -16211,7 +16219,9 @@ static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
|
|||
}
|
||||
|
||||
if (daemonProgram.Contains("RtsCultMesh", StringComparison.Ordinal) ||
|
||||
daemonProgram.Contains("--rts-cultmesh", StringComparison.Ordinal) ||
|
||||
daemonProgram.Contains("ReadOption(args, \"--rts-cultmesh", StringComparison.Ordinal) ||
|
||||
daemonProgram.Contains("ReadNonNegativeInt(args, \"--rts-cultmesh", StringComparison.Ordinal) ||
|
||||
daemonProgram.Contains("ReadPositiveInt(args, \"--rts-cultmesh", StringComparison.Ordinal) ||
|
||||
daemonProgram.Contains("RTS CultMesh endpoint", StringComparison.Ordinal) ||
|
||||
daemonProgram.Contains("aetheria-rts-rudp", StringComparison.Ordinal) ||
|
||||
daemonProgram.Contains("daemon:aetheria.rts.viewport", StringComparison.Ordinal) ||
|
||||
|
|
@ -16221,6 +16231,18 @@ static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
|
|||
throw new InvalidOperationException(
|
||||
"Aetheria daemon transport must be client-neutral; runtime-branded CultMesh flags and transport ids belong outside daemon authority.");
|
||||
}
|
||||
if (!daemonProgram.Contains("RejectRemovedOption(args, \"--rts-cultmesh-port\", \"--client-cultmesh-port\")", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Aetheria daemon must explicitly reject the removed RTS-branded CultMesh port flag and point callers at the client-neutral flag.");
|
||||
}
|
||||
if (authoritySmoke.Contains("--rts-cultmesh-port", StringComparison.Ordinal) ||
|
||||
authoritySmoke.Contains("rtsPort", StringComparison.Ordinal) ||
|
||||
freeze.Contains("--rts-cultmesh-port", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Aetheria daemon smoke/freeze callers must use the client-neutral CultMesh endpoint flag instead of preserving RTS-branded transport vocabulary.");
|
||||
}
|
||||
|
||||
var sharedRuntimeText = string.Join(
|
||||
"\n",
|
||||
|
|
|
|||
Loading…
Reference in a new issue