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-730]): accept storyBuilder in the sync route category enum

[._.]/ Adam Eivy2487020decc4
diff --git a/server/routes/dataSync.js b/server/routes/dataSync.js
index a60add2333..6a2a47fa11 100644
--- a/server/routes/dataSync.js
+++ b/server/routes/dataSync.js
@@ -13,7 +13,10 @@ import { asyncHandler, ServerError } from '../lib/errorHandler.js';
const router = Router();
-const categoryParam = z.enum(['goals', 'character', 'digitalTwin', 'meatspace', 'universe', 'pipeline', 'mediaCollections', 'videoHistory']);
+// MUST stay in sync with dataSync.getSupportedCategories() — a category
+// registered in the service but absent here 400s before its snapshot/apply
+// handler can run (the latent bug #730 hit for `storyBuilder`).
+const categoryParam = z.enum(['goals', 'character', 'digitalTwin', 'meatspace', 'universe', 'pipeline', 'mediaCollections', 'videoHistory', 'storyBuilder']);
// Tombstone GC manual trigger. Declared BEFORE `/:category/*` so the literal
// "tombstones" segment wins Express's first-match lookup (categoryParam's
diff --git a/server/routes/dataSync.test.js b/server/routes/dataSync.test.js
index 48c4f1bd2f..08ef77ac7b 100644
--- a/server/routes/dataSync.test.js
+++ b/server/routes/dataSync.test.js
@@ -113,4 +113,17 @@ describe('GET /api/sync/:category/checksum — forPeer scoping', () => {
expect(res.status).toBe(200);
expect(getChecksum).toHaveBeenCalledWith('universe', { forPeerId: undefined });
});
+
+ // The category enum is hand-maintained and MUST cover every category the
+ // service supports (a missing one 400s before the snapshot handler runs —
+ // the latent bug #730 hit for `storyBuilder`). Assert each known snapshot
+ // category is accepted (non-400) so a future addition that forgets the enum
+ // is caught here.
+ it.each([
+ 'goals', 'character', 'digitalTwin', 'meatspace',
+ 'universe', 'pipeline', 'mediaCollections', 'videoHistory', 'storyBuilder',
+ ])('accepts the %s category (enum parity with getSupportedCategories)', async (category) => {
+ const res = await request(buildApp()).get(`/api/sync/${category}/checksum`);
+ expect(res.status).not.toBe(400);
+ });
});