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([issue-899]): address claude review — goal status filter, test mock, null journal entry, progress clamp, empty state

Adam Eivy0a67b5142d2c
diff --git a/client/src/components/brain/tabs/BrainGraph.jsx b/client/src/components/brain/tabs/BrainGraph.jsx
index cdcaf45a83..40b8998036 100644
--- a/client/src/components/brain/tabs/BrainGraph.jsx
+++ b/client/src/components/brain/tabs/BrainGraph.jsx
@@ -324,7 +324,7 @@ export default function BrainGraph() {
if (!graphData?.nodes?.length) {
return (
<div className="text-center py-12 text-gray-500">
- No brain entities to graph. Add people, projects, ideas, admin items, or memories to see relationships.
+ No brain entities to graph. Add people, projects, ideas, admin items, memories, goals, or journal entries to see relationships.
</div>
);
}
@@ -597,7 +597,7 @@ export default function BrainGraph() {
{typeof fullRecord.progress === 'number' && (
<div className="flex items-center gap-2">
<div className="flex-1 h-1.5 bg-port-border rounded-full overflow-hidden">
- <div className="h-full bg-port-accent rounded-full" style={{ width: `${fullRecord.progress}%` }} />
+ <div className="h-full bg-port-accent rounded-full" style={{ width: `${Math.min(100, Math.max(0, fullRecord.progress))}%` }} />
</div>
<span className="text-xs text-gray-500">{fullRecord.progress}%</span>
</div>
diff --git a/client/src/services/apiBrain.js b/client/src/services/apiBrain.js
index b333646096..172e4627d3 100644
--- a/client/src/services/apiBrain.js
+++ b/client/src/services/apiBrain.js
@@ -215,7 +215,7 @@ export const getBrainGoal = (id) =>
// Brain - Journal entries (Daily Log)
export const getBrainJournalEntry = (date) =>
- request(`/brain/daily-log/${encodeURIComponent(date)}`).then(r => r?.entry ?? r);
+ request(`/brain/daily-log/${encodeURIComponent(date)}`).then(r => r?.entry ?? null);
// Brain - Graph. Bounded by design: no `focus` returns an overview of the
// most-connected nodes; a `focus` returns that node's neighborhood. The full
diff --git a/server/services/brainGraph.js b/server/services/brainGraph.js
index 94d3ecc905..9152d9c41a 100644
--- a/server/services/brainGraph.js
+++ b/server/services/brainGraph.js
@@ -67,10 +67,10 @@ async function loadNodes() {
}
}
- // Goals (identity system): active + paused goals as graph nodes
+ // Goals (identity system): active goals only (completed/abandoned excluded)
const goalsData = await getGoals().catch(() => null);
for (const goal of goalsData?.goals ?? []) {
- if (goal.status === 'archived' || goal.status === 'deleted') continue;
+ if (goal.status === 'completed' || goal.status === 'abandoned') continue;
nodes.push({
id: goal.id,
brainType: 'goals',
diff --git a/server/services/brainGraph.test.js b/server/services/brainGraph.test.js
index 42b3b6b8bd..416e4db419 100644
--- a/server/services/brainGraph.test.js
+++ b/server/services/brainGraph.test.js
@@ -13,9 +13,14 @@ vi.mock('./brainMemoryBridge.js', () => ({
bridgeKey: (type, id) => `${type}:${id}`
}));
+vi.mock('./identity.js', () => ({
+ getGoals: vi.fn()
+}));
+
import * as brainStorage from './brainStorage.js';
import * as memoryBackend from './memoryBackend.js';
import { loadBridgeMap } from './brainMemoryBridge.js';
+import { getGoals } from './identity.js';
import {
getBrainGraphSearchIndex,
getBrainGraphOverview,
@@ -27,6 +32,7 @@ beforeEach(() => {
loadBridgeMap.mockResolvedValue({});
memoryBackend.getGraphData.mockResolvedValue(null);
brainStorage.getAll.mockResolvedValue([]);
+ getGoals.mockResolvedValue({ goals: [] });
});
// A small node set fits entirely inside one overview page, so getBrainGraphOverview
@@ -233,3 +239,59 @@ describe('getBrainGraphNeighborhood', () => {
expect(edges.some(e => e.type === 'linked')).toBe(true);
});
});
+
+describe('goals and journal nodes', () => {
+ it('includes active goals as graph nodes with correct shape', async () => {
+ getGoals.mockResolvedValue({ goals: [
+ { id: 'g1', title: 'Run a marathon', description: 'sub-3h', tags: ['fitness'], status: 'active', progress: 42 }
+ ] });
+ const { nodes } = await getBrainGraphSearchIndex();
+ const goalNode = nodes.find(n => n.id === 'g1');
+ expect(goalNode).toBeDefined();
+ expect(goalNode.brainType).toBe('goals');
+ expect(goalNode.label).toBe('Run a marathon');
+ });
+
+ it('excludes completed and abandoned goals', async () => {
+ getGoals.mockResolvedValue({ goals: [
+ { id: 'g1', title: 'Done goal', status: 'completed', tags: [], progress: 100 },
+ { id: 'g2', title: 'Dropped goal', status: 'abandoned', tags: [], progress: 0 },
+ { id: 'g3', title: 'Active goal', status: 'active', tags: [], progress: 10 }
+ ] });
+ const { nodes } = await getBrainGraphSearchIndex();
+ const ids = nodes.map(n => n.id);
+ expect(ids).not.toContain('g1');
+ expect(ids).not.toContain('g2');
+ expect(ids).toContain('g3');
+ });
+
+ it('treats a getGoals failure as an empty goal list', async () => {
+ getGoals.mockRejectedValue(new Error('identity unavailable'));
+ const result = await getBrainGraphOverview();
+ expect(result.nodes).toEqual([]);
+ });
+
+ it('includes non-empty journal entries as graph nodes', async () => {
+ brainStorage.getAll.mockImplementation(async (type) =>
+ type === 'journals' ? [{ id: '2026-01-01', content: 'Hello world' }] : []
+ );
+ const { nodes } = await getBrainGraphSearchIndex();
+ const journalNode = nodes.find(n => n.id === '2026-01-01');
+ expect(journalNode).toBeDefined();
+ expect(journalNode.brainType).toBe('journals');
+ expect(journalNode.label).toBe('2026-01-01');
+ });
+
+ it('skips empty journal entries (no content and no segments)', async () => {
+ brainStorage.getAll.mockImplementation(async (type) =>
+ type === 'journals' ? [
+ { id: '2026-01-01', content: '' },
+ { id: '2026-01-02', content: 'Has content' }
+ ] : []
+ );
+ const { nodes } = await getBrainGraphSearchIndex();
+ const ids = nodes.map(n => n.id);
+ expect(ids).not.toContain('2026-01-01');
+ expect(ids).toContain('2026-01-02');
+ });
+});