fix(engine): discard cancelled pipeline results from uncooperative engines

This commit is contained in:
aj
2026-09-29 10:31:23 -04:00
parent c914d2bbd9
commit 7aeb636ca2
2 changed files with 17 additions and 0 deletions
@@ -101,6 +101,21 @@ public class NestPipelineTests
Assert.Contains("Default", error.Message);
}
[Fact]
public void CancellationDuringSolveDiscardsEvenAnEngineThatReturnsNormally()
{
using var cts = new CancellationTokenSource();
var engine = new StubEngine(job =>
{
cts.Cancel();
return OnePlate(job, new NestJobPlacement(job.Parts[0].Id, 0, 1, 1, 0));
});
Assert.ThrowsAny<OperationCanceledException>(() =>
NestPipeline.Run(engine, "IgnoresStop", Request("IgnoresStop", Item("bracket", 1)), null, cts.Token)
);
}
[Fact]
public void CancellationPropagatesWithoutAResult()
{