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([issue-726]): address codex review
[._.]/ Adam Eivyf4eaba961b07
diff --git a/server/lib/collectionStore.test.js b/server/lib/collectionStore.test.jsindex 4f879324dd..ac5f6b1d29 100644--- a/server/lib/collectionStore.test.js+++ b/server/lib/collectionStore.test.js@@ -118,13 +118,13 @@ describe('config slot convention', () => {expect(idx.config.runs.map((r) => r.id).sort()).toEqual(['r1', 'r2', 'r3']);});- it('defaultTypeIndexConfig seeds the slot once but is NOT re-applied on later writes', async () => {+ it('defaultTypeIndexConfig seeds a fresh slot but is NOT re-applied on later writes', async () => {const store = createCollectionStore({dir, type: 'universes', schemaVersion: 1,defaultTypeIndexConfig: { runs: [], featureFlags: { beta: false } },});- // First write only touches runs; the seeded featureFlags is NOT re-merged- // because saveTypeIndex shallow-merges over the CURRENT on-disk config.+ // First write to a fresh (missing) index seeds the default, then merges the+ // patch over it — so the seeded featureFlags rides along on this first save.await store.saveTypeIndex({ config: { runs: [{ id: 'r1' }] } });const seeded = await store.loadTypeIndex();expect(seeded.config).toEqual({ runs: [{ id: 'r1' }], featureFlags: { beta: false } });@@ -134,6 +134,25 @@ describe('config slot convention', () => {expect(idx.config.featureFlags).toEqual({ beta: true });expect(idx.config.runs).toEqual([{ id: 'r1' }]);});++ it('a default key absent from an EXISTING on-disk config is NOT re-injected on a later patch', async () => {+ // Pre-seed disk with a valid index whose config lacks `featureFlags`, so the+ // only way the key could reappear is if the default were re-merged on write.+ // It must NOT — saveTypeIndex shallow-merges the patch over the current+ // on-disk config, never over `defaultTypeIndexConfig`.+ writeFileSync(join(dir, 'index.json'), JSON.stringify({+ schemaVersion: 1, type: 'universes', config: { runs: [{ id: 'r0' }] },+ updatedAt: new Date().toISOString(),+ }));+ const store = createCollectionStore({+ dir, type: 'universes', schemaVersion: 1,+ defaultTypeIndexConfig: { runs: [], featureFlags: { beta: false } },+ });+ await store.saveTypeIndex({ config: { runs: [{ id: 'r0' }, { id: 'r1' }] } });+ const idx = await store.loadTypeIndex();+ expect(idx.config).toEqual({ runs: [{ id: 'r0' }, { id: 'r1' }] });+ expect('featureFlags' in idx.config).toBe(false);+ });});describe('saveOne / loadOne / deleteOne', () => {