Feat: game explorer, action log result capture, session purge

DB / Server:
- Added ResultJson (jsonb, nullable) to GameActionLog entity + EF migration
- Updated SaveStateAsync to accept resultJson (optional, default null)
- All 11 action handlers now serialize GameEngine.ToDto() result into the log

Admin — GameSessionsPage:
- Session IDs are now clickable links → /game/sessions/{id}
- "Abandon All Active" bulk button (previous)
- "Purge All" button (SuperAdmin only, JS confirm) — hard-deletes all sessions
  and action logs via cascade

Admin — GameSessionDetailPage (/game/sessions/{id}):
- Session header: status badge, P1/P2 display names (click to copy GUID)
- Info cards: Player 1, Player 2, Created timestamp, Duration/WinCondition
- Action log table: seq#, time, actor name (click to copy GUID), action type
- Expandable Payload (JSON) and Result (JSON) per row
- Actor display names resolved from SorIdentityDbContext

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-09 09:33:40 -04:00
co-authored by Claude Happy
parent 60697460cb
commit 4fa4c21b6e
18 changed files with 376 additions and 25 deletions
@@ -63,6 +63,7 @@ public sealed class GameDbContext : DbContext
e.ToTable("action_logs");
e.HasKey(a => a.Id);
e.Property(a => a.PayloadJson).HasColumnType("jsonb").HasColumnName("payload");
e.Property(a => a.ResultJson).HasColumnType("jsonb").HasColumnName("result");
e.HasIndex(a => new { a.GameSessionId, a.SequenceNumber }).IsUnique();
e.HasIndex(a => a.ActorAccountId);
});
@@ -22,6 +22,9 @@ public sealed class GameActionLog
/// <summary>JSONB: serialized action request payload.</summary>
public string? PayloadJson { get; set; }
/// <summary>JSONB: serialized server response / result state sent back to the actor.</summary>
public string? ResultJson { get; set; }
/// <summary>1-based sequence number within the game session.</summary>
public int SequenceNumber { get; set; }
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Game
{
/// <inheritdoc />
public partial class AddActionLogResult : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "result",
schema: "game",
table: "action_logs",
type: "jsonb",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "result",
schema: "game",
table: "action_logs");
}
}
}
@@ -105,6 +105,10 @@ namespace SOR.Database.Migrations.Game
.HasColumnType("jsonb")
.HasColumnName("payload");
b.Property<string>("ResultJson")
.HasColumnType("jsonb")
.HasColumnName("result");
b.Property<int>("SequenceNumber")
.HasColumnType("integer");