From eb308d2f4983d93c4ff7c63d19648b4b8def88d5 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Tue, 15 Sep 2026 17:40:10 -0700 Subject: [PATCH] Clean up acceptance LevelDB temp dirs Each psf-memo-db acceptance scenario opened an isolated LevelDB directory but close() only closed the handles, so tmp/acceptance grew without bound (found at 961 dirs / 293 MB). Delete the scenario dir in close() and sweep tmp/acceptance at the start of the acceptance run. By specifier. --- psf-memo-db/acceptance/acceptance.js | 12 ++++++++++++ psf-memo-db/acceptance/lib/handlers.js | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/psf-memo-db/acceptance/acceptance.js b/psf-memo-db/acceptance/acceptance.js index 2d28f96..cf4b13d 100644 --- a/psf-memo-db/acceptance/acceptance.js +++ b/psf-memo-db/acceptance/acceptance.js @@ -33,7 +33,19 @@ function ensureAps () { 'https://github.com/unclebob/Acceptance-Pipeline-Specification.git', apsDir]) } +// Each scenario opens an isolated LevelDB directory under tmp/acceptance. +// Remove leftovers from earlier runs (including pre-fix runs that leaked them) +// so the directory cannot grow without bound. +function cleanStaleWorlds () { + try { + fs.rmSync(path.join(root, 'tmp', 'acceptance'), { recursive: true, force: true }) + } catch (err) { + // ignore cleanup errors + } +} + function main () { + cleanStaleWorlds() ensureAps() const features = fs diff --git a/psf-memo-db/acceptance/lib/handlers.js b/psf-memo-db/acceptance/lib/handlers.js index 5fcb71c..0030719 100644 --- a/psf-memo-db/acceptance/lib/handlers.js +++ b/psf-memo-db/acceptance/lib/handlers.js @@ -152,6 +152,13 @@ async function createWorld () { } catch (err) { // ignore close errors } + // Each scenario opens an isolated LevelDB directory. Remove it here so + // tmp/acceptance cannot grow without bound across runs. + try { + fs.rmSync(levelDir, { recursive: true, force: true }) + } catch (err) { + // ignore cleanup errors + } } } }