fix(test-isolation): allow-list known isolated HOMEs to stop FN-3711-style flakes

The leak guard in scripts/check-test-isolation.mjs reported
fusion-test-home-root-* dirs created by scripts/test-changed.mjs as
leaks when transient EBUSY on /var/folders prevented cleanup or the
baseline file got rotated. Track every HOME basename the script mints
and pass it via FUSION_TEST_ISOLATION_IGNORE_NAMES so the check
allow-lists them unconditionally. Surface cleanup rm failures via
console.warn instead of swallowing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-07 12:25:45 -07:00
parent c92eebc5c3
commit ae97fca340
3 changed files with 59 additions and 5 deletions

View File

@@ -196,6 +196,15 @@ function checkAgainstBaseline() {
}
const baselineNames = new Set(baseline.tmpNames ?? []);
// Caller (scripts/test-changed.mjs) tells us which fusion-test-home-root-*
// basenames it minted this run. We allow-list them unconditionally so a
// transient cleanup failure or a rotated baseline file can't masquerade as
// a real test leak.
const callerIgnoreNames = (process.env.FUSION_TEST_ISOLATION_IGNORE_NAMES ?? "")
.split(",")
.map((name) => name.trim())
.filter(Boolean);
for (const name of callerIgnoreNames) baselineNames.add(name);
const leaks = snapshotTmp().filter((e) => !baselineNames.has(e.name));
const baselineByDir = new Map((baseline.protectedFusion ?? []).map((entry) => [entry.dir, entry]));