verse-grammar apply: the grammar update builds a new record instead of editing the cached one; replace test compares fields
The command mutated the cache's own VerseGrammar before the batch upsert, so the upsert was redundant and two Soul mutants (update branch dropped; Same ignoring description or render path) survived: the replace test judged the result with the same Same() the command uses. The test now reads the fields. Unrun until the full job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c5e8e45e61
commit
859ecad83a
2 changed files with 5 additions and 4 deletions
|
|
@ -278,7 +278,10 @@ public sealed class VerseGrammarTests : IDisposable
|
|||
|
||||
using var cache = OpenScoped(CatalogOf(root), true);
|
||||
Assert.Equal(1, cache.GetAll<VerseVerb>().Count(verb => verb.Name == "haul"));
|
||||
Assert.True(VerseGrammarCommand.Same(starter, cache.GetByName<VerseVerb>("haul")));
|
||||
var landed = cache.GetByName<VerseVerb>("haul");
|
||||
Assert.Equal(starter.Description, landed.Description);
|
||||
Assert.Equal(VerseRenderPath.ShipAction, landed.RenderPath);
|
||||
Assert.Equal(new[] { "cargo:Cargo", "destination:Place" }, landed.Roles.Select(r => $"{r.Name}:{r.Binds}"));
|
||||
}
|
||||
|
||||
// The grammar global is updated in place (one record) when its revision or its description is not the starter's.
|
||||
|
|
|
|||
|
|
@ -90,9 +90,7 @@ public static class VerseGrammarCommand
|
|||
{
|
||||
if (!grammarCurrent)
|
||||
{
|
||||
var record = grammar ?? new VerseGrammar();
|
||||
record.Revision = StarterRevision;
|
||||
record.Description = StarterDescription;
|
||||
var record = new VerseGrammar { Revision = StarterRevision, Description = StarterDescription };
|
||||
if (grammar == null) batch.Upsert(typeof(VerseGrammar), record);
|
||||
else batch.Upsert(typeof(VerseGrammar), record, cache.RefOf(grammar).Key);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue