feat(arena-colosseum): 2-pick + curated deck sources (phase 3)

Closes the family. arena-colosseum 10/16 → 15/16 zero stubs (the 16th —
finish_load — is dead per project_dead_battle_endpoints).

* 2-Pick draft lift onto ArenaColosseumController:
  - get_candidate_classes samples from ArenaTwoPickConfig.AllowedClassIds
    and persists the slate onto the run.
  - class_choose accepts class_id XOR chaos_id; both populate run.ClassId,
    chaos branch stores ChaosId for replay.
  - get_candidate_cards is the idempotent draft-resume snapshot.
  - card_choose appends both cards from the picked pair, advances turn 1..15.
  - Pool override: ArenaTwoPickCardPoolService gets a non-breaking
    GeneratePickSetsForTurn(..., poolCardSetIds) overload; Colosseum routes
    pass ColosseumSeasonConfig.PoolCardSetIds (falls back to challenge →
    rotation when empty).
* Curated-deck schema: ColosseumHofDeck / ColosseumWindFallDeck /
  ColosseumAvatarDeck — three identical tables (separate per per-pool
  operational lifecycle), unique on DeckNo. Migration AddColosseumCuratedDecks.
* IColosseumCuratedDeck interface + a generic ColosseumCuratedDeckImporterBase<T>
  with three concrete subclasses (HOF / WindFall / Avatar), registered in
  Bootstrap. Seed files ship empty.
* 6 curated endpoints on ArenaColosseumController: get_{hof|windfall|avatar}_deck_list
  return BARE-ARRAY data per spec; register_{hof|windfall|avatar}_deck share
  one generic RegisterCuratedAsync<T> dispatcher. Cross-pool register
  rejected via per-pool lookup. Curated register has no is_published flag
  (constructed-only) — clears the run's flag for state consistency.
* Tests: 5 draft HTTP tests + 11 curated-deck HTTP tests (4 parameterized
  3 ways across HOF/WindFall/Avatar + a cross-pool isolation test + an
  is_published clear test). Existing TwoPick service tests updated for the
  new pool overload. Full suite: 1347/1347.

Phase 3 ship gate met. Branch ready for merge.
This commit is contained in:
gamer147
2026-06-13 12:49:57 -04:00
parent cbee0f9a50
commit d126649ad4
25 changed files with 6152 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace SVSim.Database.Migrations
{
/// <inheritdoc />
public partial class AddColosseumCuratedDecks : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ColosseumAvatarDecks",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DeckNo = table.Column<int>(type: "integer", nullable: false),
ClassId = table.Column<int>(type: "integer", nullable: false),
CardListJson = table.Column<string>(type: "jsonb", nullable: false),
SleeveId = table.Column<long>(type: "bigint", nullable: false),
LeaderSkinId = table.Column<long>(type: "bigint", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ColosseumAvatarDecks", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ColosseumHofDecks",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DeckNo = table.Column<int>(type: "integer", nullable: false),
ClassId = table.Column<int>(type: "integer", nullable: false),
CardListJson = table.Column<string>(type: "jsonb", nullable: false),
SleeveId = table.Column<long>(type: "bigint", nullable: false),
LeaderSkinId = table.Column<long>(type: "bigint", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ColosseumHofDecks", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ColosseumWindFallDecks",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DeckNo = table.Column<int>(type: "integer", nullable: false),
ClassId = table.Column<int>(type: "integer", nullable: false),
CardListJson = table.Column<string>(type: "jsonb", nullable: false),
SleeveId = table.Column<long>(type: "bigint", nullable: false),
LeaderSkinId = table.Column<long>(type: "bigint", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ColosseumWindFallDecks", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_ColosseumAvatarDecks_DeckNo",
table: "ColosseumAvatarDecks",
column: "DeckNo",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ColosseumHofDecks_DeckNo",
table: "ColosseumHofDecks",
column: "DeckNo",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ColosseumWindFallDecks_DeckNo",
table: "ColosseumWindFallDecks",
column: "DeckNo",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ColosseumAvatarDecks");
migrationBuilder.DropTable(
name: "ColosseumHofDecks");
migrationBuilder.DropTable(
name: "ColosseumWindFallDecks");
}
}
}

View File

@@ -970,6 +970,41 @@ namespace SVSim.Database.Migrations
b.ToTable("ClassExpCurve");
});
modelBuilder.Entity("SVSim.Database.Models.ColosseumAvatarDeck", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("CardListJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("ClassId")
.HasColumnType("integer");
b.Property<int>("DeckNo")
.HasColumnType("integer");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<long>("LeaderSkinId")
.HasColumnType("bigint");
b.Property<long>("SleeveId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("DeckNo")
.IsUnique();
b.ToTable("ColosseumAvatarDecks");
});
modelBuilder.Entity("SVSim.Database.Models.ColosseumConfig", b =>
{
b.Property<int>("Id")
@@ -1041,6 +1076,76 @@ namespace SVSim.Database.Migrations
b.ToTable("Colosseums");
});
modelBuilder.Entity("SVSim.Database.Models.ColosseumHofDeck", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("CardListJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("ClassId")
.HasColumnType("integer");
b.Property<int>("DeckNo")
.HasColumnType("integer");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<long>("LeaderSkinId")
.HasColumnType("bigint");
b.Property<long>("SleeveId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("DeckNo")
.IsUnique();
b.ToTable("ColosseumHofDecks");
});
modelBuilder.Entity("SVSim.Database.Models.ColosseumWindFallDeck", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("CardListJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("ClassId")
.HasColumnType("integer");
b.Property<int>("DeckNo")
.HasColumnType("integer");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<long>("LeaderSkinId")
.HasColumnType("bigint");
b.Property<long>("SleeveId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("DeckNo")
.IsUnique();
b.ToTable("ColosseumWindFallDecks");
});
modelBuilder.Entity("SVSim.Database.Models.DailyLoginBonusEntry", b =>
{
b.Property<int>("Id")

View File

@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace SVSim.Database.Models;
/// <summary>
/// Curated Avatar (themed-character) deck for Arena Colosseum. See
/// <see cref="ColosseumHofDeck"/> for the rationale on the duplicated schema.
/// </summary>
public class ColosseumAvatarDeck : IColosseumCuratedDeck
{
public long Id { get; set; }
public int DeckNo { get; set; }
public int ClassId { get; set; }
[Column(TypeName = "jsonb")]
public string CardListJson { get; set; } = "[]";
public long SleeveId { get; set; }
public long LeaderSkinId { get; set; }
public int DisplayOrder { get; set; }
}

View File

@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace SVSim.Database.Models;
/// <summary>
/// Curated Hall-of-Fame deck pool for Arena Colosseum. Identical schema to
/// <see cref="ColosseumWindFallDeck"/> and <see cref="ColosseumAvatarDeck"/> — separate
/// tables instead of an enum-discriminated shared one because the operational lifecycle
/// (per-pool importer, per-pool register endpoint, per-pool query) is independent.
/// </summary>
public class ColosseumHofDeck : IColosseumCuratedDeck
{
public long Id { get; set; }
public int DeckNo { get; set; }
public int ClassId { get; set; }
[Column(TypeName = "jsonb")]
public string CardListJson { get; set; } = "[]";
public long SleeveId { get; set; }
public long LeaderSkinId { get; set; }
public int DisplayOrder { get; set; }
}

View File

@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace SVSim.Database.Models;
/// <summary>
/// Curated WindFall (limited-pool wildcard) deck for Arena Colosseum. See
/// <see cref="ColosseumHofDeck"/> for the rationale on the duplicated schema.
/// </summary>
public class ColosseumWindFallDeck : IColosseumCuratedDeck
{
public long Id { get; set; }
public int DeckNo { get; set; }
public int ClassId { get; set; }
[Column(TypeName = "jsonb")]
public string CardListJson { get; set; } = "[]";
public long SleeveId { get; set; }
public long LeaderSkinId { get; set; }
public int DisplayOrder { get; set; }
}

View File

@@ -0,0 +1,17 @@
namespace SVSim.Database.Models;
/// <summary>
/// Common shape across the three curated-deck pool tables — used by the controller's
/// generic list+register dispatcher (Phase 3 Task 10) to avoid duplicating identical code
/// per pool. The interface is plumbing only; the pools stay distinct EF entity types.
/// </summary>
public interface IColosseumCuratedDeck
{
long Id { get; set; }
int DeckNo { get; set; }
int ClassId { get; set; }
string CardListJson { get; set; }
long SleeveId { get; set; }
long LeaderSkinId { get; set; }
int DisplayOrder { get; set; }
}

View File

@@ -108,6 +108,9 @@ public class SVSimDbContext : DbContext
public DbSet<ArenaTwoPickReward> ArenaTwoPickRewards { get; set; } = null!;
public DbSet<ViewerArenaTwoPickRun> ViewerArenaTwoPickRuns { get; set; } = null!;
public DbSet<ViewerArenaColosseumRun> ViewerArenaColosseumRuns { get; set; } = null!;
public DbSet<ColosseumHofDeck> ColosseumHofDecks { get; set; } = null!;
public DbSet<ColosseumWindFallDeck> ColosseumWindFallDecks { get; set; } = null!;
public DbSet<ColosseumAvatarDeck> ColosseumAvatarDecks { get; set; } = null!;
public DbSet<SerialCodeEntry> SerialCodes => Set<SerialCodeEntry>();
public DbSet<SerialCodeRewardEntry> SerialCodeRewards => Set<SerialCodeRewardEntry>();
@@ -497,6 +500,12 @@ public class SVSimDbContext : DbContext
b.Property(e => e.OpponentRotationId).IsRequired();
});
// Colosseum curated-deck pools — DeckNo is the wire identifier admins reference in
// register endpoints; uniqueness per pool is the contract clients rely on.
modelBuilder.Entity<ColosseumHofDeck>().HasIndex(d => d.DeckNo).IsUnique();
modelBuilder.Entity<ColosseumWindFallDeck>().HasIndex(d => d.DeckNo).IsUnique();
modelBuilder.Entity<ColosseumAvatarDeck>().HasIndex(d => d.DeckNo).IsUnique();
base.OnModelCreating(modelBuilder);
}