Land fixes: ported conditional-commit pins state C2a's identity, not main's (storedAt, message text)
A staged write mints a later storedAt, so the 'rewrite kept storedAt' premise is gone; the pin is that a record rewritten under another schema fails Expect. The variant refusal names the renamed base through ChangedKeys, as C2a's typed exception carries it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f2cdb7897d
commit
87957b2d1a
2 changed files with 4 additions and 6 deletions
|
|
@ -83,21 +83,18 @@ namespace GameCult.Caching.Tests
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void RecordRewrittenUnderAnotherSchemaWithItsStoredAtFailsExpect()
|
||||
public void RecordRewrittenUnderAnotherSchemaFailsExpect()
|
||||
{
|
||||
SeedDrift(directory: false);
|
||||
using var cache = Drift(false, NarrowDrift).Open();
|
||||
var observed = cache.Get(DriftKey)!;
|
||||
var storedAt = cache.GetStored(DriftKey)!.StoredAt;
|
||||
using (var other = Drift(false, ReusedDrift).Open())
|
||||
{
|
||||
other.BackingStores[0].Push(other.GetStored(DriftKey)!);
|
||||
other.BackingStores[0].PushAll();
|
||||
}
|
||||
using (var reader = Drift(false, ReusedDrift).Open())
|
||||
Assert.That(reader.GetStored(DriftKey)!.StoredAt, Is.EqualTo(storedAt), "the rewrite kept storedAt");
|
||||
|
||||
Assert.That(DriftCommit(cache, observed, 2), Is.False, "a record rewritten under another schema passed Expect on storedAt alone");
|
||||
Assert.That(DriftCommit(cache, observed, 2), Is.False, "a record rewritten under another schema passed Expect");
|
||||
}
|
||||
|
||||
// The directory store rewrites only what is pushed to it, so the other writer pushes the record it read unchanged.
|
||||
|
|
|
|||
|
|
@ -1265,7 +1265,8 @@ namespace GameCult.Caching.Tests
|
|||
a.Override<VariantGear>(nameof(VariantGear.Code), "big")
|
||||
});
|
||||
}))!;
|
||||
Assert.That(refused.Message, Does.Contain(BigKey.Value).And.Contain(BaseKey.Value).And.Contain("x"));
|
||||
Assert.That(refused.Message, Does.Contain(BigKey.Value));
|
||||
Assert.That(refused.ChangedKeys, Is.EqualTo(new[] { BaseKey.Value }), "the refusal names the base another writer renamed");
|
||||
}
|
||||
|
||||
using var reopened = Open(path, readOnly: true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue