// lib/queue/store.mjs: the durable queue -- order, `after`, blocking, cancel, // retry, and what an app that died mid-step leaves (failed, never re-run). The // runner turn (queueTick) runs real processes through a plain spawn executor // here; the app gives it lib/jobs.ts. import assert from "node:assert/strict"; import { spawn, spawnSync } from "node:child_process"; import { createWriteStream } from "node:fs"; import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { test } from "node:test"; import { acquireLease, addStep, cancelStep, endOf, getStep, listSteps, logFileOf, planQueue, queueTick, readLease, resolveStep, retryStep, stepExitCode, stepFile, withQueueLock, } from "./store.mjs"; import { procStartTime } from "../report/renderRecord.mjs"; import { queueCommand, takeStatus } from "./cli.mjs"; const tmp = () => mkdtemp(path.join(os.tmpdir(), "umtool-queue-")); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); /** The tests' executor: each step's argv is `node -e