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

fix: load authGate lazily for the Music Video overlay check and classify the Spotify credential route (#13055)

[._.]/ Adam Eivy369c92b6dc72
diff --git a/server/hostControlCoverage.test.js b/server/hostControlCoverage.test.js
index 528448d907..5a0e84b2bc 100644
--- a/server/hostControlCoverage.test.js
+++ b/server/hostControlCoverage.test.js
@@ -1084,7 +1084,7 @@ const REVIEWED_OPEN_MUTATIONS = [
['DELETE /api/sharing/subscriptions/:id', REMOVES_RECORD],
// /api/spotify
['POST /api/spotify/auth/clear', REMOVES_RECORD],
- ['POST /api/spotify/auth/credentials', RECORDS],
+ ['POST /api/spotify/auth/credentials', CONNECTOR_CREDENTIAL],
['POST /api/spotify/playlists/sync', EXTERNAL_SYNC],
['POST /api/spotify/sync', EXTERNAL_SYNC],
// /api/sprites
diff --git a/server/routes/musicVideo.js b/server/routes/musicVideo.js
index 4eadd34f28..0bd1ae3d4b 100644
--- a/server/routes/musicVideo.js
+++ b/server/routes/musicVideo.js
@@ -18,7 +18,6 @@ import { presentMusicVideoDependencies } from '../lib/musicVideoDependencies.js'
import { finishedOutsideBlocker } from '../lib/musicVideoFinishedOutside.js';
import { getProductionReview, saveProductionDraft, prepareProductionReview, approveProductionReview, lockProductionShots, renderProductionProof, requireProductionReviewer, importProductionPlanning, bindProductionShot, addProductionFeedback, closeProductionFeedback, syncLyricAnchors, removeStaleStoryboardRows, reviseProductionFromFeedback, revertProductionInput } from '../services/musicVideo/productionReviewService.js';
import { asyncHandler, ServerError } from '../lib/errorHandler.js';
-import { requestHasHostControl } from '../services/authGate.js';
import {
validateRequest,
musicVideoAudioTimingPreviewSchema,
@@ -898,10 +897,12 @@ router.post('/:id/code/sections/:sectionId/regenerate', asyncHandler(async (req,
// The check renders the document in the headless composition browser, so it
// runs only for a caller with host control (#13055); anyone else gets the
// import alone, and the gated production-review text check runs it later.
+// authGate loads lazily: this router is reached by many suites that mock settings.
const checkOverlayTextAfterImport = (req, projectId) => {
- if (!requestHasHostControl(req)) return;
- import('../services/musicVideo/overlayTextService.js')
- .then(({ checkOverlayTextInBackground }) => checkOverlayTextInBackground(projectId))
+ import('../services/authGate.js')
+ .then(({ requestHasHostControl }) => requestHasHostControl(req)
+ && import('../services/musicVideo/overlayTextService.js')
+ .then(({ checkOverlayTextInBackground }) => checkOverlayTextInBackground(projectId)))
.catch((err) => console.error(`❌ Overlay text check did not start: ${err.message}`));
};
diff --git a/server/services/messageSender.test.js b/server/services/messageSender.test.js
index f4e491ca35..717073ceab 100644
--- a/server/services/messageSender.test.js
+++ b/server/services/messageSender.test.js
@@ -150,7 +150,8 @@ describe('draft send workflow', () => {
expect(doubles.sendGmail).not.toHaveBeenCalled();
await approveDraft('draft-1');
doubles.getAccount.mockImplementationOnce(async () => {
- await updateDraft('draft-1', { body: 'Latest approved content', accountId: 'other-account', sendVia: 'playwright' });
+ // A content edit drops approval unless it re-approves (#13055); this one does.
+ await updateDraft('draft-1', { body: 'Latest approved content', status: 'approved', accountId: 'other-account', sendVia: 'playwright' });
return { id: 'account-1', type: 'gmail' };
});
await sendDraft('draft-1');