Apply refusal: a write over a durable record under an undeclared id is refused at ApplyWriteSet and reloads read-only
ForeignOnDisk and the two RefuseForeign calls in PushAll and CommitBatchCore are gone. ApplyWriteSet refuses first, over every key it writes or removes, by Registry.Declares for a cache and by the catalog entry it writes for a cacheless CultMesh write. Both refusals reload through one DurableAt; the directory store reloads through LoadPage, the per-record body of LoadRecordPages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
22d3f96a50
commit
067df993a3
4 changed files with 123 additions and 66 deletions
|
|
@ -183,15 +183,20 @@ public sealed class CultMeshSingleFileStoreTests
|
|||
Snapshot(path).Records.Should().Contain(record => record.Variant != null);
|
||||
var key = new CultRecordKey(target switch { "variant" => "v", "base" => "a", _ => "z" });
|
||||
|
||||
var conflict = Assert.Throws<CultWriteConflictException>(() =>
|
||||
void Write()
|
||||
{
|
||||
if (typed)
|
||||
CultMesh.WriteSingleFileDocument(path, key, PublicationOf("z"));
|
||||
else
|
||||
CultMesh.WriteSingleFileDocumentPayload(path, key, Raw, null, new byte[] { 0x90 });
|
||||
})!;
|
||||
}
|
||||
|
||||
conflict.Message.Should().Contain("CultCache");
|
||||
// A raw write at the variant's or the base's key names a record under an id its entry does not declare, and that refusal is
|
||||
// checked first.
|
||||
if (!typed && target != "unrelated")
|
||||
Assert.Throws<CultSchemaConflictException>(Write)!.RecordKey.Should().Be(key.Value);
|
||||
else
|
||||
Assert.Throws<CultWriteConflictException>(Write)!.Message.Should().Contain("CultCache");
|
||||
File.ReadAllBytes(path).Should().Equal(bytes);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue