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:
@@ -34,7 +34,7 @@ public static class Program
|
||||
Console.WriteLine($"[Bootstrap] Connection: {RedactPassword(opts.ConnectionString)}");
|
||||
Console.WriteLine($"[Bootstrap] Reference CSVs: {opts.ReferenceDataDir}");
|
||||
Console.WriteLine($"[Bootstrap] Cards file: {opts.CardsFile}");
|
||||
Console.WriteLine($"[Bootstrap] Captures: {opts.CapturesDir}");
|
||||
Console.WriteLine($"[Bootstrap] Seeds: {opts.SeedDir}");
|
||||
|
||||
var dbOptions = new DbContextOptionsBuilder<SVSimDbContext>()
|
||||
.UseNpgsql(opts.ConnectionString)
|
||||
@@ -75,9 +75,11 @@ public static class Program
|
||||
|
||||
if (!opts.SkipGlobals)
|
||||
{
|
||||
await new GlobalsImporter().ImportAllAsync(context, opts.CapturesDir);
|
||||
|
||||
// Load-index seed pipeline (Stage 9C replaced the old in-GlobalsImporter capture-parsing).
|
||||
// Per-domain seed pipeline. The legacy GlobalsImporter that parsed prod-captured
|
||||
// /load/index, /mypage/index, /deck/info wire payloads directly is gone — capture
|
||||
// → seed transformation lives in data_dumps/extract/*; importers below just
|
||||
// deserialise the per-table JSON files in SVSim.Bootstrap/Data/seeds/.
|
||||
//
|
||||
// RotationConfigImporter writes the Rotation GameConfig section that RotationFlagUpdater
|
||||
// reads; CardImporter ran earlier in the !SkipCards block so CardSets are populated.
|
||||
await new RotationConfigImporter().ImportAsync(context, opts.SeedDir);
|
||||
@@ -136,7 +138,6 @@ public static class Program
|
||||
private static BootstrapOptions? ParseArgs(string[] args)
|
||||
{
|
||||
string? cards = null;
|
||||
string? captures = null;
|
||||
string? referenceDataDir = null;
|
||||
string? connection = null;
|
||||
bool skipReference = false;
|
||||
@@ -152,7 +153,6 @@ public static class Program
|
||||
switch (a)
|
||||
{
|
||||
case "--cards": cards = NextArg(args, ref i); break;
|
||||
case "--captures": captures = NextArg(args, ref i); break;
|
||||
case "--reference-data-dir": referenceDataDir = NextArg(args, ref i); break;
|
||||
case "--connection-string": connection = NextArg(args, ref i); break;
|
||||
case "--skip-reference": skipReference = true; break;
|
||||
@@ -170,15 +170,13 @@ public static class Program
|
||||
}
|
||||
|
||||
// All bootstrap inputs ship in-project under SVSim.Bootstrap/Data/, copied next to the
|
||||
// binary on build. The --cards/--captures/--reference-data-dir flags are ad-hoc overrides
|
||||
// binary on build. The --cards/--reference-data-dir flags are ad-hoc overrides
|
||||
// (e.g. point at a fresh loader dump before promoting it into the project).
|
||||
string baseDir = AppContext.BaseDirectory;
|
||||
string shippedDataDir = Path.Combine(baseDir, "Data");
|
||||
string shippedCaptures = Path.Combine(shippedDataDir, "prod-captures");
|
||||
string shippedCardsFile = Path.Combine(shippedDataDir, "cards.json");
|
||||
|
||||
string cardsFile = cards ?? positionalCards ?? shippedCardsFile;
|
||||
string capturesDir = captures ?? shippedCaptures;
|
||||
string refDir = referenceDataDir ?? shippedDataDir;
|
||||
string shippedStoryDir = Path.Combine(shippedDataDir, "story");
|
||||
string storyDir = storyDataDir ?? shippedStoryDir;
|
||||
@@ -189,7 +187,7 @@ public static class Program
|
||||
?? DefaultConnectionString;
|
||||
|
||||
return new BootstrapOptions(
|
||||
cardsFile, capturesDir, refDir, connStr, skipReference, skipCards, skipGlobals,
|
||||
cardsFile, refDir, connStr, skipReference, skipCards, skipGlobals,
|
||||
skipStory, storyDir, shippedSeedDir);
|
||||
}
|
||||
|
||||
@@ -212,23 +210,24 @@ public static class Program
|
||||
" loader dump) — promote into Data/ when you're ready to make it permanent.\n" +
|
||||
"\n" +
|
||||
" --cards <file> Override path to cards.json (default: shipped Data/cards.json)\n" +
|
||||
" --captures <dir> Override path to prod-captures directory\n" +
|
||||
" (default: shipped Data/prod-captures)\n" +
|
||||
" --reference-data-dir <dir> Override reference CSV directory (default: shipped Data/)\n" +
|
||||
" --connection-string <conn> Postgres connection (or NPGSQL_CONNECTION env var,\n" +
|
||||
$" then \"{DefaultConnectionString}\")\n" +
|
||||
" --skip-reference Skip reference-data import (classes, sleeves, ranks, ...)\n" +
|
||||
" --skip-cards Skip card + card-cosmetic-reward import\n" +
|
||||
" --skip-globals Skip prod-captured globals import\n" +
|
||||
" --skip-globals Skip seed-driven globals import (per-table JSON under Data/seeds)\n" +
|
||||
" --story-data-dir <dir> Override story data directory (default: shipped Data/story)\n" +
|
||||
" --skip-story Skip story import (worlds/sections/chapters/sbs)\n" +
|
||||
"\n" +
|
||||
"Capture-derived seeds are produced by extractors under data_dumps/extract/* and\n" +
|
||||
"checked into SVSim.Bootstrap/Data/seeds/. The bootstrap project never parses wire\n" +
|
||||
"captures directly — refresh seeds by re-running the relevant extractor.\n" +
|
||||
"\n" +
|
||||
"Back-compat: `svsim-bootstrap <cards.json> [connection]` still works (positional).");
|
||||
}
|
||||
|
||||
private sealed record BootstrapOptions(
|
||||
string CardsFile,
|
||||
string CapturesDir,
|
||||
string ReferenceDataDir,
|
||||
string ConnectionString,
|
||||
bool SkipReference,
|
||||
|
||||
Reference in New Issue
Block a user