[object Object]

← back to Wallco Ai

generator: drop dead refresh-orders endpoint (fetch_recent_orders_palette.js already removed)

50731bb3f2af85c04c66c06b65e85f3ff77a6ce0 · 2026-06-01 17:03:44 -0700 · Steve Abrams

Orphaned when the DW-orders palette was replaced by style-guide palettes — the UI no longer repopulates wallco_recent_orders_palette. generator_tick.js still reads that table via recentPaletteSeeds() but degrades to an empty seed list (already empty on prod; the prompt builder handles no seeds), so the autonomous tick is unaffected.

Files touched

Diff

commit 50731bb3f2af85c04c66c06b65e85f3ff77a6ce0
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 1 17:03:44 2026 -0700

    generator: drop dead refresh-orders endpoint (fetch_recent_orders_palette.js already removed)
    
    Orphaned when the DW-orders palette was replaced by style-guide palettes — the UI no longer repopulates wallco_recent_orders_palette. generator_tick.js still reads that table via recentPaletteSeeds() but degrades to an empty seed list (already empty on prod; the prompt builder handles no seeds), so the autonomous tick is unaffected.
---
 server.js | 43 +++++++------------------------------------
 1 file changed, 7 insertions(+), 36 deletions(-)

diff --git a/server.js b/server.js
index e4e3a79..7bbadde 100644
--- a/server.js
+++ b/server.js
@@ -21830,42 +21830,13 @@ app.post('/api/generator/run-now', (req, res) => {
   });
 });
 
-app.post('/api/generator/refresh-orders', (req, res) => {
-  // Same bug as run-now had: detached + pipe + waiting on 'exit' hangs
-  // forever because the parent owns the pipes but the child is detached.
-  // Two-mode now:
-  //   sync=1 (default for the UI button) — short timeout, stream output
-  //     back inline so the alert() can show real success/failure
-  //   sync=0 — fire & return immediately with a log handle
-  const limit = parseInt(req.body?.limit || '50', 10);
-  const sync = req.body?.sync === false ? false : true;
-  if (!sync) {
-    const logFile = path.join(__dirname, 'data', 'logs', `refresh-orders-${Date.now()}.log`);
-    fs.mkdirSync(path.dirname(logFile), { recursive: true });
-    const out = fs.openSync(logFile, 'a');
-    const proc = spawn('node',
-      [path.join(__dirname, 'scripts', 'fetch_recent_orders_palette.js'), '--limit', String(limit)],
-      { cwd: __dirname, detached: true, stdio: ['ignore', out, out] });
-    proc.unref();
-    return res.json({ ok: true, started_at: new Date().toISOString(), log: path.relative(__dirname, logFile), async: true });
-  }
-  // Sync path — block until the script exits or 2 min, then return its output
-  let buf = '';
-  const proc = spawn('node',
-    [path.join(__dirname, 'scripts', 'fetch_recent_orders_palette.js'), '--limit', String(limit)],
-    { cwd: __dirname, stdio: ['ignore', 'pipe', 'pipe'] });
-  proc.stdout.on('data', d => buf += d);
-  proc.stderr.on('data', d => buf += d);
-  const killer = setTimeout(() => { try { proc.kill('SIGKILL'); } catch {} }, 120_000);
-  proc.on('exit', code => {
-    clearTimeout(killer);
-    res.json({ ok: code === 0, exit: code, output: buf.slice(-3000) });
-  });
-  proc.on('error', err => {
-    clearTimeout(killer);
-    res.json({ ok: false, error: err.message, output: buf.slice(-3000) });
-  });
-});
+// NOTE (2026-06-01): the POST /api/generator/refresh-orders endpoint + its
+// scripts/fetch_recent_orders_palette.js helper were removed here when the
+// generator UI's "DW orders palette" was replaced by style-guide palettes
+// (/api/styleguides/brands). Nothing in the UI repopulated wallco_recent_orders_palette
+// anymore. generator_tick.js still reads that table via recentPaletteSeeds(),
+// which degrades to an empty seed list (the table has been empty on prod) — the
+// prompt builder already handles no seeds, so the autonomous tick is unaffected.
 
 app.get('/api/generator/runs', (req, res) => {
   if (!isAdmin(req)) return res.status(404).json({ error: 'not found' });

← 01c9f7c npm scripts: test:themes (offline selftest) + test:themes:li  ·  back to Wallco Ai  ·  extend hex-consistent naming to grid (/api/designs) + search 60d7b6f →