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(db): await CD warm before legacy prune; drop unused test import
Adam Eivye3a2e2d0a1e4
diff --git a/server/index.js b/server/index.jsindex 2048d443ef..0a2cf5d049 100644--- a/server/index.js+++ b/server/index.js@@ -899,6 +899,17 @@ ensureSelf()// DB. Idempotent with that early warm (same setUserCatalogTypes result).const warmTypes = await readUserTypeSlice();setUserCatalogTypes(Array.isArray(warmTypes) ? warmTypes : []);+ // Creative Director PG warm (#997): unlike the other stores, CD's file→DB+ // import (migrateCreativeDirectorToDB) is triggered lazily on first+ // backend access, and at boot the only trigger is the fire-and-forget+ // recoverInFlightProjects() in an earlier .then() — NOT awaited, so it can+ // still be in flight here. The prune below stamps a single completion+ // marker once no domain is blocked, so it must not run while CD's import+ // (and its creative-director-projects.migrated.json marker) is unfinished,+ // or CD's .imported file would never be pruned. listProjects() forces+ // selectBackend() → the (idempotent, marker-gated) import to completion.+ const { listProjects: warmCdProjects } = await import('./services/creativeDirector/local.js');+ await warmCdProjects();// Legacy artifact prune: runs LAST, after every file→DB warm above has// imported + stamped its marker, so both the migration markers AND the// authoritative DB rows exist. Removes the `.imported` / `.bak-NNN`diff --git a/server/scripts/pruneImportedLegacyFiles.test.js b/server/scripts/pruneImportedLegacyFiles.test.jsindex 4175e5c642..9aff2e90c0 100644--- a/server/scripts/pruneImportedLegacyFiles.test.js+++ b/server/scripts/pruneImportedLegacyFiles.test.js@@ -13,7 +13,7 @@*/import { describe, it, expect, beforeEach, afterEach } from 'vitest';-import { mkdtemp, rm, mkdir, writeFile, stat, readFile } from 'fs/promises';+import { mkdtemp, rm, mkdir, writeFile, stat } from 'fs/promises';import { tmpdir } from 'os';import { join } from 'path';import { pruneImportedLegacyFiles } from './pruneImportedLegacyFiles.js';