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: worldbuilding refine skips influences write when a sublist is locked (#2176)
Adam Eivy495b3db5b997
diff --git a/server/services/pipeline/foundationJudge.js b/server/services/pipeline/foundationJudge.jsindex c12b04eab4..24f193a775 100644--- a/server/services/pipeline/foundationJudge.js+++ b/server/services/pipeline/foundationJudge.js@@ -494,7 +494,13 @@ async function refineWorld(universeId, { providerId, model }) {if (locked.logline !== true && filled(expanded.logline)) patch.logline = expanded.logline;if (locked.premise !== true && filled(expanded.premise)) patch.premise = expanded.premise;if (locked.styleNotes !== true && filled(expanded.styleNotes)) patch.styleNotes = expanded.styleNotes;- if (locked.influences !== true && expanded.influences && typeof expanded.influences === 'object') patch.influences = expanded.influences;+ // `influences` is an { embrace, avoid } object and updateUniverse replaces it+ // WHOLESALE — but the lockable keys are the two SUBLISTS+ // (`influencesEmbrace`/`influencesAvoid`, see universeBuilder LOCKABLE_FIELDS),+ // not `influences`. A wholesale write would clobber a locked sublist, so only+ // write influences when NEITHER sublist is locked.+ const influencesLocked = locked.influencesEmbrace === true || locked.influencesAvoid === true;+ if (!influencesLocked && expanded.influences && typeof expanded.influences === 'object') patch.influences = expanded.influences;if (!Object.keys(patch).length) return null; // all locked or nothing authored → no-opwrote = true;return patch;diff --git a/server/services/pipeline/foundationJudge.test.js b/server/services/pipeline/foundationJudge.test.jsindex adcc254759..5328fe547d 100644--- a/server/services/pipeline/foundationJudge.test.js+++ b/server/services/pipeline/foundationJudge.test.js@@ -274,13 +274,29 @@ describe('applyFoundationFix — dimension → owning-service routing table', ()});it('worldbuilding refine reports applied:false when EVERY refinable field is locked', async () => {- const uni = { id: 'uni-1', name: 'U', locked: { logline: true, premise: true, styleNotes: true, influences: true } };+ const uni = { id: 'uni-1', name: 'U', locked: { logline: true, premise: true, styleNotes: true, influencesEmbrace: true, influencesAvoid: true } };universeBuilder.getUniverse.mockResolvedValue(uni);+ universeBuilderExpand.expandWorldTemplate.mockResolvedValue({ logline: 'L2', premise: 'P2', styleNotes: 'S2', influences: { embrace: ['x'], avoid: [] } });universeBuilder.updateUniverse.mockImplementation(async (id, m) => { const p = typeof m === 'function' ? m(uni) : m; return p === null ? { id } : { id, ...p }; });const r = await applyFoundationFix('ser-1', 'worldbuilding', {});expect(r).toMatchObject({ dimension: 'worldbuilding', applied: false });});+ it('worldbuilding refine does NOT write influences when a sublist is locked (influencesAvoid)', async () => {+ // Only the influence sublists are lockable; `influences` is replaced+ // wholesale, so a locked avoid-list must block the whole influences write.+ const uni = { id: 'uni-1', name: 'U', locked: { influencesAvoid: true } };+ universeBuilder.getUniverse.mockResolvedValue(uni);+ universeBuilderExpand.expandWorldTemplate.mockResolvedValue({ logline: 'L2', premise: 'P2', styleNotes: 'S2', influences: { embrace: ['new'], avoid: ['clobber'] } });+ let writtenPatch = null;+ universeBuilder.updateUniverse.mockImplementation(async (id, m) => { writtenPatch = typeof m === 'function' ? m(uni) : m; return { id, ...(writtenPatch || {}) }; });+ const r = await applyFoundationFix('ser-1', 'worldbuilding', {});+ expect(writtenPatch).not.toHaveProperty('influences');+ // the unlocked scalars still land+ expect(writtenPatch).toMatchObject({ logline: 'L2', premise: 'P2', styleNotes: 'S2' });+ expect(r.applied).toBe(true);+ });+it('routes craft → the same universe world refine as worldbuilding', async () => {const uni = { id: 'uni-1', name: 'U' };universeBuilder.getUniverse.mockResolvedValue(uni);