chore(test-isolation): use name-only signature to ignore live-app churn
Drop size/mtime from the protected .fusion signature so heartbeat writes to existing files (fusion.db-wal, settings.json, etc.) no longer trigger false-positive leak failures when the post-test mutability probe happens to land in a quiet window. New files still register; tests remain blocked from writing to the real .fusion via the fs guards in vitest-setup.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,13 +105,17 @@ function collectFusionSignature(rootDir, out = []) {
|
|||||||
const fullPath = join(rootDir, entry.name);
|
const fullPath = join(rootDir, entry.name);
|
||||||
const relPath = fullPath.slice(rootDir.length + (rootDir.endsWith(sep) ? 0 : 1));
|
const relPath = fullPath.slice(rootDir.length + (rootDir.endsWith(sep) ? 0 : 1));
|
||||||
if (isRuntimePath(relPath)) continue;
|
if (isRuntimePath(relPath)) continue;
|
||||||
let entryStat;
|
|
||||||
try {
|
try {
|
||||||
entryStat = statSync(fullPath);
|
statSync(fullPath);
|
||||||
} catch {
|
} catch {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
out.push(`${relPath}|${entry.isDirectory() ? "d" : "f"}|${entryStat.size}|${Math.floor(entryStat.mtimeMs)}`);
|
// Track only path + kind. Size/mtime would flip every time the live app
|
||||||
|
// touches an existing file (fusion.db-wal heartbeats, settings.json saves),
|
||||||
|
// producing false-positive "leak" failures. New files still get detected
|
||||||
|
// because they add a new entry to the set; tests are independently blocked
|
||||||
|
// from writing to the real .fusion via the fs guards in vitest-setup.ts.
|
||||||
|
out.push(`${relPath}|${entry.isDirectory() ? "d" : "f"}`);
|
||||||
if (entry.isDirectory()) collectFusionSignature(fullPath, out);
|
if (entry.isDirectory()) collectFusionSignature(fullPath, out);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
@@ -182,7 +186,6 @@ function checkAgainstBaseline() {
|
|||||||
const baselineByDir = new Map((baseline.protectedFusion ?? []).map((entry) => [entry.dir, entry]));
|
const baselineByDir = new Map((baseline.protectedFusion ?? []).map((entry) => [entry.dir, entry]));
|
||||||
const unstableProtectedDirs = new Set(baseline.unstableProtectedDirs ?? []);
|
const unstableProtectedDirs = new Set(baseline.unstableProtectedDirs ?? []);
|
||||||
const currentProtected = snapshotProtectedFusion();
|
const currentProtected = snapshotProtectedFusion();
|
||||||
const currentByDir = new Map(currentProtected.map((entry) => [entry.dir, entry]));
|
|
||||||
const candidateViolations = [];
|
const candidateViolations = [];
|
||||||
for (const current of currentProtected) {
|
for (const current of currentProtected) {
|
||||||
if (unstableProtectedDirs.has(current.dir)) continue;
|
if (unstableProtectedDirs.has(current.dir)) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user