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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: reuse compact video history for collection covers
Adam Eivye40ab1ab3e7a
diff --git a/server/services/mediaAssetIndex/gallery.js b/server/services/mediaAssetIndex/gallery.jsindex e4c8fff75f..c0f8d078c7 100644--- a/server/services/mediaAssetIndex/gallery.js+++ b/server/services/mediaAssetIndex/gallery.js@@ -122,7 +122,7 @@ export async function listGalleryFacets(diskReader) {/** Collection grid covers and counts, without downloading all image sidecars. */export async function listGalleryCollectionSummaries(diskReader) {const collections = await (await import('../mediaCollections.js')).listCollections();- const videoSnapshot = await (await import('../videoGen/history.js')).loadHistory();+ const videoSnapshot = await (await import('../videoGen/history.js')).loadCompactHistory();if (!escapeHatch()) {const rows = await collectionCovers(collections.map(collection => ({id: collection.id, coverKey: collection.coverKey,diff --git a/server/services/videoGen/compactHistory.test.js b/server/services/videoGen/compactHistory.test.jsindex e2cd1cacad..f624d9344f 100644--- a/server/services/videoGen/compactHistory.test.js+++ b/server/services/videoGen/compactHistory.test.js@@ -30,6 +30,7 @@ vi.mock('../mediaAnnotations.js', () => ({ listAnnotations: async () => ({ 'videlet history;let file;let listGalleryPage;+let listGalleryCollectionSummaries;beforeEach(async () => {vi.resetModules();if (io.root) await rm(io.root, { recursive: true, force: true });@@ -39,13 +40,13 @@ beforeEach(async () => {io.accessError = null;file = join(io.root, 'video-history.json');history = await import('./history.js');- ({ listGalleryPage } = await import('../mediaAssetIndex/gallery.js'));+ ({ listGalleryPage, listGalleryCollectionSummaries } = await import('../mediaAssetIndex/gallery.js'));});afterAll(async () => { await rm(io.root, { recursive: true, force: true }); });const persist = rows => writeFile(file, JSON.stringify(rows));describe('compact history through gallery reads', () => {- it('reuses one immutable bounded projection for concurrent and repeated 1,200-video pages', async () => {+ it('reuses one immutable bounded projection for concurrent and repeated 1,200-video pages and covers', async () => {const rows = Array.from({ length: CARDINALITIES.videos }, (_, i) => mediaFixture('video', i));await persist(rows);const fullTimings = [];@@ -63,6 +64,12 @@ describe('compact history through gallery reads', () => {const warmStart = performance.now();await listGalleryPage(options, async () => []);const warmMs = performance.now() - warmStart;+ for (let index = 0; index < 2; index++) {+ expect(await listGalleryCollectionSummaries(async () => [])).toEqual([{+ id: 'unsorted', counts: { image: 0, video: 1200, all: 1200 }, total: 1200,+ cover: '/data/video-thumbnails/synthetic-video-01199.png',+ }]);+ }expect(io.reads).toBe(1);expect(pages.every(page => page.items.length === 60 && page.total === 1080)).toBe(true);const snapshot = await history.loadCompactHistory();