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: show files at the root of data/ as their own treemap tile

[._.]/ Adam Eivy5c2f15c66a4d
diff --git a/client/src/components/dataManager/DataTreemap.jsx b/client/src/components/dataManager/DataTreemap.jsx
index 46a624098d..27aafa00ef 100644
--- a/client/src/components/dataManager/DataTreemap.jsx
+++ b/client/src/components/dataManager/DataTreemap.jsx
@@ -44,14 +44,26 @@ function NestedItems({ items, width, height }) {
});
}
-export default function DataTreemap({ categories, selectedKey, detail, onSelect }) {
+// Files sitting directly in data/ (settings, state JSON) count toward the
+// total but belong to no category directory. Without this tile the
+// directories would be scaled to fill the whole map and overstate their share.
+const LOOSE_KEY = '__loose-files';
+
+export default function DataTreemap({ categories, looseBytes = 0, selectedKey, detail, onSelect }) {
const [ref, measured] = useContainerWidth();
const width = measured || FALLBACK_WIDTH;
const height = mapHeight(width);
const tiles = useMemo(
- () => squarifyTreemap(categories || [], width, height, (c) => c.size),
- [categories, width, height],
+ () => squarifyTreemap(
+ looseBytes > 0
+ ? [...(categories || []), { key: LOOSE_KEY, label: 'Loose files', size: looseBytes, loose: true }]
+ : categories || [],
+ width,
+ height,
+ (c) => c.size,
+ ),
+ [categories, looseBytes, width, height],
);
// One wrapper for both states: useContainerWidth observes the element it
@@ -78,7 +90,10 @@ export default function DataTreemap({ categories, selectedKey, detail, onSelect
key={cat.key}
type="button"
onClick={() => onSelect(cat.key)}
- title={`${cat.label} — ${formatBytes(cat.size)} · ${kind.label}`}
+ disabled={cat.loose}
+ title={cat.loose
+ ? `Files directly in data/ (settings and state) — ${formatBytes(cat.size)}`
+ : `${cat.label} — ${formatBytes(cat.size)} · ${kind.label}`}
aria-pressed={selected}
className={`absolute flex flex-col justify-start overflow-hidden rounded-md border-t-2 text-left transition-colors ${kind.tile} ${kind.edge} ${selected ? 'ring-2 ring-white/70 z-10' : ''}`}
style={{ left: x, top: y, width: tileW, height: tileH, ...(kind.hatch ? HATCH_STYLE : null) }}
diff --git a/client/src/pages/DataManager.jsx b/client/src/pages/DataManager.jsx
index afd445f78c..e07bf0d208 100644
--- a/client/src/pages/DataManager.jsx
+++ b/client/src/pages/DataManager.jsx
@@ -508,7 +508,12 @@ export default function DataManager() {
const categories = overview?.categories || [];
const maxSize = categories[0]?.size || 1;
- const totalFiles = categories.reduce((sum, c) => sum + (c.fileCount || 0), 0);
+ const categoryBytes = categories.reduce((sum, c) => sum + (c.size || 0), 0);
+ const looseBytes = Math.max(0, (overview?.totalSize || 0) - categoryBytes);
+ // Older servers omit totalFileCount; the category sum then undercounts only
+ // the files sitting directly in data/.
+ const totalFiles = overview?.totalFileCount
+ ?? categories.reduce((sum, c) => sum + (c.fileCount || 0), 0);
const presentKinds = DATA_KIND_ORDER.filter((k) => categories.some((c) => dataKindOf(c) === k));
const selectedCat = categories.find((c) => c.key === expandedCat) || null;
@@ -567,6 +572,7 @@ export default function DataManager() {
{/* Disk-usage map — click a tile to select it and nest its entries */}
<DataTreemap
categories={categories}
+ looseBytes={looseBytes}
selectedKey={expandedCat}
detail={detail}
onSelect={handleExpand}
diff --git a/client/src/pages/DataManager.test.jsx b/client/src/pages/DataManager.test.jsx
index 8ca3162f4d..ddb1c83058 100644
--- a/client/src/pages/DataManager.test.jsx
+++ b/client/src/pages/DataManager.test.jsx
@@ -407,6 +407,18 @@ describe('DataManager treemap + selection panel', () => {
expect(panel).toHaveTextContent('Reclaimable');
});
+ // data/ holds settings/state JSON at its root — counted in totalSize but in no
+ // category. The map must give those bytes a tile rather than stretch the
+ // directories over the whole area.
+ it('gives files directly in data/ their own non-selectable tile', async () => {
+ getDataOverview.mockResolvedValue({ ...overview, totalSize: 4000, totalFileCount: 20 });
+ render(<DataManager />);
+ const loose = await screen.findByRole('button', { name: /^Loose files/ });
+ expect(loose).toBeDisabled();
+ expect(loose).toHaveAttribute('title', expect.stringContaining('Files directly in data/'));
+ expect(screen.getByText(/20 files · 2 categories/)).toBeInTheDocument();
+ });
+
it('shortlists only whole-category reclaim and shows disk headroom', async () => {
render(<DataManager />);
const panel = await screen.findByRole('complementary', { name: 'Selection details' });
diff --git a/server/services/dataManager.js b/server/services/dataManager.js
index ea615cddb5..10f98fb406 100644
--- a/server/services/dataManager.js
+++ b/server/services/dataManager.js
@@ -295,6 +295,7 @@ export async function getDataOverview({ strict = false } = {}) {
return {
totalSize: totalResult.size,
+ totalFileCount: totalResult.fileCount,
categories,
disk,
dataDir: 'data'