[object Object]

← back to Dw Photo Capture

visual-search nightly embed: env-first DB user (PGUSER or running OS user, drop retired stevestudio2), launchd PATH for psql, fail-loud connect precheck (TK-12090 Lane P)

d5f6c4ad33d7e8cde8868c106a8231c1ac7a42df · 2026-09-23 14:41:13 -0700 · Steve Abrams

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXUyzc9vybUz39rhnNJdwY

Files touched

Diff

commit d5f6c4ad33d7e8cde8868c106a8231c1ac7a42df
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Sep 23 14:41:13 2026 -0700

    visual-search nightly embed: env-first DB user (PGUSER or running OS user, drop retired stevestudio2), launchd PATH for psql, fail-loud connect precheck (TK-12090 Lane P)
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01KXUyzc9vybUz39rhnNJdwY
---
 visual-search/embed-nightly-mac2.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/visual-search/embed-nightly-mac2.sh b/visual-search/embed-nightly-mac2.sh
index 07e700a..975b459 100755
--- a/visual-search/embed-nightly-mac2.sh
+++ b/visual-search/embed-nightly-mac2.sh
@@ -4,8 +4,17 @@
 # then hot-reloads the search index. Safe to run any time; $0 local.
 # launchd: com.steve.visual-search-embed-nightly (see plist next to this script).
 set -u
+export PATH="/opt/homebrew/bin:/opt/homebrew/opt/postgresql@14/bin:/usr/local/bin:$PATH"   # launchd PATH lacks psql
 cd "$(dirname "$0")" || exit 1
-export DW_UNIFIED_DB="${DW_UNIFIED_DB:-postgresql://stevestudio2@/dw_unified?host=/tmp}"
+# DB user: env-first. The old hard-coded `stevestudio2` role is retired; the repo's known-good
+# convention (server.js DW_DB default + .env.example) is local peer auth as the RUNNING OS user,
+# so default to PGUSER, else `id -un` (macstudio3 under launchd). TK-12090 Lane P.
+export DW_UNIFIED_DB="${DW_UNIFIED_DB:-postgresql://${PGUSER:-$(id -un)}@/dw_unified?host=/tmp}"
+# Fail loud (and early) if the conninfo can't connect, instead of two embedders erroring silently.
+if ! psql "$DW_UNIFIED_DB" -tAc "select 1" >/dev/null 2>&1; then
+  echo "$(date -u +%FT%TZ) nightly: ABORT — cannot connect with DW_UNIFIED_DB user=${PGUSER:-$(id -un)}" >> embed-nightly.log
+  exit 2
+fi
 PY=./.venv-similar/bin/python
 LOG=embed-nightly.log
 

← 5b591d9 repoint dead Ollama macvision + Q&A paths to shared exo-visi  ·  back to Dw Photo Capture  ·  auto-data-snapshot: 2026-09-23T14:48:42 (1 data files) — vis b1c94e3 →