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

test: align canon projection suites with the fresh-only catalog write

[._.]/ Adam Eivy298485a13872
diff --git a/server/services/catalogCanonProjection.echo.test.js b/server/services/catalogCanonProjection.echo.test.js
index 85b7f28e41..9d0654043d 100644
--- a/server/services/catalogCanonProjection.echo.test.js
+++ b/server/services/catalogCanonProjection.echo.test.js
@@ -5,7 +5,7 @@ vi.mock('./catalogDB.js', () => ({
getIngredientIdentityIds: vi.fn(async (id) => [id, `${id}-alias`]),
listRefsForIngredient: vi.fn(async () => [{ refKind: 'universe', refId: 'universe-a' }]),
getIngredientTimestamps: vi.fn(async (ids) => new Map(ids.map((id) => [id, '2026-01-01T00:00:00.000Z']))),
- updateIngredient: vi.fn(async () => ({})),
+ updateIngredientIfFresh: vi.fn(async () => ({ status: 'written', ingredient: {} })),
}));
vi.mock('./catalogDB/identityAccess.js', () => ({ getCatalogIdentityAccess: vi.fn(async () => null) }));
@@ -46,7 +46,7 @@ describe('operation-scoped catalog projection echoes', () => {
expect(await projectToCatalog(universeId, { characters: [entry(ingredient.id)] }))
.toEqual({ written: 1, skipped: 0 });
}
- expect(catalogDB.updateIngredient).toHaveBeenCalledTimes(2);
+ expect(catalogDB.updateIngredientIfFresh).toHaveBeenCalledTimes(2);
} finally {
held.release();
await forward;
@@ -73,7 +73,7 @@ describe('operation-scoped catalog projection echoes', () => {
// overlapping projection finishes. Unrelated canon still writes.
expect(result).toEqual({ written: 1, skipped: 2 });
}
- expect(catalogDB.updateIngredient.mock.calls.map(([id]) => id)).toEqual(['ingredient-b', 'ingredient-b']);
+ expect(catalogDB.updateIngredientIfFresh.mock.calls.map(([id]) => id)).toEqual(['ingredient-b', 'ingredient-b']);
expect(await projectToCatalog('universe-a', { characters: [entry(ingredient.id)] }))
.toEqual({ written: 1, skipped: 0 });
} finally {
diff --git a/server/services/catalogCanonProjection.ordering.test.js b/server/services/catalogCanonProjection.ordering.test.js
index 9d2b1abf8b..630a4b3654 100644
--- a/server/services/catalogCanonProjection.ordering.test.js
+++ b/server/services/catalogCanonProjection.ordering.test.js
@@ -134,7 +134,7 @@ describe('catalog projection ordering through persisted universe writes', () =>
characters: cur.characters.map((entry) => ({ ...entry, name: 'Universe edit' })),
}));
expect(row.name).toBe('Universe edit');
- expect(catalog.updateIngredient).toHaveBeenCalledTimes(1);
+ expect(catalog.updateIngredientIfFresh).toHaveBeenCalledTimes(1);
} finally {
release.resolve();
await projection;