Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(e2e): wait past the decoder's own kill bound for a corrupt image
Alfredo Lopezf6bb1b920934
diff --git a/scripts/e2e/fixtures/subscription-image-decoder.mjs b/scripts/e2e/fixtures/subscription-image-decoder.mjsindex 895229257..e6fed360f 100644--- a/scripts/e2e/fixtures/subscription-image-decoder.mjs+++ b/scripts/e2e/fixtures/subscription-image-decoder.mjs@@ -23,7 +23,7 @@ export function hasCompleteImageContainer(bytes, mimeType) {// Decode each received image in a throwaway process with empty env, no shell,// a fixed timeout, and bounded stdin/stdout. The vendor itself remains the// long-lived state machine and keeps all attempt state in its own PID.-const DECODER_TIMEOUT_MS = 10_000+export const DECODER_TIMEOUT_MS = 10_000const MAX_DECODER_STDOUT_BYTES = 1024 * 1024function decoderChildScript() {diff --git a/scripts/tests/subscription-image-input-frames.test.mjs b/scripts/tests/subscription-image-input-frames.test.mjsindex a0c0f02ed..656ae7afb 100644--- a/scripts/tests/subscription-image-input-frames.test.mjs+++ b/scripts/tests/subscription-image-input-frames.test.mjs@@ -12,7 +12,7 @@ import test from 'node:test'import { fileURLToPath, pathToFileURL } from 'node:url'import { inputFrames, sealSourceManifest } from '../e2e/run-subscription-image-journeys.mjs'import { buildRemainingFixtureFrame, createRemainingPixelAssets, remainingAssetPath } from '../e2e/prepare-subscription-remaining-fixtures.mjs'-import { decodeInChild } from '../e2e/fixtures/subscription-image-decoder.mjs'+import { DECODER_TIMEOUT_MS, decodeInChild } from '../e2e/fixtures/subscription-image-decoder.mjs'import { digest, expectedJourneyNames, resolveSuite } from './lib/subscription-image-runner-contract.mjs'const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')@@ -158,8 +158,8 @@ async function nativeReceiver(t, admission, root, deadlineMs = RUNNER_INPUT_DEADfor (const notify of [...waiters]) notify()}})- const next = kind => new Promise((resolve, reject) => {- const timer = setTimeout(() => { waiters.splice(waiters.indexOf(check), 1); reject(Error(`UNIT_RECEIVER_${kind}_TIMEOUT`)) }, 10_000)+ const next = (kind, timeoutMs = 10_000) => new Promise((resolve, reject) => {+ const timer = setTimeout(() => { waiters.splice(waiters.indexOf(check), 1); reject(Error(`UNIT_RECEIVER_${kind}_TIMEOUT`)) }, timeoutMs)const check = () => {const index = events.findIndex(value => value.kind === kind)if (index < 0 && !closed) return@@ -244,7 +244,10 @@ test('native async decode failure never becomes ready and cannot publish a prepaasset.contentsBase64 = corrupt.toString('base64'); asset.sha256 = digest(corrupt)frame.receipt.fixtures[asset.provider].files.find(file => file.name === asset.name).imageSha256 = asset.sha256receiver.send([...initialFrames(admission), frame])- assert.match((await receiver.next('failed')).code, /image decoder exited/)+ // A corrupt image may fail at once or run until the decoder kills its child+ // at DECODER_TIMEOUT_MS; both end as "image decoder exited". The wait must+ // outlast that bound or the harness timeout wins the race on slow runners.+ assert.match((await receiver.next('failed', DECODER_TIMEOUT_MS + 10_000)).code, /image decoder exited/)assert.equal(receiver.events.some(value => value.kind === 'ready'), false)assert.equal(fs.existsSync(path.join(root, 'remaining-gfs-image.json')), false)assert.equal(fs.existsSync(path.join(root, 'remaining-gfs-image')), false)