Upgrade dynamic questions to authored parity

This commit is contained in:
hz
2026-07-23 14:11:18 -05:00
parent e174b5db15
commit 92c5688b55
12 changed files with 690 additions and 18 deletions
@@ -24,15 +24,18 @@ public static class DynamicBlueprintCommand
blueprints.AddRange(JsonSerializer.Deserialize<List<DynamicQuestionBlueprint>>(await File.ReadAllTextAsync(file), json) ?? []);
var generator = new DynamicQuestionGenerator();
var generatedVariants = 0;
foreach (var blueprint in blueprints)
{
var error = DynamicQuestionGenerator.Validate(blueprint);
if (error is not null)
throw new InvalidDataException($"{blueprint.ExternalId} v{blueprint.Version}: {error}");
for (var seed = 0; seed < 1000; seed++)
var validationSeeds = blueprint.QualityStandardVersion >= 2 ? 10_000 : 1_000;
for (var seed = 0; seed < validationSeeds; seed++)
generator.Generate(blueprint, seed.ToString(), seed.ToString());
generatedVariants += validationSeeds;
}
await output.WriteLineAsync($"Validated {blueprints.Count} blueprints across 1,000 seeds each.");
await output.WriteLineAsync($"Validated {blueprints.Count} blueprints across {generatedVariants:N0} generated variants.");
if (!apply)
{
await output.WriteLineAsync("Dry run only. Pass --apply to publish.");
@@ -43,8 +46,8 @@ public static class DynamicBlueprintCommand
.AddEnvironmentVariables()
.Build();
var store = new DynamicQuestionStore(new MongoDatabaseProvider(configuration));
await store.UpsertBlueprintsAsync(blueprints);
await output.WriteLineAsync($"Published {blueprints.Count} immutable blueprint versions.");
var result = await store.UpsertBlueprintsAsync(blueprints);
await output.WriteLineAsync($"Promotion complete: {result.Inserted} inserted, {result.Unchanged} unchanged.");
return 0;
}
}