From caecffd1d6637a8c21128f26a2e40ccb52a9101b Mon Sep 17 00:00:00 2001 From: Vitalii Popov Date: Fri, 13 Nov 2026 16:04:24 +0100 Subject: [PATCH 1/2] test(workflow-tengo): wait for the import error itself in the failed-import effect test The effect map can be ready before the import error gets to the entry. A read of the entry then gives the fields and no error, and the test fails. It failed this way on the k8s S3 job of the pl CI and on the CI of this repo. Co-Authored-By: Claude Opus 5.5 --- .changeset/tough-laws-bake.md | 2 ++ tests/workflow-tengo/src/v2/effect.test.ts | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .changeset/tough-laws-bake.md diff --git a/.changeset/tough-laws-bake.md b/.changeset/tough-laws-bake.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/tough-laws-bake.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/tests/workflow-tengo/src/v2/effect.test.ts b/tests/workflow-tengo/src/v2/effect.test.ts index 434a87beec..0002c99d6a 100644 --- a/tests/workflow-tengo/src/v2/effect.test.ts +++ b/tests/workflow-tengo/src/v2/effect.test.ts @@ -289,12 +289,12 @@ tplTest.concurrent( // The effect map, the imports map and the entry have locked inputs when the body returns. // The import error gets to them later: first to the entry, then to the imports map, then to - // the effect map. Thus wait until the effect map is ready or has an error. If you do not wait, - // the client can read the entry before the error gets to it, and the read gives no error. + // the effect map. The effect map can be ready before the error gets to the entry, and a read of + // the entry then gives no error. Thus keep waiting until the read of the entry throws the error. const effect = awaitStableState( render.computeOutput("effect", (a) => { - if (a === undefined || !a.getIsReadyOrError()) return undefined; - return input(input(a, "imports"), source)?.listInputFields(); + input(input(a, "imports"), source)?.listInputFields(); + return undefined; }), OUTPUT_TIMEOUT, ); From a919c7c972496ca96797cf730e6d979266814e7d Mon Sep 17 00:00:00 2001 From: Vitalii Popov Date: Mon, 16 Nov 2026 11:07:41 +0100 Subject: [PATCH 2/2] test(workflow-tengo): poll the failed-import read until the error reaches the effect map The import error climbs one level at a time: entry, imports map, effect map. The client takes a field with no error as stable, so one stable read can end before the error arrives, or with the error below the effect map. Both happened on the k8s S3 job. Poll a fresh read until its error names the imports field of the effect map. Co-Authored-By: Claude Opus 5.5 --- tests/workflow-tengo/src/v2/effect.test.ts | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/workflow-tengo/src/v2/effect.test.ts b/tests/workflow-tengo/src/v2/effect.test.ts index 0002c99d6a..b4fbadeaab 100644 --- a/tests/workflow-tengo/src/v2/effect.test.ts +++ b/tests/workflow-tengo/src/v2/effect.test.ts @@ -287,18 +287,25 @@ tplTest.concurrent( args: { sources: [source] }, }); - // The effect map, the imports map and the entry have locked inputs when the body returns. - // The import error gets to them later: first to the entry, then to the imports map, then to - // the effect map. The effect map can be ready before the error gets to the entry, and a read of - // the entry then gives no error. Thus keep waiting until the read of the entry throws the error. - const effect = awaitStableState( - render.computeOutput("effect", (a) => { - input(input(a, "imports"), source)?.listInputFields(); + // The import error climbs one level at a time: entry, imports map, effect map. The client + // takes a field with no error as stable, so one read can end before the error or below the top. + const readError = async (): Promise => { + try { + await awaitStableState( + render.computeOutput("effect", (a) => { + input(input(a, "imports"), source)?.listInputFields(); + return undefined; + }), + OUTPUT_TIMEOUT, + ); return undefined; - }), - OUTPUT_TIMEOUT, - ); - await expect(effect).rejects.toThrow(/\/imports"[\s\S]*no-such-file\.txt[\s\S]*item not found/); + } catch (e) { + return String(e); + } + }; + await expect + .poll(readError, { timeout: OUTPUT_TIMEOUT, interval: 500 }) + .toMatch(/\/imports"[\s\S]*no-such-file\.txt[\s\S]*item not found/); }, );