Collapse ship settings surface state

This commit is contained in:
Meta Vens 2026-06-29 08:13:09 +01:00
commit 4dc2922d5a
2 changed files with 12 additions and 52 deletions

View file

@ -5130,9 +5130,9 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
"public readonly struct AetheriaRuntimeShipSettingsCommand",
"public static class AetheriaRuntimeShipSettingsSurfaceCommands",
"public static bool TryRead(",
"AetheriaRuntimeShipSettingsSurfaceState",
"public static AetheriaRuntimeSurfaceDocument Build(",
"private static AetheriaRuntimeShipSettingsSurfaceState ComposeState(",
"var formattedShutdownPerformance = formatShutdownPerformance == null",
"updatedAtUtc.ToString(\"O\", CultureInfo.InvariantCulture)",
"public static float ResolveShutdownPerformance(",
"public static float ClampShutdownPerformance("
};
@ -5147,10 +5147,12 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
}
if (shipSettingsSurfaceBuilder.Contains("public static AetheriaRuntimeShipSettingsSurfaceState Compose(", StringComparison.Ordinal) ||
shipSettingsSurfaceBuilder.Contains("public static AetheriaRuntimeShipSettingsSurfaceState Project(", StringComparison.Ordinal))
shipSettingsSurfaceBuilder.Contains("public static AetheriaRuntimeShipSettingsSurfaceState Project(", StringComparison.Ordinal) ||
shipSettingsSurfaceBuilder.Contains("AetheriaRuntimeShipSettingsSurfaceState", StringComparison.Ordinal) ||
shipSettingsSurfaceBuilder.Contains("ComposeState(", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"Runtime ship settings composition must stay behind Build(...); do not re-expose Compose/Project as the public ship settings surface path.");
"Runtime ship settings composition must emit the typed surface document directly; do not rebuild a shadow SurfaceState projection layer.");
}
}

View file

@ -6,23 +6,6 @@ using GameCult.Eve.Surface;
namespace GameCult.Aetheria.State.Verse
{
public sealed class AetheriaRuntimeShipSettingsSurfaceState
{
public AetheriaRuntimeShipSettingsSurfaceState(
string shipName,
string shutdownPerformance,
string updatedAtUtc)
{
ShipName = shipName ?? "";
ShutdownPerformance = shutdownPerformance ?? "";
UpdatedAtUtc = updatedAtUtc ?? "";
}
public string ShipName { get; }
public string ShutdownPerformance { get; }
public string UpdatedAtUtc { get; }
}
public static class AetheriaRuntimeShipSettingsSurfaceBuilder
{
public const string SurfaceId = "aetheria.inventory.current_ship_settings";
@ -37,45 +20,20 @@ namespace GameCult.Aetheria.State.Verse
Func<float, string> formatShutdownPerformance,
DateTime updatedAtUtc = default(DateTime),
long version = 1)
{
return Build(
ComposeState(
shipName,
shutdownPerformance,
formatShutdownPerformance,
updatedAtUtc),
version);
}
private static AetheriaRuntimeShipSettingsSurfaceState ComposeState(
string shipName,
float shutdownPerformance,
Func<float, string> formatShutdownPerformance,
DateTime updatedAtUtc = default(DateTime))
{
if (updatedAtUtc == default(DateTime))
updatedAtUtc = DateTime.UtcNow;
return new AetheriaRuntimeShipSettingsSurfaceState(
shipName,
formatShutdownPerformance == null
? shutdownPerformance.ToString("0.###", CultureInfo.InvariantCulture)
: formatShutdownPerformance(shutdownPerformance),
updatedAtUtc.ToString("O", CultureInfo.InvariantCulture));
}
public static AetheriaRuntimeSurfaceDocument Build(
AetheriaRuntimeShipSettingsSurfaceState state,
long version = 1)
{
state ??= new AetheriaRuntimeShipSettingsSurfaceState("", "", "");
var formattedShutdownPerformance = formatShutdownPerformance == null
? shutdownPerformance.ToString("0.###", CultureInfo.InvariantCulture)
: formatShutdownPerformance(shutdownPerformance);
return new AetheriaRuntimeSurfaceDocument(
providerId: "aetheria",
providerKind: "inventory.menu",
title: "Current Ship Settings",
version: version,
updatedAtUtc: state.UpdatedAtUtc,
updatedAtUtc: updatedAtUtc.ToString("O", CultureInfo.InvariantCulture),
surface: new AetheriaRuntimeSurfaceTree(
SurfaceId,
Node(
@ -84,11 +42,11 @@ namespace GameCult.Aetheria.State.Verse
Array.Empty<(string Key, string Value)>(),
Card(
$"{SurfaceId}.card",
state.ShipName,
shipName,
Metric(
$"{SurfaceId}.shutdown.metric",
"Shutdown Threshold",
state.ShutdownPerformance),
formattedShutdownPerformance),
Text(
$"{SurfaceId}.note",
"The observing client supplies selected ship state; shutdown changes are sent as daemon operations."),