[object Object]

← back to Wallco Ai

gen-luxe: psql helper ON_ERROR_STOP=1 so a half-applied multi-statement write fails loud instead of exit-0 (Codex audit :257)

fef1177bdd3efceb4275a8612172fa27135da05c · 2026-06-01 07:05:53 -0700 · Steve Abrams

Files touched

Diff

commit fef1177bdd3efceb4275a8612172fa27135da05c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 1 07:05:53 2026 -0700

    gen-luxe: psql helper ON_ERROR_STOP=1 so a half-applied multi-statement write fails loud instead of exit-0 (Codex audit :257)
---
 scripts/gen-luxe.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/gen-luxe.js b/scripts/gen-luxe.js
index 65ea3d6..da7fabc 100644
--- a/scripts/gen-luxe.js
+++ b/scripts/gen-luxe.js
@@ -58,7 +58,10 @@ function readKey() {
   return m[1].trim();
 }
 function psql(sql) {
-  const r = spawnSync('psql', ['dw_unified', '-At', '-q'], { input: sql, encoding: 'utf8' });
+  // ON_ERROR_STOP=1: without it, a failing statement inside a multi-statement
+  // write (insert + image_url update + source unpublish) is skipped while psql
+  // still exits 0 — a half-applied write reported as success. Fail loud instead.
+  const r = spawnSync('psql', ['dw_unified', '-At', '-q', '-v', 'ON_ERROR_STOP=1'], { input: sql, encoding: 'utf8' });
   if (r.status !== 0) throw new Error(r.stderr || 'psql failed');
   return r.stdout.trim();
 }

← ca8e0ff overnight loop: extend to daytime (stop_hour=18, cap=140), s  ·  back to Wallco Ai  ·  Add universal search: /search page + /api/search aggregator 4dbc0e2 →