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
fix: settle subscription exports before removing the test bucket (#12288)
[._.]/ Adam Eivy6afbeacfe549
diff --git a/server/services/sharing/subscriptions.js b/server/services/sharing/subscriptions.jsindex fa50738267..03c11eb352 100644--- a/server/services/sharing/subscriptions.js+++ b/server/services/sharing/subscriptions.js@@ -383,6 +383,17 @@ export function installSubscriptionListener() {recordEvents.on('deleted', onDeleted);}+/**+ * Test-only: stop new re-exports (debounce timers, listeners) and wait for the+ * ones already running. A fixture must await this before removing its bucket,+ * or a late export recreates the directory after removal (#12288).+ */+export async function __settleForTests() {+ __resetForTests();+ while (inFlightExports.size) await Promise.all([...inFlightExports.values()]);+ await queueStateWrite(async () => {});+}+/** Test-only: clear pending debounces and detach our own listeners. */export function __resetForTests() {for (const t of pendingTimers.values()) clearTimeout(t);diff --git a/server/services/sharing/subscriptions.test.js b/server/services/sharing/subscriptions.test.jsindex ec6af814fe..4841494090 100644--- a/server/services/sharing/subscriptions.test.js+++ b/server/services/sharing/subscriptions.test.js@@ -52,8 +52,11 @@ describe('sharing/subscriptions', () => {subs.__resetForTests();gate.hold = null; gate.held = 0; gate.calls = 0;});- afterEach(() => {+ afterEach(async () => {vi.useRealTimers();+ // Debounce timers and listener-triggered exports outlive the test body and+ // would recreate the bucket after the rmSync below (#12288).+ await subs.__settleForTests();if (tempBucket) rmSync(tempBucket, { recursive: true, force: true });});