Merge main at cultlib-unity-v2.0.0 (42dce361) into C2a: one owner per collision

Identity: C2a's StoredSchemaId/StoredVersion owns; main's PersistedSchemaId, PersistedIdentity and both MarkWritten are deleted. Stamp rule: ReadStore judges the stamp before the body. Flush over damage refuses (merge-r1-precedence). Mesh single-file writes route through SingleFileMessagePackBackingStore. TS: store-file.ts commits, C2a's header handling kept. Rust: C2a's readable_store_format in front of the grown decoder. Build not yet verified at this commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-22 20:21:31 +02:00
commit f2b3569822
210 changed files with 27332 additions and 899 deletions

View file

@ -17,7 +17,7 @@ static async Task<int> ProgramMainAsync(string[] args)
{
if (args.Length == 0)
{
throw new InvalidOperationException("Expected mode: write | read | rewrite | write-routed <catalog.cc> <run.cc>");
throw new InvalidOperationException("Expected mode: write | read | rewrite | hold-lock | write-routed <catalog.cc> <run.cc>");
}
var mode = args[0];
@ -51,6 +51,9 @@ static async Task<int> ProgramMainAsync(string[] args)
case "edit-in-place":
await EditInPlaceAsync(file, RequireArg(options, "kind"));
return 0;
case "hold-lock":
HoldLock(file, int.Parse(RequireArg(options, "ms"), CultureInfo.InvariantCulture));
return 0;
default:
throw new InvalidOperationException($"Unknown mode {mode}.");
}
@ -62,6 +65,20 @@ static async Task<int> ProgramMainAsync(string[] args)
}
}
// Holds the store lock exactly as CultCache.AcquireLock opens it, for --ms, then releases it.
static void HoldLock(string file, int milliseconds)
{
using var held = new System.IO.FileStream(
file + ".lock",
System.IO.FileMode.OpenOrCreate,
System.IO.FileAccess.ReadWrite,
System.IO.FileShare.None,
bufferSize: 1);
Console.WriteLine("{\"held\":true}");
Console.Out.Flush();
System.Threading.Thread.Sleep(milliseconds);
}
static async Task WriteAsync(string file, string runtimeId)
{
var cache = BuildCache(file);