refactor(bootstrap): migrate practice opponents to seed file

Move /practice/info handling out of GlobalsImporter into a dedicated
PracticeOpponentImporter that reads a normalized JSON seed file
generated by data_dumps/extract/extract-practice-opponents.ps1.
This commit is contained in:
gamer147
2026-05-26 13:42:59 -04:00
parent 7ec4892d73
commit 40b0de1d51
9 changed files with 1495 additions and 50 deletions

View File

@@ -185,9 +185,14 @@ internal sealed class SVSimTestFactory : WebApplicationFactory<Program>
public async Task SeedGlobalsAsync(string? capturesDir = null)
{
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);
// Per-importer seed pipeline runs alongside GlobalsImporter during the migration.
// Wired here so SeedGlobalsAsync callers (e.g. PracticeControllerTests) still see
// practice-opponent rows after the corresponding block was lifted out of GlobalsImporter.
await new PracticeOpponentImporter().ImportAsync(ctx, seedDir);
}
/// <summary>Convenience: bake the X-Test-Viewer-Id header into a fresh client.</summary>