[object Object]

← back to Ventura Corridor

fix: build-status ideas_rejected wiring + collateral damage from earlier replace_all

ff0e4d006a1353256a1afdcefe0113e7323ebe2a · 2026-05-08 01:32:27 -0700 · SteveStudio2

Tick 80 added ideas_rejected to /api/build-status but my Edit failed
the "string not found" check, so out.ideas_rejected = ideaRejects was
referencing an undeclared variable. Fixed by adding the rejects.jsonl
read alongside accepted in the same try-block.

Also un-broke the build-status handler that got collateral damage from
the tick-74 replace_all=true on `process.env.HOME ||` — that swap
inserted a `return res.json({count: 0, rows: [], note: 'home dir
unresolvable'})` line into a NON-ideas endpoint, killing /api/build-status.
Replaced the dual-endpoint home-check with an inline `if (home)` guard
that doesn't early-return.

Both /api/ideas/{recent,rejects} verified still serving (24/104).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit ff0e4d006a1353256a1afdcefe0113e7323ebe2a
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Fri May 8 01:32:27 2026 -0700

    fix: build-status ideas_rejected wiring + collateral damage from earlier replace_all
    
    Tick 80 added ideas_rejected to /api/build-status but my Edit failed
    the "string not found" check, so out.ideas_rejected = ideaRejects was
    referencing an undeclared variable. Fixed by adding the rejects.jsonl
    read alongside accepted in the same try-block.
    
    Also un-broke the build-status handler that got collateral damage from
    the tick-74 replace_all=true on `process.env.HOME ||` — that swap
    inserted a `return res.json({count: 0, rows: [], note: 'home dir
    unresolvable'})` line into a NON-ideas endpoint, killing /api/build-status.
    Replaced the dual-endpoint home-check with an inline `if (home)` guard
    that doesn't early-return.
    
    Both /api/ideas/{recent,rejects} verified still serving (24/104).
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 src/server/index.ts | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/server/index.ts b/src/server/index.ts
index eb5a47f..e9564df 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -268,16 +268,23 @@ app.get('/api/build-status', async (_req, res) => {
       UNION ALL SELECT 'news_biz', COUNT(DISTINCT business_id)::text FROM news_items
       UNION ALL SELECT 'news_fresh_7d', COUNT(*)::text FROM news_items WHERE fetched_at > now() - interval '7 days'
     `);
-    // Idea-loop accepted count — read from JSONL on disk (cheap; <100kb)
-    let ideaCount = 0;
+    // Idea-loop accepted + rejected counts — read from JSONL on disk
+    let ideaCount = 0, ideaRejects = 0;
     try {
       const fs2 = await import('node:fs/promises');
       const path2 = await import('node:path');
       const home = process.env.HOME || require('os').homedir() || '';
-    if (!home) return res.json({ count: 0, rows: [], note: 'home dir unresolvable' });
-      const p = path2.join(home, '.claude', 'skills', 'idea-loop', 'data', 'ideas.jsonl');
-      const txt = await fs2.readFile(p, 'utf8');
-      ideaCount = txt.split(/\r?\n/).filter(Boolean).length;
+      if (home) {
+        const dir = path2.join(home, '.claude', 'skills', 'idea-loop', 'data');
+        try {
+          const txt = await fs2.readFile(path2.join(dir, 'ideas.jsonl'), 'utf8');
+          ideaCount = txt.split(/\r?\n/).filter(Boolean).length;
+        } catch {}
+        try {
+          const txt = await fs2.readFile(path2.join(dir, 'rejects.jsonl'), 'utf8');
+          ideaRejects = txt.split(/\r?\n/).filter(Boolean).length;
+        } catch {}
+      }
     } catch {}
     const out: Record<string, number> = {};
     for (const row of r.rows) out[row.key] = parseInt(row.value, 10);

← b552dfe feat(coverage): expose ideas_rejected on homepage strip alon  ·  back to Ventura Corridor  ·  task #4: source CC0 glTF bus + car models (Kenney Car Kit + 75c7314 →