[object Object]

← back to Wallco Ai

fix: /api/design/:id/fix reads all_designs first (spoon fallback) so it stops falsely reporting 'image file not found' on curator-visible designs that drifted out of spoon_all_designs

96e85886421596424016ab2a8436704ed39eaa0f · 2026-05-29 12:48:51 -0700 · Steve Abrams

Files touched

Diff

commit 96e85886421596424016ab2a8436704ed39eaa0f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri May 29 12:48:51 2026 -0700

    fix: /api/design/:id/fix reads all_designs first (spoon fallback) so it stops falsely reporting 'image file not found' on curator-visible designs that drifted out of spoon_all_designs
---
 server.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index 156687a..bd465fa 100644
--- a/server.js
+++ b/server.js
@@ -8946,7 +8946,13 @@ app.post('/api/design/:id/fix', express.json({ limit: '4kb' }), (req, res) => {
     // Find disk path — PG canonical → JSON cache fallback
     let lp = null;
     try {
-      const pgRaw = psqlQuery(`SELECT local_path FROM spoon_all_designs WHERE id=${id} LIMIT 1;`);
+      // all_designs is the curator's source of truth (the cactus-curator list +
+      // applyCactusDecision both read it); spoon_all_designs is the generator
+      // write table and drifts. Read all_designs FIRST so the fixer never
+      // falsely reports "image file not found" for a design the curator shows,
+      // then fall back to spoon_all_designs. (Steve 2026-05-29 — #10069 drift.)
+      let pgRaw = psqlQuery(`SELECT local_path FROM all_designs WHERE id=${id} AND local_path IS NOT NULL LIMIT 1;`);
+      if (!pgRaw || !pgRaw.trim()) pgRaw = psqlQuery(`SELECT local_path FROM spoon_all_designs WHERE id=${id} LIMIT 1;`);
       if (pgRaw && pgRaw.trim()) lp = pgRaw.trim();
     } catch { /* fall through */ }
     if (!lp || !fs.existsSync(lp)) {

← dd42e27 audit: unpublish 20 more flagged-goods from haiku full-sweep  ·  back to Wallco Ai  ·  Fix publish-gate.py prod fail-closed: use resolved image pat 89d7ad5 →