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
test([wardrobe-appearance-id-route-validation]): guard enqueueVisualImage enforcement wiring
[._.]/ Adam Eivy075021534969
diff --git a/server/services/pipeline/visualStages.test.js b/server/services/pipeline/visualStages.test.jsindex d3f5af67b8..8446a57d5a 100644--- a/server/services/pipeline/visualStages.test.js+++ b/server/services/pipeline/visualStages.test.js@@ -82,8 +82,13 @@ const {refineComicPanelPrompt,refineStoryboardScenePrompt,assertCharacterAppearancesResolve,+ enqueueVisualImage,} = await import('./visualStages.js');+// The universeBuilder mock's getUniverse is auto-captured here so individual+// tests can feed enqueueVisualImage a canon (pickCanon reads universe.characters).+const { getUniverse } = await import('../universeBuilder.js');+beforeEach(() => {getIssueMock.mockClear();updateStageMock.mockClear();@@ -904,3 +909,42 @@ describe('assertCharacterAppearancesResolve', () => {expect(() => assertCharacterAppearancesResolve([{ wardrobeId: 'wd-coat' }], characters)).not.toThrow();});});++// Guards the WIRING (not just the pure helper): removing the+// assertCharacterAppearancesResolve call from enqueueVisualImage must turn+// these red, otherwise the request-boundary contract could silently regress.+describe('enqueueVisualImage characterAppearances enforcement', () => {+ const canonWorld = {+ characters: [+ { id: 'char-aria', name: 'Aria', physicalDescription: 'tall', wardrobes: [{ id: 'wd-coat', name: 'Trench', description: 'long coat' }] },+ ],+ };++ it('rejects a dangling characterId with a 400 before enqueueing', async () => {+ getUniverse.mockResolvedValueOnce(canonWorld);+ await expect(enqueueVisualImage('iss-test', 'storyboards', {+ description: 'A scene with Aria',+ characterAppearances: [{ characterId: 'char-ghost' }],+ })).rejects.toMatchObject({ status: 400, code: 'PIPELINE_VISUAL_BAD_CHARACTER' });+ expect(enqueueJobMock).not.toHaveBeenCalled();+ });++ it('rejects a mismatched wardrobeId with a 400 before enqueueing', async () => {+ getUniverse.mockResolvedValueOnce(canonWorld);+ await expect(enqueueVisualImage('iss-test', 'storyboards', {+ description: 'A scene with Aria',+ characterAppearances: [{ characterId: 'char-aria', wardrobeId: 'wd-nope' }],+ })).rejects.toMatchObject({ status: 400, code: 'PIPELINE_VISUAL_BAD_WARDROBE' });+ expect(enqueueJobMock).not.toHaveBeenCalled();+ });++ it('enqueues when picks resolve (valid wardrobe + null wardrobe)', async () => {+ getUniverse.mockResolvedValueOnce(canonWorld);+ const result = await enqueueVisualImage('iss-test', 'storyboards', {+ description: 'A scene with Aria',+ characterAppearances: [{ characterId: 'char-aria', wardrobeId: 'wd-coat' }],+ });+ expect(result.jobId).toBe('job-fake-1234');+ expect(enqueueJobMock).toHaveBeenCalledTimes(1);+ });+});