Re-read the manifest outside the unleased load's exception filter

An exception thrown inside a `when` filter is swallowed as false, so a manifest
re-read failing mid-File.Replace turned a race that should retry into a thrown
torn-page error. The re-read now runs in the handler, and a failed re-read
counts as moved. Parallel.For's AggregateException is unwrapped where the pages
are read, so the page's own failure propagates and the torn check no longer
walks wrappers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-14 14:51:37 +02:00
commit bddec0fe4d
2 changed files with 33 additions and 9 deletions

View file

@ -696,7 +696,8 @@ namespace GameCult.Caching.Tests
var thrown = Assert.CatchAsync(() => reader.PullAllBackingStoresAsync())!;
Assert.That(loads, Is.EqualTo(1), "corruption is not retried as a race");
Assert.That(thrown.ToString(), Does.Contain("does not match its committed content hash").And.Not.Contain("did not settle"));
Assert.That(thrown, Is.TypeOf<InvalidDataException>(), "the page's failure, not Parallel.For's wrapper");
Assert.That(thrown.Message, Does.Contain("does not match its committed content hash"));
}
finally
{