Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-12536]): name the test temp-leak guard when it fails an all-passing run

[._.]/ Adam Eivyb4e64aa959f2
diff --git a/scripts/vitestTempRootSetup.js b/scripts/vitestTempRootSetup.js
index a1d5260020..24d2165667 100644
--- a/scripts/vitestTempRootSetup.js
+++ b/scripts/vitestTempRootSetup.js
@@ -141,7 +141,13 @@ export function cleanupRunTempRoot(root = process.env.PORTOS_TEST_TEMP_ROOT) {
console.warn(`⚠️ stage fixture ${index + 1}: ${describeStageFixtureRoot(join(root, name), observations.get(name), state)}`);
}
if (stages.length > 8) console.warn(`⚠️ stage fixture provenance capped: ${stages.length - 8} additional entries`);
- if (entries.length) process.exitCode = 1;
+ if (entries.length) {
+ // This runs in vitest.onClose, after the reporter's exit-code snapshot, and
+ // is the only place a run whose every assertion passed is made to fail.
+ // Name it so the nonzero exit never reads as unexplained (#12536).
+ console.error(`❌ test temp leak guard: failing the run with exit code 1 for ${entries.length} leaked ${entries.length === 1 ? 'entry' : 'entries'} under the run temp root`);
+ process.exitCode = 1;
+ }
try {
rmSync(root, { recursive: true, force: true });
diff --git a/scripts/vitestTempRootSetup.test.js b/scripts/vitestTempRootSetup.test.js
index 9b6a8a1c35..4e72a9299d 100644
--- a/scripts/vitestTempRootSetup.test.js
+++ b/scripts/vitestTempRootSetup.test.js
@@ -30,9 +30,10 @@ describe('vitestTempRootSetup teardown', () => {
process.env.PORTOS_TEST_TEMP_ROOT = root;
populate(root);
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
+ const error = vi.spyOn(console, 'error').mockImplementation(() => {});
process.exitCode = undefined;
cleanupRunTempRoot();
- const result = { warnings: warn.mock.calls.map((c) => c[0]), exitCode: process.exitCode, removed: !existsSync(root) };
+ const result = { warnings: warn.mock.calls.map((c) => c[0]), errors: error.mock.calls.map((c) => c[0]), exitCode: process.exitCode, removed: !existsSync(root) };
rmSync(root, { recursive: true, force: true });
return result;
}
@@ -91,6 +92,8 @@ describe('vitestTempRootSetup teardown', () => {
writeFileSync(join(root, 'fixture-Abc123', 'data.json'), '{}');
});
expect(leaked.warnings).toEqual(['⚠️ test temp leak: fixture- ×1']);
+ // The only thing that fails an all-passing run must say so (#12536).
+ expect(leaked.errors).toEqual(['❌ test temp leak guard: failing the run with exit code 1 for 1 leaked entry under the run temp root']);
expect(leaked.exitCode).toBe(1);
});
@@ -101,7 +104,7 @@ describe('vitestTempRootSetup teardown', () => {
writeFileSync(join(cache, 'dotnet-suggest-registration-git-credential-manager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'),
'Exception during registration: dotnet-suggest is unavailable');
});
- expect(clean).toEqual({ warnings: [], exitCode: undefined, removed: true });
+ expect(clean).toEqual({ warnings: [], errors: [], exitCode: undefined, removed: true });
});
it.each(['unknown-file', 'empty-unknown-file', 'nested-directory', 'empty-nested-directory', 'linked-directory', 'lookalike-name', 'unreadable'])(