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: accept all stored connector sources for scoped event erasure

[._.]/ Adam Eivy3488b73a0a80
diff --git a/server/routes/timeline.js b/server/routes/timeline.js
index b954b493cd..3f37294a26 100644
--- a/server/routes/timeline.js
+++ b/server/routes/timeline.js
@@ -103,15 +103,10 @@ const eventsQuerySchema = z.object({
limit: z.coerce.number().int().min(1).max(2000).optional(),
});
-// Sources the Timeline store can hold; erasure is limited to these so a typo
-// 400s instead of reporting a successful zero-row delete.
-export const ERASABLE_SOURCES = [
- 'browser', 'calendar', 'discord', 'gmail', 'google-calendar', 'imessage',
- 'location', 'outlook', 'outlook-calendar', 'signal', 'spotify', 'whatsapp', 'youtube',
-];
-
+// The store accepts connector-defined source identifiers. Require an exact,
+// non-empty source instead of duplicating its evolving producer set here.
const eraseQuerySchema = z.object({
- source: z.enum(ERASABLE_SOURCES),
+ source: z.string().min(1),
kind: z.string().max(64).optional(),
from: z.string().datetime().optional(),
to: z.string().datetime().optional(),
diff --git a/server/routes/timeline.test.js b/server/routes/timeline.test.js
index d774a09888..5797b6b719 100644
--- a/server/routes/timeline.test.js
+++ b/server/routes/timeline.test.js
@@ -459,15 +459,23 @@ describe('timeline erase routes (#12987)', () => {
expect(humanActivity.eraseEvents).toHaveBeenCalledWith({ source: 'location', from: '2026-01-01T00:00:00.000Z' });
});
- it('rejects a missing or unknown source without deleting', async () => {
+ it('rejects a missing or empty source without deleting', async () => {
expect((await request(app).delete('/api/timeline/events')).status).toBe(400);
- expect((await request(app).delete('/api/timeline/events?source=nope')).status).toBe(400);
+ expect((await request(app).delete('/api/timeline/events?source=')).status).toBe(400);
expect(humanActivity.eraseEvents).not.toHaveBeenCalled();
});
- it('GET /sources lists per-source counts', async () => {
- const r = await request(app).get('/api/timeline/sources');
- expect(r.status).toBe(200);
- expect(r.body.sources[0].source).toBe('location');
+ it('accepts every listed connector source for exact scoped erasure', async () => {
+ const sources = ['location', 'imap', 'teams', `connector-${'x'.repeat(80)}`]
+ .map(source => ({ source, eventCount: 4 }));
+ humanActivity.listSourceCounts.mockResolvedValueOnce(sources);
+ const listed = await request(app).get('/api/timeline/sources');
+ expect(listed.status).toBe(200);
+ expect(listed.body.sources).toEqual(sources);
+ for (const { source } of listed.body.sources) {
+ const erased = await request(app).delete('/api/timeline/events').query({ source });
+ expect(erased.status).toBe(200);
+ expect(humanActivity.eraseEvents).toHaveBeenLastCalledWith({ source });
+ }
});
});