Skip to content

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

address review (round 6): bulletproof slug length, doc accuracy, null-body guard

Adam Eivya98908c0c417
diff --git a/PLAN.md b/PLAN.md
index 86dbf02b98..af6958127b 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -49,7 +49,7 @@ Three high-value work items drawn from an inventory of the current app surface (
### 2. Customizable Dashboard with Saved Layouts ✅ SHIPPED 2026-04-24
-> Widget registry at `client/src/components/dashboard/widgetRegistry.jsx` (13 widgets + 4 built-in data-dependent ones). Layouts persist to `data/dashboard-layouts.json` via `GET/PUT/DELETE /api/dashboard/layouts`. Built-in layouts seeded on first read: `default` (Everything), `focus`, `morning-review`, `ops`. Keyboard-accessible layout editor with up/down reorder buttons, inline add-widget picker, inline confirm-before-delete, rename + "save as new" in-line prompts (no `window.confirm`/`prompt`). Palette integration: `⌘K` → any layout name switches instantly. Drag-and-drop deferred — reorder buttons are fully functional and a11y-correct without a new dependency. See CLAUDE.md "Dashboard Widgets & Layouts" for the widget contract.
+> Widget registry at `client/src/components/dashboard/widgetRegistry.jsx` (15 widgets, 3 data-gated). Layouts persist to `data/dashboard-layouts.json` via `GET/PUT/DELETE /api/dashboard/layouts`. Built-in layouts seeded on first read: `default` (Everything), `focus`, `morning-review`, `ops`. Keyboard-accessible layout editor with up/down reorder buttons, inline add-widget picker, inline confirm-before-delete, rename + "save as new" in-line prompts (no `window.confirm`/`prompt`). Palette integration: `⌘K` → any layout name switches instantly. Drag-and-drop deferred — reorder buttons are fully functional and a11y-correct without a new dependency. See CLAUDE.md "Dashboard Widgets & Layouts" for the widget contract.
**Problem.** `client/src/pages/Dashboard.jsx` hard-codes the widget list: `BackupWidget`, `SystemHealthWidget`, `CosDashboardWidget`, `GoalProgressWidget`, `UpcomingTasksWidget`, `DecisionLogWidget`, `DeathClockWidget`, `ProactiveAlertsWidget`, `QuickBrainCapture`, `QuickTaskWidget`, `ReviewHubCard`. Every user-visible feature competes for space on the same grid; nothing can be hidden, reordered, or scoped to context. Already called out in `PLAN.md` Future Ideas as "Dashboard Customization — Drag-and-drop widgets, named layouts."
diff --git a/client/src/components/dashboard/LayoutEditor.jsx b/client/src/components/dashboard/LayoutEditor.jsx
index f266d11696..0d65798ba4 100644
--- a/client/src/components/dashboard/LayoutEditor.jsx
+++ b/client/src/components/dashboard/LayoutEditor.jsx
@@ -81,14 +81,21 @@ export default function LayoutEditor({ layouts, activeLayoutId, onClose, onSave,
const commitDuplicate = async () => {
const trimmed = dupName.trim();
if (!trimmed) { toast.error('Name required'); return; }
- // Server-side idSchema caps ids at 60 chars; reserve 4 for a `-NN` suffix
- // so collision-dedup can't push the final id past the limit.
- const baseId = trimmed.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 56);
- if (!baseId) { toast.error('Use letters/numbers in the name'); return; }
+ // Server idSchema caps ids at 60 chars. Compute the final id in a way
+ // that always fits regardless of how many collisions we walk through —
+ // the suffix grows (-2, -10, -100) so we trim the base per-iteration.
+ const ID_MAX = 60;
+ const baseSlug = trimmed.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
+ if (!baseSlug) { toast.error('Use letters/numbers in the name'); return; }
+ const fitId = (n) => {
+ if (n <= 1) return baseSlug.slice(0, ID_MAX);
+ const suffix = `-${n}`;
+ return `${baseSlug.slice(0, ID_MAX - suffix.length)}${suffix}`;
+ };
const existingIds = new Set(layouts.map((l) => l.id));
- let id = baseId;
- let n = 2;
- while (existingIds.has(id)) id = `${baseId}-${n++}`;
+ let n = 1;
+ let id = fitId(n);
+ while (existingIds.has(id)) { n += 1; id = fitId(n); }
const ok = await onDuplicate({ id, name: trimmed, widgets }).then(() => true, () => false);
if (!ok) return;
setEditingId(id);
diff --git a/server/routes/dashboardLayouts.js b/server/routes/dashboardLayouts.js
index 46f617191e..fad5a4a2e5 100644
--- a/server/routes/dashboardLayouts.js
+++ b/server/routes/dashboardLayouts.js
@@ -1,8 +1,8 @@
/**
* GET /api/dashboard/layouts → { activeLayoutId, layouts }
- * PUT /api/dashboard/layouts/active → { activeLayoutId } (body: { id })
- * PUT /api/dashboard/layouts/:id → saves/updates a single layout
- * DELETE /api/dashboard/layouts/:id → deletes a user-created layout
+ * PUT /api/dashboard/layouts/active → { activeLayoutId, layouts } (body: { id })
+ * PUT /api/dashboard/layouts/:id → { activeLayoutId, layouts }
+ * DELETE /api/dashboard/layouts/:id → { activeLayoutId, layouts }
*/
import { Router } from 'express';
@@ -55,7 +55,7 @@ router.put('/active', asyncHandler(async (req, res) => {
}));
router.put('/:id', asyncHandler(async (req, res) => {
- const body = validateRequest(layoutSchema, { ...req.body, id: req.params.id });
+ const body = validateRequest(layoutSchema, { ...(req.body ?? {}), id: req.params.id });
res.json(await svc.saveLayout(body));
}));
diff --git a/server/services/dashboardLayouts.js b/server/services/dashboardLayouts.js
index 77aa56bf7c..c2df72115d 100644
--- a/server/services/dashboardLayouts.js
+++ b/server/services/dashboardLayouts.js
@@ -5,9 +5,9 @@
* list of widget ids; the client's widget registry decides how to render
* each id. Persisted to data/dashboard-layouts.json.
*
- * Seeded on first read with a "Default" layout (mirrors the current hardcoded
- * layout) plus "Focus", "Morning Review", and "Ops" starter layouts so the
- * feature has value out of the box.
+ * Seeded on first read with the "Everything" layout (id `default`, mirrors
+ * the current hardcoded dashboard) plus "Focus", "Morning Review", and "Ops"
+ * starter layouts so the feature has value out of the box.
*/
import { join } from 'path';