[object Object]

← back to Mfr Review Viewer Corruption

yoloforever c1: wire /api/rebuild to auto-refill FileMaker suggestions (detached, resumable) so a rebuild never leaves the list blank

039cfdc709a53dccf6c82805cd127292685af67d · 2026-08-28 00:43:38 -0700 · Steve Abrams

Files touched

Diff

commit 039cfdc709a53dccf6c82805cd127292685af67d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Aug 28 00:43:38 2026 -0700

    yoloforever c1: wire /api/rebuild to auto-refill FileMaker suggestions (detached, resumable) so a rebuild never leaves the list blank
---
 server.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/server.js b/server.js
index 39b8c37..bf2462d 100644
--- a/server.js
+++ b/server.js
@@ -8,7 +8,7 @@
 
 const express = require('express');
 const { readFileSync, existsSync, writeFileSync, mkdirSync } = require('node:fs');
-const { execFile } = require('node:child_process');
+const { execFile, spawn } = require('node:child_process');
 const path = require('node:path');
 const os = require('node:os');
 
@@ -16,6 +16,7 @@ const PORT = process.env.PORT || 9786;
 const ROOT = __dirname;
 const QUEUE_FILE = path.join(ROOT, 'data', 'queue.jsonl');
 const LOADER = path.join(ROOT, 'scripts', 'build-queue.mjs');
+const ENRICHER = path.join(ROOT, 'scripts', 'enrich-suggestions.mjs');
 const PENDING_DIR = path.join(os.homedir(), '.claude', 'yolo-queue', 'pending-approval');
 const RESTORE_DIR = path.join(ROOT, 'data', 'restore');
 
@@ -107,7 +108,11 @@ app.post('/api/rebuild', (_req, res) => {
   execFile('node', [LOADER], { maxBuffer: 1024 * 1024 * 256 }, (err, stdout, stderr) => {
     if (err) return res.status(500).json({ ok: false, error: stderr || err.message });
     const rows = loadQueue();
-    res.json({ ok: true, total: rows.length, log: (stdout || '').trim().split('\n').slice(-6) });
+    // Auto-refill the FileMaker-derived real-mfr suggestions after a rebuild so the list
+    // never goes back to blank. Detached + unref'd so it outlives this request; resumable.
+    let enriching = false;
+    try { const c = spawn('node', [ENRICHER], { cwd: ROOT, detached: true, stdio: 'ignore' }); c.unref(); enriching = true; } catch { /* best-effort */ }
+    res.json({ ok: true, total: rows.length, enriching, log: (stdout || '').trim().split('\n').slice(-6) });
   });
 });
 

← 58ae65f auto-data-snapshot: 2026-08-27T19:24:37 (1 data files) — dat  ·  back to Mfr Review Viewer Corruption  ·  yoloforever c1 (Cody fix): single-flight lock in enrich-sugg d32eae4 →