A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(tests): a recursive delete on Windows retries, and a gate says so
yhh0e492a336331
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4c1432a70..2e3efc55d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -49,6 +49,23 @@ published separately; it ships inside the editor.### Fixed+- **A recursive delete on Windows now retries, so the temp-tree flake is gone.**+ Deleting on Windows is not synchronous at the filesystem level: an unlinked file+ sits in a pending-delete state with its directory entry still there, so the+ `rmdir` that follows sees a directory that is not empty. A test that writes a+ temp tree and removes it then fails with `ENOTEMPTY` **at random** — more often+ on a machine with an indexer or a virus scanner — and it reads as a bug in+ whatever ran last, which is how it costs an afternoon.++ Node's `fs.rm` already carries a retry loop for exactly these errors. But+ `maxRetries` **defaults to 0**, so every call written the obvious way has it+ switched off, and `force: true` does not help — that suppresses `ENOENT` and+ nothing else. There were **133 recursive removes in the engine and 76 in the+ editor, and not one set it**. All of them do now.++ `check-rm-retries` keeps it that way, and reads the editor checkout too, so the+ next one is caught wherever it is written.+- **Two more hand-copied boundary constants, and a way to stop the next one.**The tile cell encoding (13-bit id, three flip bits, the chunk stride) and theparticle colour LUT size were each written once in C++ and again in TypeScript,diff --git a/bench/aot-frame/build.mjs b/bench/aot-frame/build.mjsindex ecd2aa3e1..4579658a0 100644--- a/bench/aot-frame/build.mjs+++ b/bench/aot-frame/build.mjs@@ -57,7 +57,7 @@ async function loadPipeline() {logLevel: 'error',});const mod = await import(pathToFileURL(outfile).href);- return { mod, cleanup: () => rmSync(dir, { recursive: true, force: true }) };+ return { mod, cleanup: () => rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }) };}async function main() {@@ -71,7 +71,7 @@ async function main() {if (!built.ok) throw new Error(`the AOT step refused:\n ${built.errors.join('\n ')}`);if (!built.wasmPath) throw new Error('nothing was compiled — is the @compiled marker still there?');- rmSync(OUT, { recursive: true, force: true });+ rmSync(OUT, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(OUT, { recursive: true });copyFileSync(built.wasmPath, join(OUT, 'systems.wasm'));writeFileSync(join(OUT, 'systems.json'), `${JSON.stringify(built.manifest, null, 2)}\n`);diff --git a/bench/aot-native/frame-bench.mjs b/bench/aot-native/frame-bench.mjsindex 85775c1ea..0549b41ee 100644--- a/bench/aot-native/frame-bench.mjs+++ b/bench/aot-native/frame-bench.mjs@@ -351,7 +351,7 @@ try {}}} finally {- if (!KEEP) rmSync(out, { recursive: true, force: true });+ if (!KEEP) rmSync(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });else console.log(`\nkept: ${out}`);}diff --git a/build-tools/cli.js b/build-tools/cli.jsindex d16f588f2..9368a91a3 100644--- a/build-tools/cli.js+++ b/build-tools/cli.js@@ -270,7 +270,7 @@ async function cleanAll() {const outputDir = config.paths.output;if (existsSync(outputDir)) {- await rm(outputDir, { recursive: true, force: true });+ await rm(outputDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });logger.debug('Removed build/');}diff --git a/build-tools/tasks/check-examples.js b/build-tools/tasks/check-examples.jsindex 929dfa3f7..0c9106943 100644--- a/build-tools/tasks/check-examples.js+++ b/build-tools/tasks/check-examples.js@@ -56,11 +56,11 @@ function setupTypeLinks(exampleDir, rootDir) {// would silently shadow current SDK types (checks would fail — or pass —// against an old API). The mirror is a disposable cache; the editor// re-stages it on the next open.- rmSync(sdkLink, { recursive: true, force: true });+ rmSync(sdkLink, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });symlinkSync(sdkDist, sdkLink, LINK_TYPE);if (existsSync(editorDist)) {- rmSync(editorLink, { recursive: true, force: true });+ rmSync(editorLink, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });symlinkSync(editorDist, editorLink, LINK_TYPE);}}diff --git a/build-tools/tasks/native.js b/build-tools/tasks/native.jsindex d2a808820..8ae2e94f3 100644--- a/build-tools/tasks/native.js+++ b/build-tools/tasks/native.js@@ -533,7 +533,7 @@ async function assembleXcframework(rootDir, env, genDir) {libs.push('-library', lib);}const out = path.join(rootDir, XCFRAMEWORK);- await rm(out, { recursive: true, force: true });+ await rm(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await runCommand('xcodebuild', ['-create-xcframework', ...libs, '-output', out], { cwd: rootDir, env, silent: true });logger.success(`iOS framework: ${XCFRAMEWORK} (${libs.length / 2} slice${libs.length === 2 ? '' : 's'})`);}@@ -547,7 +547,7 @@ async function stageIosContent(rootDir, contentDir) {const to = path.join(rootDir, 'native', 'ios', 'Content');const keep = path.join(to, '.gitkeep');const keepText = existsSync(keep) ? readFileSync(keep, 'utf8') : null;- await rm(to, { recursive: true, force: true });+ await rm(to, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await mkdir(to, { recursive: true });await cp(from, to, { recursive: true });// The placeholder is committed so a fresh clone has the directory xcodegen'sdiff --git a/build-tools/tasks/nativeTemplateEmit.js b/build-tools/tasks/nativeTemplateEmit.jsindex ffe26f363..b46299182 100644--- a/build-tools/tasks/nativeTemplateEmit.js+++ b/build-tools/tasks/nativeTemplateEmit.js@@ -72,7 +72,7 @@ export async function compileJavaShim(outDir, { sdk, androidPlatform, jdk, root.filter((f) => String(f).endsWith('.class')).map((f) => path.join(classes, String(f)));await runCommand(buildTool(sdk, 'd8'), ['--lib', platformJar(sdk, androidPlatform), '--output', outDir, ...classFiles]);- await rm(classes, { recursive: true, force: true });+ await rm(classes, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });return existsSync(path.join(outDir, 'classes.dex'));}@@ -160,7 +160,7 @@ export async function emitNativeTemplate(options) {.filter((e) => e.abi === abi).map((e) => ({ rel: e.rel, data: readFileSync(path.join(dir, e.rel)) })) }));- await rm(dir, { recursive: true, force: true });+ await rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await mkdir(dir, { recursive: true });for (const { files } of carry) {for (const file of files) {diff --git a/build-tools/tasks/sdk.js b/build-tools/tasks/sdk.jsindex 86a0fad69..8b1bd5d44 100644--- a/build-tools/tasks/sdk.js+++ b/build-tools/tasks/sdk.js@@ -105,7 +105,7 @@ async function copyDistOutputs(sdkDir, outputDir) {const esmDir = path.join(outputDir, 'esm');const cjsDir = path.join(outputDir, 'cjs');- await rm(esmDir, { recursive: true, force: true });+ await rm(esmDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await mkdir(esmDir, { recursive: true });await mkdir(cjsDir, { recursive: true });@@ -162,12 +162,12 @@ export async function cleanSdk() {const outputSdkDir = path.join(config.paths.output, 'sdk');if (existsSync(sdkDistDir)) {- await rm(sdkDistDir, { recursive: true, force: true });+ await rm(sdkDistDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });logger.debug('Removed sdk/dist');}if (existsSync(outputSdkDir)) {- await rm(outputSdkDir, { recursive: true, force: true });+ await rm(outputSdkDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });logger.debug('Removed build/sdk');}}diff --git a/build-tools/tasks/sync.js b/build-tools/tasks/sync.jsindex a31477257..1ab3ea716 100644--- a/build-tools/tasks/sync.js+++ b/build-tools/tasks/sync.js@@ -47,7 +47,7 @@ export async function syncToDesktop(options = {}) {// Mirror rather than merge: the shared chunk filenames are the// bundler's to choose, so a merge leaves the previous build's// chunks behind forever and ships them to the editor.- await rm(destPath, { recursive: true, force: true });+ await rm(destPath, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });synced += await copyDirectory(srcPath, destPath);}}diff --git a/build-tools/tasks/wasm.js b/build-tools/tasks/wasm.jsindex 6c7905dfb..bb4be4f5e 100644--- a/build-tools/tasks/wasm.js+++ b/build-tools/tasks/wasm.js@@ -123,7 +123,7 @@ async function executeWasmBuild(target, targetConfig, { debug, clean, buildDir,if (clean && existsSync(buildDir)) {logger.debug(`Cleaning ${buildDir}`);- await rm(buildDir, { recursive: true, force: true });+ await rm(buildDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}await mkdir(buildDir, { recursive: true });@@ -315,7 +315,7 @@ export async function cleanWasm(target = null) {}const buildDir = path.join(rootDir, targetConfig.buildDir);if (existsSync(buildDir)) {- await rm(buildDir, { recursive: true, force: true });+ await rm(buildDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });logger.debug(`Removed ${buildDir}`);}} else {diff --git a/build-tools/toolchain/package-emsdk.js b/build-tools/toolchain/package-emsdk.jsindex c1a1aa281..3636384d3 100644--- a/build-tools/toolchain/package-emsdk.js+++ b/build-tools/toolchain/package-emsdk.js@@ -191,7 +191,7 @@ function main() {// Create a temporary symlink/junction with the archive nameconst tmpLink = path.join(path.dirname(emsdkPath), archiveName);try {- if (fs.existsSync(tmpLink)) fs.rmSync(tmpLink, { recursive: true });+ if (fs.existsSync(tmpLink)) fs.rmSync(tmpLink, { recursive: true, maxRetries: 10, retryDelay: 50 });execSync(`mklink /J "${tmpLink}" "${emsdkPath}"`, { shell: 'cmd', stdio: 'pipe' });} catch {// Fallback: just use the directory name@@ -226,7 +226,7 @@ function main() {const tmpLink = path.join(path.dirname(emsdkPath), archiveName);let srcDir = archiveName;try {- if (fs.existsSync(tmpLink)) fs.rmSync(tmpLink, { recursive: true, force: true });+ if (fs.existsSync(tmpLink)) fs.rmSync(tmpLink, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });fs.symlinkSync(emsdkPath, tmpLink);} catch {srcDir = path.basename(emsdkPath);@@ -239,7 +239,7 @@ function main() {);if (fs.existsSync(tmpLink) && tmpLink !== emsdkPath) {- fs.rmSync(tmpLink, { recursive: true, force: true });+ fs.rmSync(tmpLink, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}const stat = fs.statSync(outFile);diff --git a/build-tools/toolchain/package.js b/build-tools/toolchain/package.jsindex e39452bf0..2a261f98f 100644--- a/build-tools/toolchain/package.js+++ b/build-tools/toolchain/package.js@@ -103,7 +103,7 @@ function resolveTemplate(str, vars) {async function packageEngineSource(manifest) {const engineSrcDir = path.join(OUTPUT_DIR, 'engine-src');if (fs.existsSync(engineSrcDir)) {- await rm(engineSrcDir, { recursive: true, force: true });+ await rm(engineSrcDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}await mkdir(engineSrcDir, { recursive: true });@@ -212,7 +212,7 @@ async function packageCmake(manifest) {log('Extracting cmake...');if (fs.existsSync(cmakeDir)) {- await rm(cmakeDir, { recursive: true, force: true });+ await rm(cmakeDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}await mkdir(path.join(cmakeDir, 'bin'), { recursive: true });@@ -254,7 +254,7 @@ async function packageCmake(manifest) {const cmakeSize = await dirSize(cmakeDir);log(` cmake size: ${formatSize(cmakeSize)}`);} finally {- await rm(tmpDir, { recursive: true, force: true }).catch(() => {});+ await rm(tmpDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }).catch(() => {});}}diff --git a/build-tools/utils/desktopApp.js b/build-tools/utils/desktopApp.jsindex da7eaecec..e111f7d70 100644--- a/build-tools/utils/desktopApp.js+++ b/build-tools/utils/desktopApp.js@@ -95,7 +95,7 @@ export async function assembleDesktopApp(options) {// desktop the executable IS the identity, which is why the host reads its own// name rather than parsing a config (see desktop.cpp appName).const root = path.join(outDir, layout.root(app.name));- await rm(root, { recursive: true, force: true });+ await rm(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });const executable = path.join(root, layout.executable(app.name));await mkdir(path.dirname(executable), { recursive: true });diff --git a/build-tools/utils/gradleProject.js b/build-tools/utils/gradleProject.jsindex 830537fd2..244a597e8 100644--- a/build-tools/utils/gradleProject.js+++ b/build-tools/utils/gradleProject.js@@ -247,10 +247,10 @@ export async function emitAndroidGradleProject(contentDir, app, sources, icon) {// The generated half is rewritten wholesale so a re-export cannot inherit the// last one's assets, libraries or manifest. The build scripts are not in here:// they are the half the user owns.- await rm(path.join(mainDir, 'assets'), { recursive: true, force: true });- await rm(path.join(mainDir, 'jniLibs'), { recursive: true, force: true });- await rm(path.join(mainDir, 'java'), { recursive: true, force: true });- await rm(path.join(mainDir, 'res'), { recursive: true, force: true });+ await rm(path.join(mainDir, 'assets'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ await rm(path.join(mainDir, 'jniLibs'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ await rm(path.join(mainDir, 'java'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ await rm(path.join(mainDir, 'res'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await mkdir(assetsDir, { recursive: true });for (const entry of exported) {diff --git a/build-tools/utils/iosProject.js b/build-tools/utils/iosProject.jsindex 29cc66421..4d808b513 100644--- a/build-tools/utils/iosProject.js+++ b/build-tools/utils/iosProject.js@@ -77,10 +77,10 @@ export async function emitIosXcodeProject(contentDir, app, sources, deploymentTa// Rewritten wholesale so a re-export never inherits the last one's stale// slices, plist or object graph.- await rm(projectDir, { recursive: true, force: true });- await rm(appDir, { recursive: true, force: true });- await rm(frameworkDest, { recursive: true, force: true });- await rm(path.join(contentDir, ICON_CATALOG), { recursive: true, force: true });+ await rm(projectDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ await rm(appDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ await rm(frameworkDest, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ await rm(path.join(contentDir, ICON_CATALOG), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await cp(sources.xcframework, frameworkDest, { recursive: true });await mkdir(appDir, { recursive: true });diff --git a/desktop b/desktopindex 7f9022583..11f1b6d1b 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 7f902258343200e251ba4f60f1733cf7637968a0+Subproject commit 11f1b6d1b4f39b70836721d47df66b70720dfb95diff --git a/pipeline/bin/estella.mjs b/pipeline/bin/estella.mjsindex 42ecd2748..80949a8f8 100644--- a/pipeline/bin/estella.mjs+++ b/pipeline/bin/estella.mjs@@ -133,7 +133,7 @@ async function loadPipeline(entry, outName) {+ `const require = __esCreateRequire('${fileUrl(path.join(PIPELINE, 'package.json'))}');\n`,},});- const cleanup = () => rmSync(dir, { recursive: true, force: true });+ const cleanup = () => rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });try {// Cleaned up on the way out even when the bundle will not load: the temp dir// lives inside `pipeline/src`, so one left behind is a copy of half thediff --git a/pipeline/src/assets/videoCook.ts b/pipeline/src/assets/videoCook.tsindex 67c19c0f3..9e650b5d6 100644--- a/pipeline/src/assets/videoCook.ts+++ b/pipeline/src/assets/videoCook.ts@@ -153,7 +153,7 @@ export async function transcodeVideoForWasm(warnings.push(`ffmpeg failed to run: ${err instanceof Error ? err.message : String(err)}`);return { esv: null, audio: null, warnings };} finally {- await rm(tmp, { recursive: true, force: true });+ await rm(tmp, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}diff --git a/pipeline/src/bundle/buildCompiledSystems.ts b/pipeline/src/bundle/buildCompiledSystems.tsindex 1fa553643..c4ac1e765 100644--- a/pipeline/src/bundle/buildCompiledSystems.ts+++ b/pipeline/src/bundle/buildCompiledSystems.ts@@ -269,7 +269,7 @@ export async function buildCompiledSystems(const c = emitC(lowered.module, layout, inlined, plan.addressBytes);const dir = path.join(root, CACHE_DIR);- rmSync(dir, { recursive: true, force: true });+ rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(dir, { recursive: true });writeFileSync(path.join(dir, 'estella_abi.h'), c.header);writeFileSync(path.join(dir, 'estella_offsets.h'), c.offsets);diff --git a/pipeline/src/export/exportMiniGame.ts b/pipeline/src/export/exportMiniGame.tsindex f2b25ff0e..4bf699168 100644--- a/pipeline/src/export/exportMiniGame.ts+++ b/pipeline/src/export/exportMiniGame.ts@@ -442,7 +442,7 @@ export async function exportMiniGame(profile: MiniGameExportProfile, opts: {// project.private.config.json, so we don't wipe the whole tree.progress({ phase: 'Copying runtime' });const wasmOut = path.join(absOut, 'wasm');- await rm(wasmOut, { recursive: true, force: true });+ await rm(wasmOut, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await mkdir(wasmOut, { recursive: true });// Engine artifacts only — the project's own come from `.esengine/modules/`,// not from the engine runtime dir, and are staged below.diff --git a/pipeline/src/export/exportPlayable.ts b/pipeline/src/export/exportPlayable.tsindex ab443e266..36d944089 100644--- a/pipeline/src/export/exportPlayable.ts+++ b/pipeline/src/export/exportPlayable.ts@@ -353,7 +353,7 @@ export async function exportPlayable(opts: {const outFile = path.join(absOut, 'index.html');span('game-bundle.js', bundle);await writeFile(outFile, indexHtml(title, globals, bundle, network));- await rm(cookDir, { recursive: true, force: true });+ await rm(cookDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });const htmlBytes = (await stat(outFile)).size;// The page, plus the JSON scaffolding around the spans. Derived rather thandiff --git a/pipeline/src/export/nativeTemplates.ts b/pipeline/src/export/nativeTemplates.tsindex 25e7c0a77..956da2f4e 100644--- a/pipeline/src/export/nativeTemplates.ts+++ b/pipeline/src/export/nativeTemplates.ts@@ -129,7 +129,7 @@ export function installNativeTemplate(zipPath: string, engineVersion: string): I}const dest = installedTemplateDir(manifest.engineVersion, manifest.platform, store);- rmSync(dest, { recursive: true, force: true });+ rmSync(dest, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(path.dirname(dest), { recursive: true });renameSync(staging, dest);return {@@ -142,7 +142,7 @@ export function installNativeTemplate(zipPath: string, engineVersion: string): I} catch (err) {return { ok: false, error: err instanceof Error ? err.message : String(err) };} finally {- rmSync(staging, { recursive: true, force: true });+ rmSync(staging, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}@@ -236,7 +236,7 @@ async function downloadFrom(} catch (err) {return { ok: false, error: err instanceof Error ? err.message : String(err) };} finally {- rmSync(staging, { recursive: true, force: true });+ rmSync(staging, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}@@ -245,6 +245,6 @@ async function downloadFrom(export function removeNativeTemplate(platform: TemplatePlatform, engineVersion: string): boolean {const dir = installedTemplateDir(engineVersion, platform);if (!readTemplateManifest(dir)) return false;- rmSync(dir, { recursive: true, force: true });+ rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });return true;}diff --git a/pipeline/tests/addressable-manifest.test.ts b/pipeline/tests/addressable-manifest.test.tsindex 2b4dd9b92..e6b4dffae 100644--- a/pipeline/tests/addressable-manifest.test.ts+++ b/pipeline/tests/addressable-manifest.test.ts@@ -46,7 +46,7 @@ describe('buildAddressableManifest — texture import settings', () => {dir = await mkdtemp(path.join(tmpdir(), 'estella-manifest-'));});afterEach(async () => {- await rm(dir, { recursive: true, force: true });+ await rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});const build = async (entries: unknown[]): Promise<AddressableManifest> => {diff --git a/pipeline/tests/aot-end-to-end.test.ts b/pipeline/tests/aot-end-to-end.test.tsindex 0ad7daf5f..66c5868c6 100644--- a/pipeline/tests/aot-end-to-end.test.ts+++ b/pipeline/tests/aot-end-to-end.test.ts@@ -161,7 +161,7 @@ describe('a project that promised compilation gets it', () => {beforeAll(async () => {if (!EMCC) return;- rmSync(PROJECT, { recursive: true, force: true });+ rmSync(PROJECT, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(path.join(PROJECT, 'src'), { recursive: true });writeFileSync(path.join(PROJECT, 'src', 'move.ts'), SOURCE);built = await buildCompiledSystems(PROJECT, { mode: 'release', cc: EMCC, run });@@ -171,7 +171,7 @@ describe('a project that promised compilation gets it', () => {fixture = await import(/* @vite-ignore */pathToFileURL(path.join(PROJECT, 'src', 'move.ts')).href) as unknown as Fixture;- rmSync(PROBE, { recursive: true, force: true });+ rmSync(PROBE, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(path.join(PROBE, 'src'), { recursive: true });writeFileSync(path.join(PROBE, 'src', 'move.ts'), PROBE_SOURCE);probe = await buildCompiledSystems(PROBE, { mode: 'release', cc: EMCC, run });diff --git a/pipeline/tests/asset-db-incremental.test.ts b/pipeline/tests/asset-db-incremental.test.tsindex 905c48af4..1b88b9eb6 100644--- a/pipeline/tests/asset-db-incremental.test.ts+++ b/pipeline/tests/asset-db-incremental.test.ts@@ -54,7 +54,7 @@ beforeEach(() => {});afterEach(() => {- if (root) rmSync(root, { recursive: true, force: true });+ if (root) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});/** Assert an incremental update equals a full rescan of the same on-disk state. */@@ -175,7 +175,7 @@ describe('updateAssetIndex — fallbacks (never silent)', () => {it('a removed directory that held assets falls back (its child moves are invisible)', async () => {const { index: prev } = await scanAssetDatabase(root, { write: false });// Simulate the dir vanishing (the watcher may report only the dir path).- rmSync(path.join(root, 'assets/fonts'), { recursive: true });+ rmSync(path.join(root, 'assets/fonts'), { recursive: true, maxRetries: 10, retryDelay: 50 });const inc = await updateAssetIndex(root, prev, ['assets/fonts'], { write: false });expect(inc.fullRescan).toBe(true);expect(inc.reason).toContain('directory');diff --git a/pipeline/tests/asset-db.test.ts b/pipeline/tests/asset-db.test.tsindex 3cbc5f420..ecc5c8c2a 100644--- a/pipeline/tests/asset-db.test.ts+++ b/pipeline/tests/asset-db.test.ts@@ -59,7 +59,7 @@ beforeAll(() => {});afterAll(() => {- if (root) rmSync(root, { recursive: true, force: true });+ if (root) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});describe('scanAssetDatabase (A2)', () => {diff --git a/pipeline/tests/asset-symlink-escape.test.ts b/pipeline/tests/asset-symlink-escape.test.tsindex b594cc343..348863563 100644--- a/pipeline/tests/asset-symlink-escape.test.ts+++ b/pipeline/tests/asset-symlink-escape.test.ts@@ -41,7 +41,7 @@ function canSymlinkFiles(): boolean {} catch {return false;} finally {- rmSync(dir, { recursive: true, force: true });+ rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}@@ -99,7 +99,7 @@ describe('a link out of the project reaches neither the index nor the build', ()expect(paths).not.toContain('assets/textures/adopted.png');expect(paths).not.toContain('assets/textures/sidecar.png');} finally {- rmSync(base, { recursive: true, force: true });+ rmSync(base, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -114,7 +114,7 @@ describe('a link out of the project reaches neither the index nor the build', ()const { index } = await scanAssetDatabase(root, { write: false, adopt: true });expect(index.entries.map((e) => e.path).some((p) => p.includes('deep'))).toBe(false);} finally {- rmSync(base, { recursive: true, force: true });+ rmSync(base, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -136,7 +136,7 @@ describe('a link out of the project reaches neither the index nor the build', ()const manifest = path.join(out, 'assets.manifest.json');if (existsSync(manifest)) expect(readFileSync(manifest, 'utf8')).not.toContain(SECRET);} finally {- rmSync(base, { recursive: true, force: true });+ rmSync(base, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -153,7 +153,7 @@ describe('a link out of the project reaches neither the index nor the build', ()expect(paths).toContain('assets/textures/real.png');expect(paths).toContain('assets/textures/alias.png');} finally {- rmSync(base, { recursive: true, force: true });+ rmSync(base, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});});diff --git a/pipeline/tests/build-scripts.test.ts b/pipeline/tests/build-scripts.test.tsindex 8bbaae44c..4d3552499 100644--- a/pipeline/tests/build-scripts.test.ts+++ b/pipeline/tests/build-scripts.test.ts@@ -33,7 +33,7 @@ beforeAll(() => {});afterAll(() => {- if (root) rmSync(root, { recursive: true, force: true });+ if (root) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});describe('buildProjectScripts (E8-1)', () => {@@ -87,7 +87,7 @@ describe('buildProjectScripts (E8-1)', () => {expect(out).toContain('DemoService'); // the package's code is IN the bundleexpect(out).toMatch(/from\s*["']esengine["']/); // …and its engine import is not} finally {- rmSync(proj, { recursive: true, force: true });+ rmSync(proj, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -99,7 +99,7 @@ describe('buildProjectScripts (E8-1)', () => {expect(res.outputPath).toBeNull();expect(res.errors.join(' ')).toMatch(/entry not found/);} finally {- rmSync(empty, { recursive: true, force: true });+ rmSync(empty, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});});diff --git a/pipeline/tests/cook-assets.test.ts b/pipeline/tests/cook-assets.test.tsindex 8aa23e15d..3d04e66c0 100644--- a/pipeline/tests/cook-assets.test.ts+++ b/pipeline/tests/cook-assets.test.ts@@ -57,7 +57,7 @@ beforeAll(() => {});afterAll(() => {- if (root) rmSync(root, { recursive: true, force: true });+ if (root) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});/** A solid RGBA PNG of an exact size — block alignment is a cook decision, so a@@ -155,7 +155,7 @@ describe('cookAssets (A4)', () => {expect(h('t/a.png')).toBe(h('t/b.png')); // identical content → one physical identityexpect(h('t/a.png')).not.toBe(h('t/c.png')); // different content → different identity} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -195,7 +195,7 @@ describe('cookAssets (A4)', () => {expect(existsSync(path.join(res.outDir, byUuid(A).path))).toBe(true);expect(existsSync(path.join(res.outDir, byUuid(C).path))).toBe(true);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -230,7 +230,7 @@ describe('cookAssets (A4)', () => {const magic = [0xab, 0x4b, 0x54, 0x58, 0x20, 0x32, 0x30, 0xbb, 0x0d, 0x0a, 0x1a, 0x0a];expect(magic.every((b, i) => bytes[i] === b)).toBe(true);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 30_000);@@ -256,7 +256,7 @@ describe('cookAssets (A4)', () => {expect(tex.path).toMatch(/\.png$/); // NOT .ktx2 — the asset opted outexpect(tex.compressedFormats).toBeUndefined();} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 30_000);@@ -285,7 +285,7 @@ describe('cookAssets (A4)', () => {expect(Math.max(shrunk.width, shrunk.height)).toBeLessThanOrEqual(64);expect(Math.max(shrunk.width, shrunk.height)).toBeGreaterThan(32); // scaled to fit, not over-shrunk} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 30_000);@@ -312,7 +312,7 @@ describe('cookAssets (A4)', () => {expect(tex.compressedFormats).toBeUndefined();expect(res.warnings.some((w) => w.includes('70x70') && w.includes('multiple of 4'))).toBe(true);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -346,7 +346,7 @@ describe('cookAssets (A4)', () => {const shrunk = decodePngImage('wx', readFileSync(path.join(wechat.outDir, wx.path)));expect(Math.max(shrunk.width, shrunk.height)).toBeLessThanOrEqual(64); // …downscaled to its cap} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 30_000);@@ -406,7 +406,7 @@ describe('cookAssets (A4)', () => {expect(stagedMat.properties.u_mask).toBe('assets/materials/green.png');expect(stagedMat.properties.u_mode).toBe('additive');} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -435,7 +435,7 @@ describe('cookAssets (A4)', () => {const res = await cookAssets(r, { entryScenes: ['s/main.esscene'], outDir: 'out' });expect(res.included.sort()).toEqual([SC, CLIP, FRAME].sort());} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});});@@ -503,7 +503,7 @@ describe('cookAssets — auto-atlas (<name>.atlas folder convention)', () => {expect(at(a.atlas!.frame)).toEqual([255, 0, 0, 255]);expect(at(b.atlas!.frame)).toEqual([0, 255, 0, 255]);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -518,7 +518,7 @@ describe('cookAssets — auto-atlas (<name>.atlas folder convention)', () => {expect(a.path).toBe('assets/sprites/heroes.atlas/a.png');expect(a.atlas).toBeUndefined();} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -539,7 +539,7 @@ describe('cookAssets — auto-atlas (<name>.atlas folder convention)', () => {expect(a.sourcePath).toBe('assets/sprites/heroes.atlas/a.png');expect(existsSync(path.join(res.outDir, a.path))).toBe(true);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});});diff --git a/pipeline/tests/cooked-verify-fixture.test.ts b/pipeline/tests/cooked-verify-fixture.test.tsindex 876076879..d4ab0c28c 100644--- a/pipeline/tests/cooked-verify-fixture.test.ts+++ b/pipeline/tests/cooked-verify-fixture.test.ts@@ -75,8 +75,8 @@ addSystem(driftSystem);describe.skipIf(!process.env.ESTELLA_COOK_FIXTURE)('cooked-verify fixture', () => {it('cooks a content-addressed build: green KTX2 sprite + path-ref material chain', async () => {- rmSync(SRC, { recursive: true, force: true });- rmSync(OUT, { recursive: true, force: true });+ rmSync(SRC, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ rmSync(OUT, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(path.join(SRC, 'assets'), { recursive: true });copyFileSync(path.resolve(HERE, '..', '..', 'fixtures', 'scenes', 'ktx2-test', 'green.ktx2'),diff --git a/pipeline/tests/document-ref-cook-deps.test.ts b/pipeline/tests/document-ref-cook-deps.test.tsindex ab75846d0..e187283f1 100644--- a/pipeline/tests/document-ref-cook-deps.test.ts+++ b/pipeline/tests/document-ref-cook-deps.test.ts@@ -97,7 +97,7 @@ beforeAll(() => {});afterAll(() => {- if (root) rmSync(root, { recursive: true, force: true });+ if (root) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});describe('assets named only inside another document are cooked', () => {@@ -176,7 +176,7 @@ describe('assets named only inside another document are cooked', () => {expect(staged).toContain('builtin:cube');} finally {root = prev;- rmSync(lone, { recursive: true, force: true });+ rmSync(lone, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});@@ -202,7 +202,7 @@ describe('assets named only inside another document are cooked', () => {expect(res.warnings.some((w) => /gone\.esenv: names 'nowhere\.png'/.test(w))).toBe(true);} finally {root = prev;- rmSync(lone, { recursive: true, force: true });+ rmSync(lone, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}});});diff --git a/pipeline/tests/export-compiled-systems.test.ts b/pipeline/tests/export-compiled-systems.test.tsindex 196174e65..4dce9d82c 100644--- a/pipeline/tests/export-compiled-systems.test.ts+++ b/pipeline/tests/export-compiled-systems.test.ts@@ -120,7 +120,7 @@ describe('what a package carries for a compiled system', () => {expect(existsSync(path.join(f.out, cfg.aot!.module))).toBe(true);expect(cfg.aot?.manifest.systems.map((s) => s.name)).toEqual(['ExportDriftSystem']);expect(cfg.aot?.manifest.engineAbi).toMatch(/^[0-9a-f]{16}$/);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 120_000);it.skipIf(!EMCC)('fails the export when a promise cannot be kept, and says where', async () => {@@ -130,7 +130,7 @@ describe('what a package carries for a compiled system', () => {expect(res.ok).toBe(false);expect(res.errors.join('\n')).toMatch(/main\.ts:\d+:.*ExportDriftSystem is @compiled/);expect(existsSync(path.join(f.out, 'aot', 'systems.wasm'))).toBe(false);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 120_000);it.skipIf(!EMCC)('a mini-game carries it too, and boots from the path', async () => {@@ -145,7 +145,7 @@ describe('what a package carries for a compiled system', () => {const boot = readFileSync(path.join(f.out, 'game-bundle.js'), 'utf8');expect(boot).toContain('aot/systems.wasm');expect(boot).toContain('ExportDriftSystem');- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 120_000);it('carries nothing for a project that promised nothing', async () => {@@ -157,6 +157,6 @@ describe('what a package carries for a compiled system', () => {// this pays nothing for it, on a machine that may have no toolchain at all.expect(config(f.out).aot).toBeUndefined();expect(existsSync(path.join(f.out, 'aot'))).toBe(false);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 120_000);});diff --git a/pipeline/tests/export-desktop.test.ts b/pipeline/tests/export-desktop.test.tsindex 6cd68f3a1..348d7bdf2 100644--- a/pipeline/tests/export-desktop.test.ts+++ b/pipeline/tests/export-desktop.test.ts@@ -46,7 +46,7 @@ beforeAll(async () => {out = path.join(root, 'dist-desktop');}, 60_000);-afterAll(() => rmSync(root, { recursive: true, force: true }));+afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));/** A template with the files the assembler reads. What is under test is the EXPORT* reaching the assembler; the assembler itself is pinned in desktop-app.test.ts. */diff --git a/pipeline/tests/export-native.test.ts b/pipeline/tests/export-native.test.tsindex 734e889f0..687ddb81b 100644--- a/pipeline/tests/export-native.test.ts+++ b/pipeline/tests/export-native.test.ts@@ -45,7 +45,7 @@ beforeAll(async () => {out = path.join(root, 'dist-android');}, 60_000);-afterAll(() => rmSync(root, { recursive: true, force: true }));+afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));describe('exportGame (native app content)', () => {it('ships content only — cooked assets, manifests, scene, config', async () => {diff --git a/pipeline/tests/export-playable.test.ts b/pipeline/tests/export-playable.test.tsindex 260d6814e..aaa272353 100644--- a/pipeline/tests/export-playable.test.ts+++ b/pipeline/tests/export-playable.test.ts@@ -83,7 +83,7 @@ export function packagedRuntimeInit(c){return c;}\n`);out = path.join(root, 'dist-playable');}, 60_000);-afterAll(() => rmSync(root, { recursive: true, force: true }));+afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));describe('exportGame (playable)', () => {it('produces one self-contained index.html with everything inlined', async () => {@@ -356,7 +356,7 @@ export function packagedRuntimeInit(c){return c;}\n`);expect(html).toMatch(/"physicsEnabled":true/);expect(html).toMatch(/"y":-20/);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 60_000);@@ -370,7 +370,7 @@ export function packagedRuntimeInit(c){return c;}\n`);expect(html).toContain('"physics"');expect(inlinedText(html, '__SIDE_MODULES__', (v) => v['physics'].wasm)).toBe('PHYSWASM');} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 60_000);@@ -381,7 +381,7 @@ export function packagedRuntimeInit(c){return c;}\n`);expect(res.ok).toBe(false);expect(res.errors.join('\n')).toMatch(/physics/);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 60_000);});@@ -448,7 +448,7 @@ export function packagedRuntimeInit(c){return c;}\n`);// The atlas page image is embedded + path-mapped (the dep the cook now follows).expect(html).toMatch(/"assets\/spine\/hero\.png":"@uuid:/);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 60_000);@@ -459,7 +459,7 @@ export function packagedRuntimeInit(c){return c;}\n`);expect(res.ok).toBe(false);expect(res.errors.join('\n')).toMatch(/spine/i);} finally {- rmSync(r, { recursive: true, force: true });+ rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}, 60_000);});diff --git a/pipeline/tests/export-progress.test.ts b/pipeline/tests/export-progress.test.tsindex c44a05807..f1ea0897b 100644--- a/pipeline/tests/export-progress.test.ts+++ b/pipeline/tests/export-progress.test.ts@@ -38,7 +38,7 @@ beforeAll(() => {writeFileSync(path.join(root, '_wasm', 'esengine.wasm'), 'wasmbytes');}, 60_000);-afterAll(() => rmSync(root, { recursive: true, force: true }));+afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));describe('export progress', () => {it('emits a phase per major step (web)', async () => {diff --git a/pipeline/tests/export-project-platform.test.ts b/pipeline/tests/export-project-platform.test.tsindex bb8c2f8a8..55443031d 100644--- a/pipeline/tests/export-project-platform.test.ts+++ b/pipeline/tests/export-project-platform.test.ts@@ -81,7 +81,7 @@ export default {out = path.join(root, 'dist-acme');}, 60_000);-afterAll(() => rmSync(root, { recursive: true, force: true }));+afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));describe('exportGame — a platform the project defines', () => {it('packages through the mini-game pipeline and joins the vendor\'s two halves', async () => {diff --git a/pipeline/tests/export-side-modules.test.ts b/pipeline/tests/export-side-modules.test.tsindex 733a8df54..f0fbec2dd 100644--- a/pipeline/tests/export-side-modules.test.ts+++ b/pipeline/tests/export-side-modules.test.ts@@ -73,14 +73,14 @@ describe('web package side modules', () => {expect(existsSync(path.join(f.out, 'wasm', 'esengine.wasm'))).toBe(true);expect(existsSync(path.join(f.out, 'wasm', 'esengine.js'))).toBe(true);expect(existsSync(path.join(f.out, 'wasm', 'wasm.manifest.json'))).toBe(true);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);it('carries the 2D solver for a scene with a body', async () => {const f = setup({ version: '1.0', name: 'Main', entities: entities({ type: 'RigidBody2D', data: { bodyType: 1 } }) });try {expect(shipped((await run(f), f.out))).toEqual(['physics']);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);it('carries the 2D solver a project declares but no scene uses', async () => {@@ -88,7 +88,7 @@ describe('web package side modules', () => {try {await run(f, runtimeConfigOf({ features: { physics: { enabled: true } } }));expect(shipped(f.out)).toEqual(['physics']);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);it('carries the 3D solver for a 3D body, and never implies it from the 2D flag', async () => {@@ -96,7 +96,7 @@ describe('web package side modules', () => {try {await run(f);expect(shipped(f.out)).toEqual(['physics3d']);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);// Joints and mesh colliders are 3D physics components like the bodies are;@@ -106,7 +106,7 @@ describe('web package side modules', () => {try {await run(f);expect(shipped(f.out)).toEqual(['physics3d']);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);it('carries the 3D solver for a mesh collider', async () => {@@ -114,7 +114,7 @@ describe('web package side modules', () => {try {await run(f);expect(shipped(f.out)).toEqual(['physics3d']);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);// The runtime expands prefabs before it asks whether the scene needs physics,@@ -135,7 +135,7 @@ describe('web package side modules', () => {const res = await run(f);expect(res.errors).toEqual([]);expect(shipped(f.out)).toEqual(['physics']);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);it('fails the export when the content needs a module the wasm dir has not built', async () => {@@ -145,6 +145,6 @@ describe('web package side modules', () => {const res = await run(f);expect(res.ok).toBe(false);expect(res.errors.join('\n')).toMatch(/physics3d/);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);});diff --git a/pipeline/tests/export-source-maps.test.ts b/pipeline/tests/export-source-maps.test.tsindex bc25cf683..e9032f71c 100644--- a/pipeline/tests/export-source-maps.test.ts+++ b/pipeline/tests/export-source-maps.test.ts@@ -60,7 +60,7 @@ describe('source maps in a web package', () => {// Stripping the comment is all it does to the script.expect(readFileSync(path.join(f.out, 'sdk', 'index.js'), 'utf8')).toContain('export const x = 1;');expect(existsSync(path.join(f.out, 'game.js.map'))).toBe(false);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);it('ships them when the build asks for them', async () => {@@ -73,6 +73,6 @@ describe('source maps in a web package', () => {expect(readFileSync(path.join(f.out, 'sdk', 'index.js'), 'utf8')).toContain('sourceMappingURL');// The export's own bundles answer the same question the same way.expect(existsSync(path.join(f.out, 'game.js.map'))).toBe(true);- } finally { rmSync(f.root, { recursive: true, force: true }); }+ } finally { rmSync(f.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }}, 60_000);});diff --git a/pipeline/tests/export-wechat.test.ts b/pipeline/tests/export-wechat.test.tsindex a4619eb5d..439479506 100644--- a/pipeline/tests/export-wechat.test.ts+++ b/pipeline/tests/export-wechat.test.ts@@ -51,7 +51,7 @@ beforeAll(() => {out = path.join(root, 'dist-wechat');}, 60_000);-afterAll(() => rmSync(root, { recursive: true, force: true }));+afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));describe('exportGame (wechat)', () => {it('assembles a MiniGame matching the initWeChatRuntime contract', async () => {@@ -200,7 +200,7 @@ describe('exportGame (wechat)', () => {// in the package and the glue has to be require()d by the generated entry.it("packages a project's own native module and requires it from game.js", async () => {const modDir = path.join(root, '.esengine', 'modules', 'rive');- rmSync(path.join(root, '.esengine'), { recursive: true, force: true });+ rmSync(path.join(root, '.esengine'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(path.join(modDir, 'wechat'), { recursive: true });writeFileSync(path.join(modDir, 'module.json'), JSON.stringify({ file: 'rive', globalName: 'RiveModule' }));// `?.` is exactly what a real-device host rejects — it must not survive.@@ -236,14 +236,14 @@ describe('exportGame (wechat)', () => {// Down-levelled like the engine's own glue.expect(readFileSync(path.join(outWx, 'wasm', 'rive.js'), 'utf8')).not.toContain('?.');- rmSync(path.join(root, '.esengine'), { recursive: true, force: true });+ rmSync(path.join(root, '.esengine'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}, 60_000);it('refuses to substitute a web build for a mini-game one', async () => {// Serving the web glue would produce a package that builds clean and dies on// a device — the failure this whole per-platform layout exists to prevent.const modDir = path.join(root, '.esengine', 'modules', 'rive');- rmSync(path.join(root, '.esengine'), { recursive: true, force: true });+ rmSync(path.join(root, '.esengine'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(path.join(modDir, 'web'), { recursive: true });writeFileSync(path.join(modDir, 'web', 'rive.js'), 'export default () => Promise.resolve({});');@@ -263,7 +263,7 @@ describe('exportGame (wechat)', () => {expect(existsSync(path.join(outWx, 'wasm', 'rive.js'))).toBe(false);expect(readFileSync(path.join(outWx, 'game.js'), 'utf8')).not.toContain('rive');- rmSync(path.join(root, '.esengine'), { recursive: true, force: true });+ rmSync(path.join(root, '.esengine'), { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}, 60_000);it('fails fast when the -t wechat engine runtime is missing', async () => {@@ -557,7 +557,7 @@ describe('exportGame (wechat) — open data context', () => {platform: 'wechat',});- afterAll(() => { for (const r of roots) rmSync(r, { recursive: true, force: true }); });+ afterAll(() => { for (const r of roots) rmSync(r, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); });it('a project without one declares no context — an absent directory would fail the host compile', async () => {const { root: r, out: o } = scaffold();diff --git a/pipeline/tests/hotupdate-verify-fixture.test.ts b/pipeline/tests/hotupdate-verify-fixture.test.tsindex 49a3246d9..3c30d878c 100644--- a/pipeline/tests/hotupdate-verify-fixture.test.ts+++ b/pipeline/tests/hotupdate-verify-fixture.test.ts@@ -37,7 +37,7 @@ const opts = (root: string, outDir: string) => ({describe.skipIf(!process.env.ESTELLA_HOTUPDATE_FIXTURE)('hot-update verify fixture', () => {it('cooks a shipped build (green CDN art) + a CDN update (red CDN art)', async () => {- rmSync(ROOT, { recursive: true, force: true });+ rmSync(ROOT, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });// 1. Ship build: the example exactly as committed — green art in remote/cdn/.const build = await exportGame(opts(EXAMPLE, BUILD));diff --git a/pipeline/tests/native-template.test.ts b/pipeline/tests/native-template.test.tsindex 439bfa629..623b2bde9 100644--- a/pipeline/tests/native-template.test.ts+++ b/pipeline/tests/native-template.test.ts@@ -43,7 +43,7 @@ beforeEach(() => {afterEach(() => {delete process.env.ESTELLA_NATIVE_TEMPLATES;- rmSync(scratch, { recursive: true, force: true });+ rmSync(scratch, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});/** Every file the layout declares required, with a stand-in body — so the fixturediff --git a/pipeline/tests/platform-catalog.test.ts b/pipeline/tests/platform-catalog.test.tsindex b37adb167..6dce1bac1 100644--- a/pipeline/tests/platform-catalog.test.ts+++ b/pipeline/tests/platform-catalog.test.ts@@ -55,7 +55,7 @@ beforeEach(() => {afterEach(() => {delete process.env.ESTELLA_NATIVE_TEMPLATES;- rmSync(root, { recursive: true, force: true });+ rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});describe('listPlatforms — built-in readiness is probed', () => {diff --git a/pipeline/tests/project-modules.test.ts b/pipeline/tests/project-modules.test.tsindex beb103a54..7031dccbd 100644--- a/pipeline/tests/project-modules.test.ts+++ b/pipeline/tests/project-modules.test.ts@@ -43,7 +43,7 @@ async function writeModule(id: string, opts: {}beforeEach(async () => { root = await mkdtemp(path.join(tmpdir(), 'es-modules-')); });-afterEach(async () => { await rm(root, { recursive: true, force: true }); });+afterEach(async () => { await rm(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); });describe('discovery', () => {it('finds nothing in a project that declares nothing', async () => {@@ -87,7 +87,7 @@ describe('discovery', () => {it('lets a project vendor use its own directory, else the wechat build', async () => {await writeModule('rive', { builds: { wechat: ['rive.js'], 'acme-play': ['rive.js'] } });expect((await loadProjectModules(root, 'acme-play'))[0].buildDir).toContain('acme-play');- await rm(path.join(root, PROJECT_MODULES_DIR, 'rive', 'acme-play'), { recursive: true });+ await rm(path.join(root, PROJECT_MODULES_DIR, 'rive', 'acme-play'), { recursive: true, maxRetries: 10, retryDelay: 50 });expect((await loadProjectModules(root, 'acme-play'))[0].buildDir).toContain('wechat');});});@@ -118,7 +118,7 @@ describe('declarations', () => {describe('staging', () => {let out: string;beforeEach(async () => { out = await mkdtemp(path.join(tmpdir(), 'es-wasm-')); });- afterEach(async () => { await rm(out, { recursive: true, force: true }); });+ afterEach(async () => { await rm(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); });it('puts glue and binary where every transport already looks', async () => {await writeModule('rive', { builds: { web: ['rive.js', 'rive.wasm'] } });diff --git a/pipeline/tests/size-report.test.ts b/pipeline/tests/size-report.test.tsindex f94e812b3..5eb6de6e5 100644--- a/pipeline/tests/size-report.test.ts+++ b/pipeline/tests/size-report.test.ts@@ -195,7 +195,7 @@ describe('budgets', () => {describe('measuring a build on disk', () => {let dir: string;beforeEach(async () => { dir = await mkdtemp(path.join(tmpdir(), 'es-size-')); });- afterEach(async () => { await rm(dir, { recursive: true, force: true }); });+ afterEach(async () => { await rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); });const write = async (rel: string, bytes: number): Promise<void> => {const abs = path.join(dir, rel);diff --git a/pipeline/tests/spine-cook-deps.test.ts b/pipeline/tests/spine-cook-deps.test.tsindex 9dff8d8fe..183769b50 100644--- a/pipeline/tests/spine-cook-deps.test.ts+++ b/pipeline/tests/spine-cook-deps.test.ts@@ -59,7 +59,7 @@ beforeAll(() => {});afterAll(() => {- if (root) rmSync(root, { recursive: true, force: true });+ if (root) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});describe('spine atlas page images are cooked dependencies', () => {diff --git a/pipeline/tests/target-support.test.ts b/pipeline/tests/target-support.test.tsindex 677db633e..85e3740a0 100644--- a/pipeline/tests/target-support.test.ts+++ b/pipeline/tests/target-support.test.ts@@ -130,7 +130,7 @@ describe('exportGame warns about content the target cannot render', () => {writeFileSync(path.join(root, '_wasm', 'esengine.js'), 'export default () => {};');});- afterAll(() => rmSync(root, { recursive: true, force: true }));+ afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));const run = (platform: 'android' | 'web', outDir: string) => exportGame({root, entryScene: 'scenes/main.esscene', gameHostEntry: GAME_HOST,diff --git a/pipeline/tests/tilemap-cook-deps.test.ts b/pipeline/tests/tilemap-cook-deps.test.tsindex b36c72371..000b2e7a0 100644--- a/pipeline/tests/tilemap-cook-deps.test.ts+++ b/pipeline/tests/tilemap-cook-deps.test.ts@@ -53,7 +53,7 @@ beforeAll(() => {});afterAll(() => {- if (root) rmSync(root, { recursive: true, force: true });+ if (root) rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});describe('tilemap tileset images are cooked dependencies', () => {diff --git a/sdk/tests/content-cache.test.ts b/sdk/tests/content-cache.test.tsindex d2f5cefac..acdbf8972 100644--- a/sdk/tests/content-cache.test.ts+++ b/sdk/tests/content-cache.test.ts@@ -77,7 +77,7 @@ describe('node adapter disk cache (real filesystem)', () => {beforeEach(() => { process.env.ESENGINE_CACHE_DIR = dir; });afterEach(async () => {delete process.env.ESENGINE_CACHE_DIR;- await rm(dir, { recursive: true, force: true });+ await rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });});it('round-trips bytes through the filesystem, misses on an absent key', async () => {diff --git a/tools/check-headless-export.mjs b/tools/check-headless-export.mjsindex 04b8c1029..c4adb902a 100644--- a/tools/check-headless-export.mjs+++ b/tools/check-headless-export.mjs@@ -40,7 +40,7 @@ for (const name of ['esengine.js', 'esengine.wasm']) writeFileSync(path.join(wasfunction fail(message, detail) {console.error(`check-headless-export: ${message}`);if (detail) console.error(detail);- rmSync(work, { recursive: true, force: true });+ rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });process.exit(1);}@@ -63,5 +63,5 @@ if (!result.ok) fail('the export reported failure.', result.errors?.join('\n'));const missing = EXPECTED.filter((name) => !existsSync(path.join(out, name)));if (missing.length > 0) fail(`the package is missing ${missing.join(', ')}.`);-rmSync(work, { recursive: true, force: true });+rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });console.log(`check-headless-export: ${path.basename(PROJECT)} packaged for web from the command line — ${EXPECTED.length} artifact(s) present.`);diff --git a/tools/check-native-bindings.mjs b/tools/check-native-bindings.mjsindex c3fc22544..e280d3f30 100644--- a/tools/check-native-bindings.mjs+++ b/tools/check-native-bindings.mjs@@ -57,7 +57,7 @@ try {} catch (e) {console.error('EHT failed to generate the native entry-point bindings:');console.error(String(e.stderr || e.stdout || e.message));- rmSync(out, { recursive: true, force: true });+ rmSync(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });process.exit(1);}@@ -69,7 +69,7 @@ const includes = [...text.matchAll(/^#include\s+"([^"]+)"/gm)].map((m) => m[1])for (const inc of includes) {if (!existsSync(path.join(SRC, inc))) fail(`generated #include does not resolve: ${inc}`);}-rmSync(out, { recursive: true, force: true });+rmSync(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });if (failed) process.exit(1);console.log(`native bindings OK: ${abs.length} headers, ${includes.length} generated include(s) resolve.`);diff --git a/tools/check-rm-retries.mjs b/tools/check-rm-retries.mjsnew file mode 100644index 000000000..2909b6069--- /dev/null+++ b/tools/check-rm-retries.mjs@@ -0,0 +1,62 @@+#!/usr/bin/env node+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file check-rm-retries.mjs — a recursive delete on Windows retries, or it is+ * a flake somebody will spend an afternoon on.+ *+ * Deleting on Windows is not synchronous at the filesystem level: an unlinked+ * file sits in a pending-delete state, its directory entry still there, and the+ * `rmdir` that follows sees a directory that is not empty. So a test that writes+ * a temp tree and removes it fails with `ENOTEMPTY` at random — on a machine+ * with an indexer or a virus scanner, often. It reads as a bug in whatever ran+ * last, which is how it costs an afternoon.+ *+ * Node retries exactly these errors, and `fs.rm` already carries the loop —+ * but `maxRetries` DEFAULTS TO 0, so every call written the obvious way has it+ * switched off. `force: true` does not help: that suppresses `ENOENT`, nothing+ * else. There were 133 such calls and not one set it.+ *+ * Only recursive removes are asked: `maxRetries` is ignored without `recursive`,+ * so requiring it there would be cargo.+ *+ * node tools/check-rm-retries.mjs+ */+import { readFileSync } from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { listTrackedSources } from './lib/sourceRoots.mjs';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const ROOTS = ['sdk', 'pipeline', 'tools', 'compiler', 'plugins', 'bench', 'build-tools', 'desktop'];++const { files, missing } = listTrackedSources(ROOTS);+const findings = [];++for (const rel of files) {+ if (!/\.(ts|tsx|mts|mjs|js)$/.test(rel)) continue;+ let text;+ try {+ text = readFileSync(path.join(ROOT, rel), 'utf8');+ } catch {+ continue;+ }+ if (!/\brm(Sync)?\(/.test(text)) continue;+ text.split('\n').forEach((line, i) => {+ if (!/\brm(Sync)?\(/.test(line)) return;+ if (!/recursive:\s*true/.test(line)) return;+ if (/maxRetries/.test(line)) return;+ findings.push(`${rel}:${i + 1} ${line.trim()}`);+ });+}++// A skipped root has to say so: silence there reads as a clean bill.+for (const m of missing) console.log(`not checked (no checkout): ${m}`);++if (findings.length) {+ console.error(`check-rm-retries: ${findings.length} recursive delete(s) with retries off.`);+ console.error('Add `maxRetries: 10, retryDelay: 50` — on Windows the rmdir races the unlink.');+ for (const f of findings) console.error(` ${f}`);+ process.exit(1);+}+console.log('check-rm-retries: every recursive delete retries.');diff --git a/tools/devicefarm/pack-test-bundle.mjs b/tools/devicefarm/pack-test-bundle.mjsindex 08c6b1d78..269ca7f36 100644--- a/tools/devicefarm/pack-test-bundle.mjs+++ b/tools/devicefarm/pack-test-bundle.mjs@@ -29,7 +29,7 @@ const STAGE = path.join(ROOT, 'build/devicefarm/bundle');* would quietly start shipping whatever lands in tools/ next. */const FILES = ['tools/verify-native-boot.mjs'];-rmSync(STAGE, { recursive: true, force: true });+rmSync(STAGE, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(path.join(STAGE, 'tools'), { recursive: true });for (const rel of FILES) {diff --git a/tools/gates.mjs b/tools/gates.mjsindex 9a03105c5..4fea59555 100644--- a/tools/gates.mjs+++ b/tools/gates.mjs@@ -225,6 +225,10 @@ export const GATES = [// authority claims, or a cross-language pin no fact names, is a compatibility// fact outside the compatibility system — the state EsEventOut was in.{ id: 'contract-inventory', run: 'node tools/contract-inventory.mjs' },+ // Windows deletes asynchronously: the rmdir races the unlink it just did, and+ // the temp tree a test made comes back ENOTEMPTY at random. Node's retry loop+ // is right there and defaults to OFF.+ { id: 'rm-retries', run: 'node tools/check-rm-retries.mjs' },{ id: 'examples', run: 'node build-tools/cli.js check-examples' },{ id: 'documents', run: 'node build-tools/cli.js validate-documents' },];diff --git a/tools/gen-shader-twins.mjs b/tools/gen-shader-twins.mjsindex cfc199694..3a4a8fd6d 100644--- a/tools/gen-shader-twins.mjs+++ b/tools/gen-shader-twins.mjs@@ -423,7 +423,7 @@ export async function processFile(module, file, opts) {await writeFile(file, source.trimEnd() + '\n' + twin, 'utf8');return { file, status: 'generated' };} finally {- await rm(workDir, { recursive: true, force: true });+ await rm(workDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}diff --git a/tools/perf-guard.mjs b/tools/perf-guard.mjsindex 448cdb6f1..1f083ef01 100644--- a/tools/perf-guard.mjs+++ b/tools/perf-guard.mjs@@ -146,7 +146,7 @@ try {}main(JSON.parse(readFileSync(out, 'utf8')));} finally {- rmSync(tmp, { recursive: true, force: true });+ rmSync(tmp, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}function main(report) {diff --git a/tools/render-host/build.mjs b/tools/render-host/build.mjsindex 1f67584bd..d58a099fb 100644--- a/tools/render-host/build.mjs+++ b/tools/render-host/build.mjs@@ -30,7 +30,7 @@ if (!(await exists(path.join(WASM_SRC, 'esengine.wasm')))) {process.exit(2);}-await rm(OUT, { recursive: true, force: true });+await rm(OUT, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await mkdir(OUT, { recursive: true });await build({diff --git a/tools/stress-project.mjs b/tools/stress-project.mjsindex 0e28a1af3..4260ce5af 100644Binary files a/tools/stress-project.mjs and b/tools/stress-project.mjs differdiff --git a/tools/tests/desktop-executable.test.ts b/tools/tests/desktop-executable.test.tsindex 51ccea584..20f456e66 100644--- a/tools/tests/desktop-executable.test.ts+++ b/tools/tests/desktop-executable.test.ts@@ -30,7 +30,7 @@ function file(...parts: string[]): string {}beforeAll(() => { root = mkdtempSync(path.join(tmpdir(), 'estella-exe-')); });-afterAll(() => { rmSync(root, { recursive: true, force: true }); });+afterAll(() => { rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); });describe('desktopExecutableIn', () => {it('picks the bundle executable over a signed bundle\'s CodeResources', () => {diff --git a/tools/tests/engine-build.test.ts b/tools/tests/engine-build.test.tsindex 87a12231f..e16746fc0 100644--- a/tools/tests/engine-build.test.ts+++ b/tools/tests/engine-build.test.ts@@ -36,7 +36,7 @@ beforeEach(() => {wasmDir = path.join(root, 'build', 'wasm', 'wechat');mkdirSync(wasmDir, { recursive: true });});-afterEach(() => rmSync(root, { recursive: true, force: true }));+afterEach(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));describe('staleEngineBuild, per variant', () => {it('dates a variant by its OWN build, not by when the manifest was written', () => {diff --git a/tools/verify-aot-native.mjs b/tools/verify-aot-native.mjsindex 59cbf5bce..0df6b2be1 100644--- a/tools/verify-aot-native.mjs+++ b/tools/verify-aot-native.mjs@@ -108,5 +108,5 @@ try {}console.log(`✓ aot native: ${installed[1]} installed, ${running[1]} running compiled, and it drew`);} finally {- rmSync(out, { recursive: true, force: true });+ rmSync(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}diff --git a/tools/verify-aot-parity.mjs b/tools/verify-aot-parity.mjsindex a4850a598..350294ea2 100644--- a/tools/verify-aot-parity.mjs+++ b/tools/verify-aot-parity.mjs@@ -88,7 +88,7 @@ requireCurrentEngine(ROOT, ENGINE.dir, process.argv, ENGINE.variant);/** Package one project, with or without its compiled systems. */function exportOnce(id, out, compiled) {- rmSync(out, { recursive: true, force: true });+ rmSync(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });return spawnSync(process.execPath, [path.join(ROOT, 'pipeline', 'bin', 'estella.mjs'), 'export', projectDir(id),'--platform', 'web', '--out', out, ...(compiled ? [] : ['--no-aot']),diff --git a/tools/verify-desktop-render.mjs b/tools/verify-desktop-render.mjsindex 39a4331af..ff19eba07 100644--- a/tools/verify-desktop-render.mjs+++ b/tools/verify-desktop-render.mjs@@ -199,7 +199,7 @@ try {}}} finally {- rmSync(work, { recursive: true, force: true });+ rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}if (failed > 0) {diff --git a/tools/verify-golden.mjs b/tools/verify-golden.mjsindex e61171f4e..911a031f7 100644--- a/tools/verify-golden.mjs+++ b/tools/verify-golden.mjs@@ -299,7 +299,7 @@ for (const key of new Set(pairs.map((p) => JSON.stringify(ENGINE_OF(p.target))))const results = [];for (const { id, target } of pairs) {const out = path.join(WORK, `${id}-${target}`);- rmSync(out, { recursive: true, force: true });+ rmSync(out, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });const sizeReport = path.join(WORK, `${id}-${target}.size.json`);const exported = spawnSync(process.execPath, [diff --git a/tools/verify-legacy.mjs b/tools/verify-legacy.mjsindex 0926d0d10..668fed395 100644--- a/tools/verify-legacy.mjs+++ b/tools/verify-legacy.mjs@@ -163,7 +163,7 @@ for (const { tag, id } of cases) {console.log(`✓ ${id} @ ${tag} — ${Object.keys(want).length} entities, every component still there`);}} finally {- rmSync(work, { recursive: true, force: true });+ rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });}}diff --git a/tools/verify-native-boot.mjs b/tools/verify-native-boot.mjsindex 8c7be43fb..63147039a 100644--- a/tools/verify-native-boot.mjs+++ b/tools/verify-native-boot.mjs@@ -734,7 +734,7 @@ function listExamples(opts) {function packageExample(driver, name, opts) {const work = path.join(ROOT, 'build', 'smoke-work', name);const report = path.join(work, 'export.json');- rmSync(work, { recursive: true, force: true });+ rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(work, { recursive: true });quietly('export', process.execPath, [path.join(ROOT, 'pipeline', 'bin', 'estella.mjs'), 'export',@@ -866,7 +866,7 @@ for (const name of examples) {}// Each APK carries the whole runtime template; keeping 40 of them around// is gigabytes for no reason.- rmSync(work, { recursive: true, force: true });+ rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });} catch (err) {r = { ok: false, why: err.message, log: '', colors: 0, frames: 0, unjudged: null, size: '-' };}diff --git a/tools/verify-playthrough.mjs b/tools/verify-playthrough.mjsindex 9f841ae8d..3d606a564 100644--- a/tools/verify-playthrough.mjs+++ b/tools/verify-playthrough.mjs@@ -47,7 +47,7 @@ if (!existsSync(ROUTE)) {process.exit(2);}-rmSync(WORK, { recursive: true, force: true });+rmSync(WORK, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });mkdirSync(WORK, { recursive: true });const out = path.join(WORK, PROJECT);@@ -76,7 +76,7 @@ const played = retryOnDeadGpu(() => {}, (died) => console.log(`↻ ${PROJECT} — ${died? 'the GPU went away under the walk' : 'no frame after a GPU death'}; walking again`));for (const line of (played.stdout || '').split('\n')) if (line.trim()) console.log(line);-if (!argv.includes('--keep')) rmSync(WORK, { recursive: true, force: true });+if (!argv.includes('--keep')) rmSync(WORK, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });if (!played.ok) {console.error(played.launchFailed ? `✗ ${launchNeverHappenedVerdict('the walk')}`: played.gpuDied ? `✗ ${deadGpuVerdict('the route')}`