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

Serialize nested process-audit cleanup validation (#11616)

[._.]/c507903155f2
diff --git a/scripts/persistentMindProcessAuditCleanup.test.js b/scripts/persistentMindProcessAuditCleanup.test.js
index f6f6f273ff..459cd17e23 100644
--- a/scripts/persistentMindProcessAuditCleanup.test.js
+++ b/scripts/persistentMindProcessAuditCleanup.test.js
@@ -19,7 +19,7 @@ it('drains process-audit fixture writes after another worker triggers fail-fast'
const sourcePath = fileURLToPath(new URL('../server/services/persistentMindProcessAudit.test.js', import.meta.url));
const header = "it('holds an ambiguous create durably instead of publishing twice', async () => {";
const source = readFileSync(sourcePath, 'utf8')
- .replace(/(['"])(\.\.?\/[^'"]+)\1/g, (_, quote, specifier) => JSON.stringify(resolve(dirname(sourcePath), specifier)))
+ .replace(/(['"])(\.\.?\/[^'"]+)\1/g, (_, _quote, specifier) => JSON.stringify(resolve(dirname(sourcePath), specifier)))
.replace(header, `${header.replace('async () =>', 'async ({ signal }) =>')}
const { writeFileSync } = await import('node:fs');
const cancelled = new Promise(resolve => signal.addEventListener('abort', () => setImmediate(resolve), { once: true }));
@@ -37,11 +37,18 @@ it('drains process-audit fixture writes after another worker triggers fail-fast'
args.push('--bail=1');
const result = spawnSync(process.execPath, args, options);
const output = `${result.stdout}\n${result.stderr}`;
- expect(result.error).toBeUndefined();
- expect(result.status, output).toBe(1);
- expect(output).toContain('controlled sibling failure');
- expect(existsSync(finished), output).toBe(true);
- expect(output).not.toMatch(/ENOTEMPTY|ENOENT|Unhandled|test temp leak:/);
+ const diagnostics = [
+ `Child error: ${result.error?.stack ?? 'none'}; code: ${result.error?.code ?? 'none'}`,
+ `Child status: ${result.status}; signal: ${result.signal}`,
+ `Fixture ready: ${existsSync(ready)}; finished: ${existsSync(finished)}`,
+ `stdout:\n${result.stdout ?? ''}`,
+ `stderr:\n${result.stderr ?? ''}`,
+ ].join('\n');
+ expect(result.error, diagnostics).toBeUndefined();
+ expect(result.status, diagnostics).toBe(1);
+ expect(output, diagnostics).toContain('controlled sibling failure');
+ expect(existsSync(finished), diagnostics).toBe(true);
+ expect(output, diagnostics).not.toMatch(/ENOTEMPTY|ENOENT|Unhandled|test temp leak:/);
} finally {
rmSync(host, { recursive: true, force: true });
}
diff --git a/scripts/vitestCiPool.js b/scripts/vitestCiPool.js
index 5053d1367e..7415b8cb5e 100644
--- a/scripts/vitestCiPool.js
+++ b/scripts/vitestCiPool.js
@@ -66,6 +66,7 @@ const EXCLUSIVE_TESTS = [
'scripts/run-local-code-review.test.js',
'lib/workTracker.trackerInstructions.test.js',
'../scripts/ci-test-plan.test.js',
+ '../scripts/persistentMindProcessAuditCleanup.test.js',
'../scripts/writersRoomPromotionCleanup.test.js',
];
diff --git a/scripts/vitestCiPool.test.js b/scripts/vitestCiPool.test.js
index 143b125391..b51e0a2d4f 100644
--- a/scripts/vitestCiPool.test.js
+++ b/scripts/vitestCiPool.test.js
@@ -113,7 +113,7 @@ it('runs parallel units before exclusive, nonduplicated captures and cutover pro
}
`;
for (const [name, other] of [['unit-a', 'unit-b'], ['unit-b', 'unit-a']]) {
- put(`${name}.test.js`, common + `test('${name}', async () => {
+ put(`${name}.test.js`, `${common}test('${name}', async () => {
expect(existsSync(marker('capture-lock'))).toBe(false);
writeFileSync(marker('${name}-started'), '');
await waitFor('${other}-started');
@@ -127,8 +127,10 @@ it('runs parallel units before exclusive, nonduplicated captures and cutover pro
['music', 'services/musicVideo/documentRender.browser.test.js'],
['cutover', 'services/databaseMaintenanceCutover.test.js'],
['assembly', 'services/creativeDirector/videoAssembly.test.js'],
+ ['process-audit-cleanup', '../scripts/persistentMindProcessAuditCleanup.test.js'],
]) {
- put(path, common + `test('${name}', async () => {
+ put(path, `${common}test('${name}', async ({ task }) => {
+ expect(task.file.projectName).toBe('capture');
expect(existsSync(marker('unit-a-done')) && existsSync(marker('unit-b-done'))).toBe(true);
const lock = openSync(marker('capture-lock'), 'wx');
try {
@@ -148,7 +150,7 @@ it('runs parallel units before exclusive, nonduplicated captures and cutover pro
expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0);
const events = readFileSync(join(fixture, 'events'), 'utf8').trim().split('\n');
expect(events.slice(0, 2).sort()).toEqual(['unit-a', 'unit-b']);
- expect(events.slice(2).sort()).toEqual(['assembly', 'cutover', 'film-look', 'html', 'music']);
+ expect(events.slice(2).sort()).toEqual(['assembly', 'cutover', 'film-look', 'html', 'music', 'process-audit-cleanup']);
} finally {
rmSync(scratch, { recursive: true, force: true });
}