feat: bind activation receipts to immutable content

This commit is contained in:
codex
2026-08-06 09:29:00 +03:00
parent 1aa68ba8c5
commit 95beb0f632
3 changed files with 19 additions and 7 deletions
@@ -12,6 +12,14 @@ public sealed class PackageLifecycleTests
new("entry.dll", a.Length, Convert.ToHexString(SHA256.HashData(a))),
new("payload.dat", b.Length, Convert.ToHexString(SHA256.HashData(b)))], new("none", ""), RolloutChannel: "pilot");
[Fact]
public async Task MutatedImmutablePayloadBlocksActivation()
{
var root=Path.Combine(Path.GetTempPath(),Guid.NewGuid().ToString("N")); var source=Path.Combine(root,"catalog"); Directory.CreateDirectory(source); var bytes=new byte[]{1}; await File.WriteAllBytesAsync(Path.Combine(source,"entry.dll"),bytes); await File.WriteAllBytesAsync(Path.Combine(source,"payload.dat"),bytes); var store=new LocalPackageStore(root,new Sha256FileHasher());
try { var package=await store.MaterializeAsync(Manifest("1.0.0",bytes,bytes),source,CancellationToken.None); await File.WriteAllBytesAsync(Path.Combine(package.LocalPackageRoot,"entry.dll"),new byte[]{9}); Assert.Equal("Blocked",(await store.ActivateImmutableAsync(package,Req("1.0.0"),CancellationToken.None)).Outcome); }
finally { if(Directory.Exists(root)) Directory.Delete(root,true); }
}
[Fact]
public async Task ActivationReceiptBindsPointerGenerationAndRejectsStaleRollback()
{