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
Merge pull request #8361 from atomantic/claim/issue-8325
[._.]/5c4c4dfe6dbe
diff --cc server/services/bootstrap.shutdown.test.jsindex 434c02b57a,8ce9e61ece..5ca65dad2f--- a/server/services/bootstrap.shutdown.test.js+++ b/server/services/bootstrap.shutdown.test.js@@@ -174,6 -147,25 +174,25 @@@ describe('shutdown handler — detachedit('signals the groups before dropping connections', () => {// Signalling after the server has begun closing would race process.exit.- expect(code.indexOf('signalDetachedGroups(')).toBeLessThan(code.indexOf('closeAllConnections'));+ expect(code.indexOf('signalDetachedGroups(')).toBeLessThan(code.indexOf('closeServer('));});});++ // #8325. An admitted media job is acknowledged only once its snapshot is on+ // disk; shutdown must not exit while that write, a terminal transition, or the+ // final progress snapshot is still in the persist chain.+ describe('shutdown handler — media-job queue flush (#8325)', () => {+ const code = stripCommentsAndNormalize(extractDeclaration(SRC, 'shutdown') || '');++ it('flushes after admissions stop, before the DB close, and awaits it before exiting', () => {+ const flushAt = code.indexOf('flushMediaJobQueue(');+ expect(flushAt, 'flushMediaJobQueue() is not called in shutdown()').toBeGreaterThan(-1);+ // Started only once the HTTP servers stop accepting requests, so no route+ // can admit a job the flush misses.+ expect(flushAt).toBeGreaterThan(code.indexOf("closeServer(httpServer"));+ expect(flushAt).toBeLessThan(code.indexOf("import('../lib/db.js')"));+ const awaitAt = code.indexOf('await mediaQueueFlushed');+ expect(awaitAt).toBeGreaterThan(flushAt);+ expect(awaitAt).toBeLessThan(code.indexOf('process.exit(0)'));+ });+ });