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
address review (claude): clarify boot early-exits, broaden not_configured doc, guard setup-db test drift
Adam Eivy165a54dc33ed
diff --git a/docs/BACKUP.md b/docs/BACKUP.mdindex 64e8907a03..d512a5f7bd 100644--- a/docs/BACKUP.md+++ b/docs/BACKUP.md@@ -40,7 +40,7 @@ The effective exclude list is computed by the pure `computeEffectiveExcludes()`|---|---|---|| `{ status: 'ok', sizeBytes, tableCount }` | Dump succeeded and is non-empty | Backup `ok` || `{ status: 'failed', reason: 'pg_unreachable' \| 'pg_dump_missing' \| 'dump_error' \| 'empty_dump' }` | Postgres is the active backend but the dump failed | Backup **`degraded`** + warning toast |-| `{ status: 'skipped', reason: 'not_configured' }` | Postgres is not the active backend (legacy `MEMORY_BACKEND=file` dev/test mode) | Backup stays `ok` (benign) |+| `{ status: 'skipped', reason: 'not_configured' }` | Postgres is not the active backend — `MEMORY_BACKEND=file`, OR the memory backend hasn't initialized yet (`getBackendName()` is still `null`, so auto-detect hasn't resolved to `postgres`) | Backup stays `ok` (benign) |Key behaviors, accurate to the code:diff --git a/scripts/setup-db.test.js b/scripts/setup-db.test.jsindex e1ebec2962..08f5e17495 100644--- a/scripts/setup-db.test.js+++ b/scripts/setup-db.test.js@@ -1,4 +1,7 @@import { describe, it, expect } from 'vitest';+import { readFileSync } from 'fs';+import { dirname, join } from 'path';+import { fileURLToPath } from 'url';// setup-db.js executes top-level setup logic on import (it's a CLI entrypoint),// so we can't import it without running the whole flow. Following the repo@@ -30,4 +33,17 @@ describe('setup-db menu choice resolver (Phase 1: Postgres mandatory)', () => {expect(resolveMenuChoice('3')).toBe('exit');expect(resolveMenuChoice('file')).toBe('exit');});++ // Guard against drift: setup-db.js runs its CLI flow on import so we can't+ // import promptStorageChoice directly. Instead assert the real source still+ // matches the inline copy's contract — the [1/2] prompt is present and no+ // numbered "file" branch was re-added. If promptStorageChoice changes, this+ // forces the copy above to be updated in lockstep.+ it('real setup-db.js source matches the inline resolver contract', () => {+ const here = dirname(fileURLToPath(import.meta.url));+ const src = readFileSync(join(here, 'setup-db.js'), 'utf8');+ expect(src).toContain("Enter choice [1/2]:");+ expect(src).toContain("if (trimmed === '2') resolve('native');");+ expect(src).not.toMatch(/resolve\('file'\)/);+ });});diff --git a/server/index.js b/server/index.jsindex 76db95d008..2e6a06d877 100644--- a/server/index.js+++ b/server/index.js@@ -785,8 +785,10 @@ ensureSelf()}try {- // Skip DB-dependent boot work entirely when running on the escape hatch- // without a healthy database — ensureSchema/migrations would throw.+ // Two early exits guard the migrations below: (1) the fail-fast+ // process.exit(1) above when the DB is required but missing, and (2) this+ // return when on the escape hatch with no healthy DB — ensureSchema and+ // the migrations would throw otherwise.if (!dbReady) {return;}