C#: a dangling link is an I/O error on read; the directory refusal echoes a header only as store version digits; contract names Rust's real type

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-02 20:49:12 +02:00
commit 425531d88e
5 changed files with 70 additions and 5 deletions

View file

@ -302,8 +302,9 @@ and on rewrite alike, because the rewrite asks the same full reader as the open.
file and an empty array are an empty store; a zero-byte file is not a store and is refused as unreadable. A flush or a commit replaces a file only when the
runtime's own reader opens it, so one verdict covers open, flush and commit, and a file the
runtime cannot read is left as it is. Each runtime refuses with one typed error:
`CultStoreUnreadableException` (C#), `StoreUnreadableError` (Rust, TypeScript, Python), with
the underlying cause attached. Rust, TypeScript and Python also open the legacy envelope
`CultStoreUnreadableException` (C#), `CultCacheStoreUnreadable{path, kind}` (Rust, its kind
telling an undecodable store from an unsupported format), `StoreUnreadableError` (TypeScript,
Python), with the underlying cause attached. Rust, TypeScript and Python also open the legacy envelope
array (an array of `key`/`type`/`payload`/`storedAt` maps) and replace it; C# has no legacy
reader and refuses it. The shared byte vectors and each runtime's verdict are
`tests/vectors/document-variants-c2a/readability/manifest.txt`.

View file

@ -4012,12 +4012,17 @@ namespace GameCult.Caching
private byte[]? ReadDisk()
{
FileInfo.Refresh();
if (!FileInfo.Exists)
// Only nothing at the path is an empty store. A link whose target is gone is a store that cannot be reached.
if (!FileInfo.Exists && FileInfo.LinkTarget == null)
return null;
try
{
return ReadAllBytesShared(FileInfo.FullName);
}
catch (FileNotFoundException ex) when (FileInfo.LinkTarget != null)
{
throw new IOException("The store path is a link whose target cannot be reached.", ex);
}
catch (FileNotFoundException)
{
return null;