refactor(bootstrap): finalize seed migration; remove GlobalsImporter and prod-captures plumbing
Final cleanup of the bootstrap-seed refactor (Task 10 of 10): - Delete the GlobalsImporter no-op stub and its two remaining call sites (Program.cs and SVSimTestFactory.cs). All work has moved to per-domain importers since Task 9. - Drop the --captures CLI flag and CapturesDir / shippedCaptures plumbing from Program.cs (BootstrapOptions, ParseArgs, PrintUsage). Bootstrap input is now cards.json + reference CSVs + per-table seed JSON; no more prod-captures directory. - Shrink ImporterBase from 141 to 23 lines: LoadCapture, Serialize, Upsert<T,TKey>, GetInt/GetString/GetBool/GetLong/GetULong all had zero callers after the seed migration. Only ParseWireDateTime survives (still used by PaymentItemImporter and MyPageGlobalsImporter for prod-shaped timestamp strings). - Remove the prod-captures Content Include glob from SVSim.Bootstrap.csproj and both prod-captures globs (production + test-fixture overlay) from SVSim.UnitTests.csproj. Test fixtures now overlay production seeds at Data/seeds/ via the Task 7 layout exclusively. Build clean; 391/391 unit tests passing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -176,21 +176,19 @@ internal sealed class SVSimTestFactory : WebApplicationFactory<Program>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs <see cref="GlobalsImporter"/> against the test SQLite DB using the prod captures
|
||||
/// copied into the test output dir (see SVSim.UnitTests.csproj Content Include for
|
||||
/// Data/prod-captures). Idempotent — safe to call multiple times per factory. Tests that
|
||||
/// depend on prod-shaped global content (spot_cards, avatar abilities, etc.) call this once
|
||||
/// during setup; the rest of the test runs against whatever the importer populated.
|
||||
/// Runs the per-domain seed importers against the test SQLite DB using the seed JSON
|
||||
/// copied into the test output dir (see SVSim.UnitTests.csproj Content Includes for
|
||||
/// Data/seeds and Data/test-fixtures/seeds). Idempotent — safe to call multiple times.
|
||||
/// Tests that depend on prod-shaped global content (spot_cards, avatar abilities, etc.)
|
||||
/// call this once during setup; the rest of the test runs against whatever the importers
|
||||
/// populated. Mirrors the wiring in <see cref="SVSim.Bootstrap.Program"/>.
|
||||
/// </summary>
|
||||
public async Task SeedGlobalsAsync(string? capturesDir = null)
|
||||
public async Task SeedGlobalsAsync()
|
||||
{
|
||||
capturesDir ??= Path.Combine(AppContext.BaseDirectory, "Data", "prod-captures");
|
||||
string seedDir = Path.Combine(AppContext.BaseDirectory, "Data", "seeds");
|
||||
using var scope = Services.CreateScope();
|
||||
var ctx = scope.ServiceProvider.GetRequiredService<SVSimDbContext>();
|
||||
await new GlobalsImporter().ImportAllAsync(ctx, capturesDir);
|
||||
|
||||
// Load-index seed pipeline (Stage 9C). Mirrors the wiring in SVSim.Bootstrap.Program.cs:
|
||||
// RotationConfigImporter must precede RotationFlagUpdater; CardListsImporter is
|
||||
// ordered after the GameConfig importers for tidiness (no FK dependency).
|
||||
await new RotationConfigImporter().ImportAsync(ctx, seedDir);
|
||||
@@ -203,7 +201,6 @@ internal sealed class SVSimTestFactory : WebApplicationFactory<Program>
|
||||
await new CardListsImporter().ImportAsync(ctx, seedDir);
|
||||
await new RotationFlagUpdater().UpdateAsync(ctx);
|
||||
|
||||
// Per-importer seed pipeline for the rest of the load-index split.
|
||||
await new PracticeOpponentImporter().ImportAsync(ctx, seedDir);
|
||||
await new PaymentItemImporter().ImportAsync(ctx, seedDir);
|
||||
var puzzleImporter = new PuzzleImporter();
|
||||
|
||||
Reference in New Issue
Block a user