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

fix: drop unreleased hydrateDefaultGrid upgrade path

Adam Eivy42a416c0b420
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 0330bd41ea..fb67b275c0 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -15,13 +15,13 @@
Layouts now carry `grid: [{ id, x, y, w, h }]` in addition to the existing widget list. When a layout's grid is empty (legacy + freshly-created layouts), the renderer falls back to `synthesizeGrid` — a row-flow auto-layout based on each widget's `width` keyword and new `defaultH` field. Below 640px viewport width the grid collapses to a single-column stack and drag/resize is disabled (touch targets would fight scroll on mobile). Adding/removing widgets via the existing LayoutEditor preserves saved positions: removed widgets drop out of the grid, added widgets are auto-placed at the bottom-left.
- All four built-in layouts now ship with hand-tuned grids designed for a typical desktop viewport — most-useful widgets above the fold (~768px). **Everything**: capture row + Upcoming Tasks at top, then System Health (5-wide) with Proactive Alerts beside it, Activity Streak / Death Clock / Review Hub on the right, secondary widgets banded below, full-width Hourly Activity + Apps at the bottom. **Focus**: Quick Task compact top-left, tall Upcoming Tasks right, CoS below. **Morning Review**: Proactive Alerts top-left, tall Upcoming Tasks center, Death Clock + Goal Progress stacked top-right, Review Hub bottom-left — all 5 widgets above the fold. **Ops**: System Health top-left wide, Quick Stats top-right, CoS mid-right, Backup mid-left, Apps full-width bottom (h=11). Existing installs upgrade automatically: a read-time `hydrateDefaultGrid` swaps the new default grid into any built-in layout whose persisted grid is empty AND whose widget list still matches the default — user customizations (non-empty grids, removed/added widgets) are never overwritten.
+ All four built-in layouts ship with hand-tuned grids designed for a typical desktop viewport — most-useful widgets above the fold (~768px). **Everything**: capture row + Upcoming Tasks at top, then System Health (5-wide) with Proactive Alerts beside it, Activity Streak / Death Clock / Review Hub on the right, secondary widgets banded below, full-width Hourly Activity + Apps at the bottom. **Focus**: Quick Task compact top-left, tall Upcoming Tasks right, CoS below. **Morning Review**: Proactive Alerts top-left, tall Upcoming Tasks center, Death Clock + Goal Progress stacked top-right, Review Hub bottom-left — all 5 widgets above the fold. **Ops**: System Health top-left wide, Quick Stats top-right, CoS mid-right, Backup mid-left, Apps full-width bottom (h=11).
Cross-field server validation: grid items must reference a widget in the layout's `widgets` list, must be unique by id, and `x + w` must fit inside `GRID_COLS`. Bounds (`GRID_COLS`, `GRID_ROW_MAX`, `GRID_ITEM_H_MAX`) are exported from the service and bundled into the `LIMITS` payload so the client can enforce the same caps.
**Reuse**: extracted the inline `useContainerWidth` hook from `CalendarTab.jsx` into `client/src/hooks/useContainerWidth.js` (`ResizeObserver` + `[ref, width]` return) and wired both consumers to the shared hook.
- Files: `client/src/components/dashboard/DashboardGrid.jsx` (new — ~280 lines, free-form grid renderer + `synthesizeGrid` / `reconcileGrid` / `placeAndCompact` helpers), `client/src/hooks/useContainerWidth.js` (new), `client/src/pages/Dashboard.jsx` (Arrange/Save/Cancel buttons, draft-grid state, `renderGrid` reconcile pipeline), `client/src/components/dashboard/widgetRegistry.jsx` (`defaultH` per widget, `WIDTH_TO_COLS`, `GRID_COLS`/`GRID_DEFAULT_H` exports), `client/src/services/apiDashboard.js` (`saveDashboardLayout` accepts `grid`), `client/src/components/meatspace/tabs/CalendarTab.jsx` (uses shared hook), `server/services/dashboardLayouts.js` (`sanitizeGridItem`, grid-aware `sanitizeLayout`, `hydrateDefaultGrid`, hand-tuned default grids for all 4 built-ins, new `GRID_COLS`/`GRID_ROW_MAX`/`GRID_ITEM_H_MAX` exports), `server/routes/dashboardLayouts.js` (`gridItemSchema` + 3-refine `layoutSchema` chain), `server/routes/dashboardLayouts.test.js` (4 new test cases — grid round-trip, orphan rejection, x+w overflow, dup-id rejection, no-grid back-compat). `CLAUDE.md` documents the grid model, "Arrange" mode, and `defaultH` for future widget authors.
+ Files: `client/src/components/dashboard/DashboardGrid.jsx` (new — ~280 lines, free-form grid renderer + `synthesizeGrid` / `reconcileGrid` / `placeAndCompact` helpers), `client/src/hooks/useContainerWidth.js` (new), `client/src/pages/Dashboard.jsx` (Arrange/Save/Cancel buttons, draft-grid state, `renderGrid` reconcile pipeline), `client/src/components/dashboard/widgetRegistry.jsx` (`defaultH` per widget, `WIDTH_TO_COLS`, `GRID_COLS`/`GRID_DEFAULT_H` exports), `client/src/services/apiDashboard.js` (`saveDashboardLayout` accepts `grid`), `client/src/components/meatspace/tabs/CalendarTab.jsx` (uses shared hook), `server/services/dashboardLayouts.js` (`sanitizeGridItem`, grid-aware `sanitizeLayout`, hand-tuned default grids for all 4 built-ins, new `GRID_COLS`/`GRID_ROW_MAX`/`GRID_ITEM_H_MAX` exports), `server/routes/dashboardLayouts.js` (`gridItemSchema` + 3-refine `layoutSchema` chain), `server/routes/dashboardLayouts.test.js` (4 new test cases — grid round-trip, orphan rejection, x+w overflow, dup-id rejection, no-grid back-compat). `CLAUDE.md` documents the grid model, "Arrange" mode, and `defaultH` for future widget authors.
- **Customizable Dashboard with Saved Layouts** — the Dashboard is no longer a static hardcoded widget list. A widget registry (`client/src/components/dashboard/widgetRegistry.jsx`) describes each tile (`{ id, label, Component, width, gate? }`) and the Dashboard renders the active layout's ordered widget list over a 12-column grid. Four built-in layouts ship: **Everything** (the original), **Focus** (quick-task + cos + upcoming), **Morning Review** (alerts + upcoming + review-hub + goals + death-clock), **Ops** (system-health + cos + backup + apps + quick-stats). New layouts can be created via the layout picker → "Edit layouts…" → Save as new. Widgets can be added/removed per layout, reordered with ↑/↓ buttons (keyboard- and touch-accessible), and gated so data-dependent widgets (streak, hourly activity, quick stats) auto-hide when there's nothing to show. The Apps tile is intentionally un-gated — it renders its own "Add App" empty-state CTA on a blank install. Persisted to `data/dashboard-layouts.json` via `GET/PUT/DELETE /api/dashboard/layouts`; built-in layouts are protected from deletion. Inline-state delete/duplicate confirmations — no `window.confirm`/`prompt`.
diff --git a/server/services/dashboardLayouts.js b/server/services/dashboardLayouts.js
index b9e96f9a84..b4fe255ddf 100644
--- a/server/services/dashboardLayouts.js
+++ b/server/services/dashboardLayouts.js
@@ -213,26 +213,6 @@ export const LIMITS = Object.freeze({
gridItemHeightMax: GRID_ITEM_H_MAX,
});
-// Read-time hydration for upgrades: existing installs already have built-in
-// layouts persisted with `grid: []` (from before the grid feature shipped).
-// When we ship better default grids, we want those installs to pick them
-// up — but only when the user hasn't already arranged the layout (grid
-// non-empty) AND hasn't customized which widgets are in it. If the widget
-// list still matches the default, swap in the default grid; otherwise
-// leave grid empty and let the client's synthesizeGrid handle it.
-function hydrateDefaultGrid(layout) {
- if (!BUILTIN_IDS.has(layout.id)) return layout;
- if (layout.grid.length > 0) return layout;
- const def = DEFAULT_LAYOUTS.find((l) => l.id === layout.id);
- if (!def?.grid) return layout;
- // Widget-list match check: same set of ids (order doesn't matter for
- // grid validity since positions are explicit).
- if (layout.widgets.length !== def.widgets.length) return layout;
- const defSet = new Set(def.widgets);
- if (!layout.widgets.every((w) => defSet.has(w))) return layout;
- return { ...layout, grid: def.grid.map((g) => ({ ...g })) };
-}
-
export async function getState() {
await ensureDir(PATHS.data);
const raw = await readJSONFile(STATE_PATH, DEFAULT_STATE, { logError: false });
@@ -243,7 +223,7 @@ export async function getState() {
const s = sanitizeLayout(entry);
if (!s || seenIds.has(s.id)) continue; // first-occurrence wins; no React key collisions
seenIds.add(s.id);
- sanitized.push(hydrateDefaultGrid(s));
+ sanitized.push(s);
}
}
const layouts = sanitized.length > 0 ? sanitized : DEFAULT_LAYOUTS;