test(kuna): cancel inspection scenarios at their owning boundary

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
N0zoM1z0andgensokyo-dev authored and gensokyo-dev committed 2026-11-11 21:19:01 +08:00
1 parent fbbf94a2c4
commit 40d9f1a5e8
1 file changed
+4 -1
@@ -289,14 +289,16 @@ it.each([
rootClose = vi
.spyOn(root, "close")
.mockRejectedValue(new Error("controlled rollback refusal"));
lifetime.abort(reason);
if (stage === "copy") lifetime.abort(reason);
return root;
});
let inspectionCalls = 0;
const prepare = systemProcessOwnershipHost.prepare;
const inspection = vi
.spyOn(systemProcessOwnershipHost, "prepare")
.mockImplementation(async (signal) => {
if (stage === "inspection" && signal === lifetime.signal) {
inspectionCalls += 1;
lifetime.abort(reason);
throw new ExecFileOutputCancelledError(reason);
}
@@ -305,6 +307,7 @@ it.each([
try {
const result = await commands.prepare();
if (result.ok) throw new Error("Expected cancelled workspace admission");
expect(inspectionCalls).toBe(stage === "inspection" ? 1 : 0);
const primary = result.error.cleanupPrimary ?? result.error;
expect(primary).toMatchObject({
_tag: "AnalysisCancelledError",