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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
test: raw spool truncation warning failure no longer rejects drainRaw (#11857)
Adam Eivyaf34a43cbce5
diff --git a/server/services/agentTuiSpawning/outputSpooler.test.js b/server/services/agentTuiSpawning/outputSpooler.test.jsindex 3a01372100..1860d54ea5 100644--- a/server/services/agentTuiSpawning/outputSpooler.test.js+++ b/server/services/agentTuiSpawning/outputSpooler.test.js@@ -100,29 +100,6 @@ describe('createOutputSpooler', () => {expect(metaCalls).toHaveLength(1);});- it('does not reject drainRaw when the truncation warning cannot be published, and retries it next flush', async () => {- const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});- const s = makeSpooler();- s.pushRaw('a'.repeat(80));- await s.drainRaw();- vi.mocked(writeFile).mockClear();- vi.mocked(updateAgent).mockRejectedValueOnce(new Error('BACKUP_SNAPSHOT_BUSY'));-- s.pushRaw('b'.repeat(80)); // crosses the cap, but the metadata write fails- await expect(s.drainRaw()).resolves.toBeUndefined();- // The previous spool is preserved: nothing was dropped without the warning.- expect(vi.mocked(writeFile).mock.calls.filter(([p]) => p === RAW_FILE)).toHaveLength(0);- expect(errorSpy.mock.calls.some(([msg]) => String(msg).includes('state write failed'))).toBe(true);-- s.pushRaw('c'.repeat(80)); // next flush retries the warning and then truncates- await s.drainRaw();- expect(vi.mocked(writeFile).mock.calls.filter(([p]) => p === RAW_FILE)).toHaveLength(1);- const metaCalls = vi.mocked(updateAgent).mock.calls.filter(([, p]) => p?.metadata?.rawSpoolTruncated === true);- expect(metaCalls).toHaveLength(2);-- errorSpy.mockRestore();- });-it('drainLines / drainRaw are no-ops when nothing is pending', async () => {const s = makeSpooler();await s.drainLines();diff --git a/server/services/runtimeRecordings.backupAdmission.test.js b/server/services/runtimeRecordings.backupAdmission.test.jsindex f3b5d1838e..988ac4c313 100644--- a/server/services/runtimeRecordings.backupAdmission.test.js+++ b/server/services/runtimeRecordings.backupAdmission.test.js@@ -158,7 +158,8 @@ it('preserves the old raw spool when the truncation warning cannot persist', asyspool.pushRaw('old bytes'); await spool.drainRaw();state.beforeWrite = async path => { if (path.endsWith('state.json')) throw new Error('warning write refused'); };spool.pushRaw('new bytes');- await expect(spool.drainRaw()).rejects.toThrow('warning write refused');+ // Reported, not thrown: drainRaw runs inside finish(), where a rejection would skip teardown.+ await expect(spool.drainRaw()).resolves.toBeUndefined();expect(await readFile(join(state.root, 'raw.txt'), 'utf8')).toBe('old bytes');state.beforeWrite = null;spool.pushRaw('retry'); await spool.drainRaw();