Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): json bulk-import round-trip + surface bulk warnings in UI
[._.]/ Adam Eivy56c861fa168d
diff --git a/client/src/pages/CatalogIngest.jsx b/client/src/pages/CatalogIngest.jsxindex 6540ac108c..1389d1a83d 100644--- a/client/src/pages/CatalogIngest.jsx+++ b/client/src/pages/CatalogIngest.jsx@@ -157,7 +157,14 @@ export default function CatalogIngest() {setBulkSubmitting(false);if (!result) return;const n = result.count || 0;+ const warnings = Array.isArray(result.warnings) ? result.warnings : [];toast.success(`Bulk imported ${n} ingredient${n === 1 ? '' : 's'}.`);+ // Surface parser warnings (e.g. `## Plce: …` typos in markdown) before+ // navigating away — otherwise the user has no signal that some sections+ // were silently skipped.+ if (warnings.length > 0) {+ toast.error(`${warnings.length} section${warnings.length === 1 ? '' : 's'} skipped: ${warnings.join('; ')}`, { duration: 8000 });+ }setBulkText('');setBulkOpen(false);navigate('/catalog');diff --git a/server/lib/catalogBulkParsers.js b/server/lib/catalogBulkParsers.jsindex af6f97e717..a600129070 100644--- a/server/lib/catalogBulkParsers.js+++ b/server/lib/catalogBulkParsers.js@@ -98,7 +98,9 @@ function normalizeEntry(input, index) {}/**- * JSON: must be a non-empty array of objects.+ * JSON: accepts either a bare array of entries OR a full export bundle+ * (`{ version, ref, ingredients: [...] }`) so the export → edit → re-import+ * round trip works without the user having to strip the wrapper.*/export function parseJsonBulk(payload) {if (typeof payload !== 'string') {@@ -110,10 +112,13 @@ export function parseJsonBulk(payload) {} catch (err) {throw new Error(`invalid JSON: ${err.message}`);}- if (!Array.isArray(parsed)) {- throw new Error('json payload must be an array of objects');+ const entries = Array.isArray(parsed)+ ? parsed+ : (parsed && Array.isArray(parsed.ingredients) ? parsed.ingredients : null);+ if (!entries) {+ throw new Error('json payload must be an array of entries or an export bundle with an `ingredients` array');}- return parsed.map((entry, i) => normalizeEntry(entry, i));+ return entries.map((entry, i) => normalizeEntry(entry, i));}/**diff --git a/server/lib/catalogBulkParsers.test.js b/server/lib/catalogBulkParsers.test.jsindex 487746e43b..8481cc01b7 100644--- a/server/lib/catalogBulkParsers.test.js+++ b/server/lib/catalogBulkParsers.test.js@@ -67,6 +67,20 @@ describe('parseJsonBulk', () => {it('throws on missing name', () => {expect(() => parseJsonBulk(JSON.stringify([{ type: 'idea', name: ' ' }]))).toThrow(/name is required/);});++ it('accepts an export-bundle wrapper with an ingredients array (round-trip)', () => {+ const bundle = JSON.stringify({+ version: 1,+ ref: { kind: 'universe', id: 'u1' },+ ingredients: [{ type: 'idea', name: 'X', payload: { summary: 'hi' } }],+ });+ const out = parseJsonBulk(bundle);+ expect(out).toEqual([{ type: 'idea', name: 'X', payload: { summary: 'hi' }, tags: [] }]);+ });++ it('rejects an object root without an ingredients array', () => {+ expect(() => parseJsonBulk(JSON.stringify({ version: 1, ref: { kind: 'universe', id: 'u1' } }))).toThrow(/array of entries or an export bundle/);+ });});describe('parseCsvBulk', () => {