diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index d957c4ab5..595f9a40f 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -6090,12 +6090,10 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root) "public static class AetheriaRuntimeTradeInteractionSurfaceCommands", "public static bool TryReadFilter(", "public static bool TryReadRowAction(", - "AetheriaRuntimeTradeFilterSurfaceState", "AetheriaRuntimeTradeFilterOption", "AetheriaRuntimeTradeFilterSelectionKind", "AetheriaRuntimeTradeFilterSelection", "AetheriaRuntimeTradeFilterSurfaceModel", - "AetheriaRuntimeTradeRowActionSurfaceState", "AetheriaRuntimeTradeRowActionOption", "AetheriaRuntimeTradeRowActionSelection", "AetheriaRuntimeTradeRowActionSurfaceModel", @@ -6108,8 +6106,8 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root) "public bool TryResolve(string command, out AetheriaRuntimeTradeFilterSelection selection)", "public static AetheriaRuntimeTradeRowActionSurfaceModel BuildRowActions(", "public bool TryResolve(string command, out AetheriaRuntimeTradeRowActionSelection selection)", - "public static AetheriaRuntimeSurfaceDocument BuildFilter(", - "public static AetheriaRuntimeSurfaceDocument BuildRowActions(", + "private static AetheriaRuntimeSurfaceDocument BuildFilter(", + "private static AetheriaRuntimeSurfaceDocument BuildRowActions(", "providerKind: \"trade.menu\"", "The observing client lists available trade filters; the shared runtime surface owns the filter selector contract.", "The observing client lists available row actions; the shared runtime surface owns the row action contract." @@ -6124,13 +6122,17 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root) string.Join(", ", missingBuilderSymbols)); } - if (tradeInteractionSurfaceBuilder.Contains("public AetheriaRuntimeTradeFilterSurfaceState State { get; }", StringComparison.Ordinal) || + if (tradeInteractionSurfaceBuilder.Contains("AetheriaRuntimeTradeFilterSurfaceState", StringComparison.Ordinal) || + tradeInteractionSurfaceBuilder.Contains("AetheriaRuntimeTradeRowActionSurfaceState", StringComparison.Ordinal) || + tradeInteractionSurfaceBuilder.Contains("public AetheriaRuntimeTradeFilterSurfaceState State { get; }", StringComparison.Ordinal) || tradeInteractionSurfaceBuilder.Contains("public AetheriaRuntimeTradeRowActionSurfaceState State { get; }", StringComparison.Ordinal) || + tradeInteractionSurfaceBuilder.Contains("public static AetheriaRuntimeSurfaceDocument BuildFilter(", StringComparison.Ordinal) || + tradeInteractionSurfaceBuilder.Contains("public static AetheriaRuntimeSurfaceDocument BuildRowActions(", StringComparison.Ordinal) || tradeInteractionSurfaceBuilder.Contains("public static AetheriaRuntimeTradeFilterSurfaceModel ComposeFilters(", StringComparison.Ordinal) || tradeInteractionSurfaceBuilder.Contains("public static AetheriaRuntimeTradeRowActionSurfaceModel ComposeRowActions(", StringComparison.Ordinal)) { throw new InvalidOperationException( - "Shared runtime trade interaction builder must return models with finished surface documents; do not re-expose Compose or public State handoffs."); + "Shared runtime trade interaction builder must return models with finished surface documents; do not rebuild shadow SurfaceState projection layers."); } } diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeInteractionSurfaceBuilder.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeInteractionSurfaceBuilder.cs index e2ddc3fea..92b4851d2 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeInteractionSurfaceBuilder.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeInteractionSurfaceBuilder.cs @@ -36,23 +36,6 @@ namespace GameCult.Aetheria.State.Verse public IReadOnlyList Options { get; } } - public sealed class AetheriaRuntimeTradeFilterSurfaceState - { - public AetheriaRuntimeTradeFilterSurfaceState( - string filterSummary, - IReadOnlyList groups, - string updatedAtUtc) - { - FilterSummary = filterSummary ?? ""; - Groups = groups ?? Array.Empty(); - UpdatedAtUtc = updatedAtUtc ?? ""; - } - - public string FilterSummary { get; } - public IReadOnlyList Groups { get; } - public string UpdatedAtUtc { get; } - } - public enum AetheriaRuntimeTradeFilterSelectionKind { Unknown = 0, @@ -104,11 +87,7 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeSurfaceDocument document, IReadOnlyDictionary selections) { - Document = document ?? AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter( - new AetheriaRuntimeTradeFilterSurfaceState( - "", - Array.Empty(), - "")); + Document = document ?? throw new ArgumentNullException(nameof(document)); Selections = selections ?? new Dictionary(StringComparer.Ordinal); } @@ -121,23 +100,6 @@ namespace GameCult.Aetheria.State.Verse } } - public sealed class AetheriaRuntimeTradeRowActionSurfaceState - { - public AetheriaRuntimeTradeRowActionSurfaceState( - string title, - IReadOnlyList actions, - string updatedAtUtc) - { - Title = title ?? ""; - Actions = actions ?? Array.Empty(); - UpdatedAtUtc = updatedAtUtc ?? ""; - } - - public string Title { get; } - public IReadOnlyList Actions { get; } - public string UpdatedAtUtc { get; } - } - public sealed class AetheriaRuntimeTradeRowActionOption { public AetheriaRuntimeTradeRowActionOption(int index, string label) @@ -168,11 +130,7 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeSurfaceDocument document, IReadOnlyDictionary selections) { - Document = document ?? AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions( - new AetheriaRuntimeTradeRowActionSurfaceState( - "", - Array.Empty(), - "")); + Document = document ?? throw new ArgumentNullException(nameof(document)); Selections = selections ?? new Dictionary(StringComparer.Ordinal); } @@ -272,12 +230,9 @@ namespace GameCult.Aetheria.State.Verse .Where(group => group.Options.Count > 0) .ToArray(); - var state = new AetheriaRuntimeTradeFilterSurfaceState( - filterSummary, - groups, - updatedAtUtc); - - return new AetheriaRuntimeTradeFilterSurfaceModel(BuildFilter(state), selections); + return new AetheriaRuntimeTradeFilterSurfaceModel( + BuildFilter(filterSummary, groups, updatedAtUtc), + selections); } public static AetheriaRuntimeTradeRowActionSurfaceModel BuildRowActions( @@ -304,22 +259,18 @@ namespace GameCult.Aetheria.State.Verse selections[command] = new AetheriaRuntimeTradeRowActionSelection(command, action.Index); } - var state = new AetheriaRuntimeTradeRowActionSurfaceState( - title, - options, - updatedAtUtc); - - return new AetheriaRuntimeTradeRowActionSurfaceModel(BuildRowActions(state), selections); + return new AetheriaRuntimeTradeRowActionSurfaceModel( + BuildRowActions(title, options, updatedAtUtc), + selections); } - public static AetheriaRuntimeSurfaceDocument BuildFilter( - AetheriaRuntimeTradeFilterSurfaceState state, + private static AetheriaRuntimeSurfaceDocument BuildFilter( + string filterSummary, + IReadOnlyList groups, + string updatedAtUtc, long version = 1) { - state ??= new AetheriaRuntimeTradeFilterSurfaceState( - "", - Array.Empty(), - ""); + groups ??= Array.Empty(); var children = new List { @@ -329,10 +280,10 @@ namespace GameCult.Aetheria.State.Verse Text( $"{FilterSurfaceId}.note", "The observing client lists available trade filters; the shared runtime surface owns the filter selector contract."), - Text($"{FilterSurfaceId}.active", state.FilterSummary)) + Text($"{FilterSurfaceId}.active", filterSummary)) }; - foreach (var group in state.Groups) + foreach (var group in groups) { if (group?.Options == null || group.Options.Count == 0) continue; @@ -356,7 +307,7 @@ namespace GameCult.Aetheria.State.Verse providerKind: "trade.menu", title: "Trade Filter Selector", version: version, - updatedAtUtc: state.UpdatedAtUtc, + updatedAtUtc: updatedAtUtc ?? "", surface: new AetheriaRuntimeSurfaceTree( FilterSurfaceId, Node( @@ -365,7 +316,7 @@ namespace GameCult.Aetheria.State.Verse Array.Empty<(string Key, string Value)>(), children.ToArray()), Array.Empty()), - commands: state.Groups + commands: groups .Where(group => group?.Options != null) .SelectMany(group => group.Options) .Select(option => new AetheriaRuntimeSurfaceCommandTemplate(option.Command, option.Label, AetheriaRuntimeSurfaceCommandTemplate.CultMeshTransport)) @@ -373,21 +324,20 @@ namespace GameCult.Aetheria.State.Verse .ToArray()); } - public static AetheriaRuntimeSurfaceDocument BuildRowActions( - AetheriaRuntimeTradeRowActionSurfaceState state, + private static AetheriaRuntimeSurfaceDocument BuildRowActions( + string title, + IReadOnlyList actions, + string updatedAtUtc, long version = 1) { - state ??= new AetheriaRuntimeTradeRowActionSurfaceState( - "", - Array.Empty(), - ""); + actions ??= Array.Empty(); return new AetheriaRuntimeSurfaceDocument( providerId: "aetheria", providerKind: "trade.menu", title: "Trade Row Actions", version: version, - updatedAtUtc: state.UpdatedAtUtc, + updatedAtUtc: updatedAtUtc ?? "", surface: new AetheriaRuntimeSurfaceTree( RowActionSurfaceId, Node( @@ -397,20 +347,20 @@ namespace GameCult.Aetheria.State.Verse Card( $"{RowActionSurfaceId}.card", "Trade Action", - Text($"{RowActionSurfaceId}.title", state.Title), + Text($"{RowActionSurfaceId}.title", title), Text( $"{RowActionSurfaceId}.note", "The observing client lists available row actions; the shared runtime surface owns the row action contract."), ButtonColumn( $"{RowActionSurfaceId}.options", - state.Actions + actions .Select(action => Button(action.Id, action.Label, action.Command)) .ToArray()), ButtonRow( $"{RowActionSurfaceId}.actions", Button($"{RowActionSurfaceId}.close", "Close", CloseRowAction)))), Array.Empty()), - commands: state.Actions + commands: actions .Select(action => new AetheriaRuntimeSurfaceCommandTemplate(action.Command, action.Label, AetheriaRuntimeSurfaceCommandTemplate.CultMeshTransport)) .Append(new AetheriaRuntimeSurfaceCommandTemplate(CloseRowAction, "Close", AetheriaRuntimeSurfaceCommandTemplate.CultMeshTransport)) .ToArray());