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: parameterize source-erasure filters and retain the empty management list

[._.]/ Adam Eivy33edfe3780c9
diff --git a/client/src/components/timeline/ManageImportedDataPanel.jsx b/client/src/components/timeline/ManageImportedDataPanel.jsx
index 9984e0a182..70f5be0658 100644
--- a/client/src/components/timeline/ManageImportedDataPanel.jsx
+++ b/client/src/components/timeline/ManageImportedDataPanel.jsx
@@ -10,6 +10,7 @@ import { formatCount, formatDateNumeric } from '../../utils/formatters';
// export restores the rows. `onChanged` lets the page refresh the day view.
export default function ManageImportedDataPanel({ reloadKey, onChanged }) {
const [sources, setSources] = useState([]);
+ const [visible, setVisible] = useState(false);
const [target, setTarget] = useState(null);
const [typed, setTyped] = useState('');
const [busy, setBusy] = useState(false);
@@ -22,7 +23,11 @@ export default function ManageImportedDataPanel({ reloadKey, onChanged }) {
let active = true;
const current = ++generation.current;
api.getTimelineSources({ silent: true }).then((r) => {
- if (active && generation.current === current) { setSources(r?.sources || []); setError(null); }
+ if (active && generation.current === current) {
+ setSources(r?.sources || []);
+ if (r?.sources?.length) setVisible(true);
+ setError(null);
+ }
}).catch((err) => { if (active && generation.current === current) setError(err.message || 'Could not load imported data.'); });
return () => { active = false; };
}, [reloadKey]);
@@ -52,13 +57,14 @@ export default function ManageImportedDataPanel({ reloadKey, onChanged }) {
onChanged?.();
};
- if (sources.length === 0 && !error) return null;
+ if (!visible && !error) return null;
return (
<div className="rounded border border-port-border bg-port-card p-3 text-xs">
<div className="mb-2 font-medium text-gray-300">Manage imported data</div>
{error && <p role="alert" className="mb-2 text-port-error">{error}</p>}
<div role="list" tabIndex={-1}>
+ {sources.length === 0 && <p className="text-gray-400">No imported events.</p>}
{sources.map((s) => (
<CollapsibleListItem key={s.source} removing={removing === s.source} onExited={() => finishRemoval(s.source)}>
<div role="listitem">
diff --git a/client/src/components/timeline/ManageImportedDataPanel.test.jsx b/client/src/components/timeline/ManageImportedDataPanel.test.jsx
index a9cc2703c3..4b88a30bc2 100644
--- a/client/src/components/timeline/ManageImportedDataPanel.test.jsx
+++ b/client/src/components/timeline/ManageImportedDataPanel.test.jsx
@@ -31,6 +31,15 @@ it('keeps the confirmed source fixed during deletion and ignores a pre-delete co
await waitFor(() => expect(screen.queryByText('browser')).not.toBeInTheDocument());
expect(screen.getByText('discord')).toBeInTheDocument();
expect(onChanged).toHaveBeenCalledTimes(1);
+ fireEvent.click(screen.getByRole('button', { name: 'Delete' }));
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'discord' } });
+ const confirm = screen.getByRole('button', { name: 'Confirm delete' });
+ confirm.focus();
+ fireEvent.click(confirm);
+ await act(async () => { finishDelete({ deleted: 2 }); });
+ await screen.findByText('No imported events.');
+ expect(screen.getByRole('list')).toHaveFocus();
+
});
it('retains the row and confirmation and shows a refused deletion', async () => {
diff --git a/server/services/humanActivity.db.test.js b/server/services/humanActivity.db.test.js
index 9fe5a017d0..cbe4cada21 100644
--- a/server/services/humanActivity.db.test.js
+++ b/server/services/humanActivity.db.test.js
@@ -405,22 +405,24 @@ describe.skipIf(!runDb)('eraseEvents — user-driven source erasure (#12987)', (
const rows = [
mk({ source: ERASE_SOURCE, dedupeKey: 'e-1', happenedAt: '2026-01-01T10:00:00Z' }),
mk({ source: ERASE_SOURCE, dedupeKey: 'e-2', happenedAt: '2026-03-01T10:00:00Z' }),
+ mk({ source: ERASE_SOURCE, kind: 'message.sent', dedupeKey: 'e-3', happenedAt: '2026-01-02T10:00:00Z' }),
+ mk({ source: ERASE_SOURCE, dedupeKey: 'e-4', happenedAt: '2025-12-01T10:00:00Z' }),
mk({ source: KEEP_SOURCE, dedupeKey: 'k-1' }),
];
await recordEvents(rows);
expect(await eraseEvents({})).toEqual({ deleted: 0 });
- expect((await listSourceCounts()).find((s) => s.source === ERASE_SOURCE).eventCount).toBe(2);
+ expect((await listSourceCounts()).find((s) => s.source === ERASE_SOURCE).eventCount).toBe(4);
- const ranged = await eraseEvents({ source: ERASE_SOURCE, to: '2026-02-01T00:00:00Z' });
+ const ranged = await eraseEvents({ source: ERASE_SOURCE, kind: 'message.received', from: '2026-01-01T00:00:00Z', to: '2026-02-01T00:00:00Z' });
expect(ranged.deleted).toBe(1);
- expect(await listEvents({ source: ERASE_SOURCE })).toHaveLength(1);
+ expect(await listEvents({ source: ERASE_SOURCE })).toHaveLength(3);
const all = await eraseEvents({ source: ERASE_SOURCE });
- expect(all.deleted).toBe(1);
+ expect(all.deleted).toBe(3);
expect(await listEvents({ source: KEEP_SOURCE })).toHaveLength(1);
- const again = await recordEvents(rows.slice(0, 2));
- expect(again.recorded).toBe(2);
+ const again = await recordEvents(rows.slice(0, 4));
+ expect(again.recorded).toBe(4);
});
});
diff --git a/server/services/humanActivity.js b/server/services/humanActivity.js
index 2388bd2619..3f840eb32a 100644
--- a/server/services/humanActivity.js
+++ b/server/services/humanActivity.js
@@ -545,9 +545,9 @@ export async function eraseEvents({ source, kind, from, to } = {}) {
await ensureReady();
const params = [String(source)];
const clauses = ['source = $1'];
- if (kind) { params.push(String(kind)); clauses.push(`kind = ${params.length}`); }
- if (from) { params.push(new Date(from).toISOString()); clauses.push(`happened_at >= ${params.length}`); }
- if (to) { params.push(new Date(to).toISOString()); clauses.push(`happened_at < ${params.length}`); }
+ if (kind) { params.push(String(kind)); clauses.push(`kind = $${params.length}`); }
+ if (from) { params.push(new Date(from).toISOString()); clauses.push(`happened_at >= $${params.length}`); }
+ if (to) { params.push(new Date(to).toISOString()); clauses.push(`happened_at < $${params.length}`); }
const result = await query(
`DELETE FROM human_activity_events WHERE ${clauses.join(' AND ')}`,
params,