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: preserve legacy Music Video sync compatibility (#3245)
[._.]/ Adam Eivy7cd35e70383c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5a4efdbe6b..7ca4afb6fb 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,7 +2,7 @@## Music Video-- **[issue-3245] Synced Music Video projects now use each machine's own render backends.** Image and video backend pins no longer cross federation boundaries or overwrite a peer's locally usable choices, while shared model and pacing settings continue to sync.+- **[issue-3245] Synced Music Video projects now use each machine's own render backends.** Image and video backend pins no longer overwrite a peer's locally usable choices, while shared model and pacing settings continue to sync.## POSTdiff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex de9f5e5ac6..1e775e8ccd 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -1016,7 +1016,7 @@ export default function MusicVideo() {<selectid="mv-video-backend"value={savedVideoSettings.backend}- onChange={(e) => handleVideoSettingsChange({ backend: e.target.value })}+ onChange={(e) => handleVideoSettingsChange({ backend: e.target.value || null })}disabled={videoSettingsSaving || Object.keys(genVideoScenes).length > 0}title="Saved renderer for this project's scene videos"className="bg-port-bg border border-port-border rounded px-1.5 py-1.5 text-sm disabled:opacity-50"diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 014b11bd84..e4f4be39ae 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -229,6 +229,20 @@ describe('MusicVideo project video renderer', () => {expect(generateVideo.mock.calls.at(-1)[0]).not.toHaveProperty('modelId');});+ it('clears an existing backend pin with the Install default option', async () => {+ await openProject(PROJECT_NO_CLIP);++ fireEvent.change(await screen.findByLabelText('Scene video renderer'), {+ target: { value: '' },+ });++ await waitFor(() => expect(updateMusicVideoProject).toHaveBeenCalledWith(+ 'mv-2',+ { videoSettings: { backend: null } },+ { silent: true },+ ));+ });+it('persists the local model and uses it for scene generation', async () => {generateVideo.mockResolvedValue({ jobId: 'video-job-1' });await openProject(PROJECT_NO_CLIP);diff --git a/server/lib/conflictJournal.js b/server/lib/conflictJournal.jsindex 216fac0a7d..352ea2c225 100644--- a/server/lib/conflictJournal.js+++ b/server/lib/conflictJournal.js@@ -35,7 +35,7 @@ import { randomUUID, createHash } from 'crypto';import { PATHS, atomicWrite, readJSONFile, ensureDir } from './fileUtils.js';import { createCollectionStore } from './collectionStore.js';import { canonicalStringify, isPlainObject } from './objects.js';-import { sanitizeRecordForWire } from './syncWire.js';+import { sanitizeRecordForWire, stripMusicVideoLocalRenderPins } from './syncWire.js';const JOURNAL_TYPE_SCHEMA_VERSION = 1;const BASE_HASH_FILE = () => join(PATHS.data, 'sharing', 'sync_base_hashes.json');@@ -169,6 +169,8 @@ export function contentHashForRecord(kind, record, { maxVersion } = {}) {let hashInput = wire;if (kind === 'mediaCollection') {hashInput = projectCollectionScalars(wire);+ } else if (kind === 'musicVideoProject') {+ hashInput = stripMusicVideoLocalRenderPins(wire);} else if (HASH_EXCLUDED_FIELDS[kind] || HASH_FIELD_VERSION_BY_KIND[kind]) {const excluded = HASH_EXCLUDED_FIELDS[kind] || [];const introducedAt = HASH_FIELD_VERSION_BY_KIND[kind];diff --git a/server/lib/conflictJournal.test.js b/server/lib/conflictJournal.test.jsindex fad3214c62..088643435f 100644--- a/server/lib/conflictJournal.test.js+++ b/server/lib/conflictJournal.test.js@@ -233,6 +233,23 @@ describe('conflictJournal', () => {.not.toBe(cj.contentHashForRecord('issue', iss({ title: 'B' })));});+ it('Music Video content hash ignores each install render pins (#3245)', () => {+ const base = {+ id: 'mv-1',+ name: 'Example Video',+ videoSettings: { modelId: 'shared-model', backend: 'local' },+ };+ const otherPins = {+ ...base,+ imageMode: 'grok',+ imageModelId: 'example-image-model',+ videoSettings: { ...base.videoSettings, backend: 'grok' },+ };++ expect(cj.contentHashForRecord('musicVideoProject', base))+ .toBe(cj.contentHashForRecord('musicVideoProject', otherPins));+ });+it('a pure-renumber local drift does NOT journal a conflict when a real remote edit arrives', async () => {const base = iss({ number: 1 });await cj.setSyncBaseHash('issue', 'iss-1', cj.contentHashForRecord('issue', base));diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.jsindex 153ba73865..73ac6c3464 100644--- a/server/lib/musicVideoValidation.js+++ b/server/lib/musicVideoValidation.js@@ -31,7 +31,8 @@ export const musicVideoConceptSchema = z.object({// is optional because Grok does not consume it; the video-gen route performs// the authoritative installed-model validation when a local render starts.export const musicVideoVideoSettingsSchema = z.object({- backend: z.enum(['local', 'grok']).optional(),+ // null clears the per-project pin so this install's configured default wins.+ backend: z.enum(['local', 'grok']).nullable().optional(),modelId: z.string().max(64).nullable().optional(),grokDuration: z.union([z.literal(6), z.literal(10)]).optional(),generationMode: z.enum(['image', 'audioReactive']).optional(),diff --git a/server/lib/syncWire.js b/server/lib/syncWire.jsindex 1a903e1256..5d1bff84b0 100644--- a/server/lib/syncWire.js+++ b/server/lib/syncWire.js@@ -18,6 +18,23 @@ export function sanitizeSoftDeleteFields(raw) {return { deleted, deletedAt };}+/**+ * Remove Music Video render choices that belong to the receiving install.+ * Transport keeps the legacy `videoSettings.backend` by default so an older+ * receiver is not regressed; upgraded receivers and content hashing opt into+ * stripping it as well.+ */+export function stripMusicVideoLocalRenderPins(record, { stripVideoBackend = true } = {}) {+ if (!record || typeof record !== 'object' || Array.isArray(record)) return record;+ const { imageMode: _imageMode, imageModelId: _imageModelId, ...shared } = record;+ if (stripVideoBackend && shared.videoSettings+ && typeof shared.videoSettings === 'object' && !Array.isArray(shared.videoSettings)) {+ const { backend: _backend, ...sharedVideoSettings } = shared.videoSettings;+ shared.videoSettings = sharedVideoSettings;+ }+ return shared;+}+// Single source of truth for what fields cross the federated-peer wire.//// Two transports carry universe / series / issue records between peers:@@ -202,17 +219,12 @@ export function sanitizeRecordForWire(kind, record) {// preserving the rest of videoSettings (model, pacing, generation mode).// Stripping also keeps the wire/hash form byte-stable with peers from// before these fields shipped, so no schema-version gate is required.- const {- deleted: _d,- deletedAt: _da,- imageMode: _imageMode,- imageModelId: _imageModelId,- ...rest- } = record;- if (rest.videoSettings && typeof rest.videoSettings === 'object' && !Array.isArray(rest.videoSettings)) {- const { backend: _backend, ...sharedVideoSettings } = rest.videoSettings;- rest.videoSettings = sharedVideoSettings;- }+ // `videoSettings.backend` predates the local-pin contract. Keep it on+ // transport for older receivers whose LWW merge still expects it;+ // upgraded receivers strip it before persistence, and content hashing+ // excludes it so local choices never create phantom divergence.+ const projected = stripMusicVideoLocalRenderPins(record, { stripVideoBackend: false });+ const { deleted: _d, deletedAt: _da, ...rest } = projected;return { ...rest, ...sanitizeSoftDeleteFields(record) };}case 'writersRoomWork': {diff --git a/server/lib/syncWire.test.js b/server/lib/syncWire.test.jsindex 3598cd6a2a..9e708dc91e 100644--- a/server/lib/syncWire.test.js+++ b/server/lib/syncWire.test.js@@ -201,7 +201,7 @@ describe('syncWire', () => {expect(series.styleImageRefs).toEqual(['x.png']);});- it('strips Music Video render pins byte-for-byte against a pre-field peer (#3245)', () => {+ it('strips Music Video image pins while retaining the legacy backend wire shape (#3245)', () => {const withPins = sanitizeRecordForWire('musicVideoProject', {id: 'mv-1',name: 'Example Video',@@ -218,6 +218,7 @@ describe('syncWire', () => {id: 'mv-1',name: 'Example Video',videoSettings: {+ backend: 'grok',modelId: 'example-video-model',grokDuration: 10,generationMode: 'image',@@ -226,7 +227,7 @@ describe('syncWire', () => {expect(withPins.imageMode).toBeUndefined();expect(withPins.imageModelId).toBeUndefined();- expect(withPins.videoSettings.backend).toBeUndefined();+ expect(withPins.videoSettings.backend).toBe('grok');expect(JSON.stringify(withPins)).toBe(JSON.stringify(preField));});diff --git a/server/routes/musicVideo.test.js b/server/routes/musicVideo.test.jsindex 8dc7716fe2..525206b37e 100644--- a/server/routes/musicVideo.test.js+++ b/server/routes/musicVideo.test.js@@ -141,6 +141,13 @@ describe('musicVideo routes', () => {expect(svc.updateProject).toHaveBeenCalledWith('mv-1', { videoSettings });});+ it('PATCH /:id accepts null to clear the project video-backend pin', async () => {+ const videoSettings = { backend: null };+ const r = await request(app).patch('/api/music-video/mv-1').send({ videoSettings });+ expect(r.status).toBe(200);+ expect(svc.updateProject).toHaveBeenCalledWith('mv-1', { videoSettings });+ });+it('PATCH /:id rejects invalid video-renderer settings', async () => {const r = await request(app).patch('/api/music-video/mv-1').send({ videoSettings: { backend: 'cloud-surprise', grokDuration: 9 } });diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.jsindex 9d3140e96d..81be178ea0 100644--- a/server/services/musicVideo/projectsLogic.js+++ b/server/services/musicVideo/projectsLogic.js@@ -24,7 +24,7 @@ import {musicVideoSceneUpdateSchema,} from '../../lib/validation.js';import { compareNewerWins } from '../../lib/lwwTimestamp.js';-import { sanitizeRecordForWire, sanitizeSoftDeleteFields } from '../../lib/syncWire.js';+import { sanitizeSoftDeleteFields, stripMusicVideoLocalRenderPins } from '../../lib/syncWire.js';import { persistedRenderPinFields } from '../../lib/renderTargets.js';// Re-exported for the PG backend's typed mirror columns (mirrors the CD store).@@ -356,7 +356,7 @@ export function mergeProjectRecord(local, remoteRaw) {// An older peer can still send the fields that newer peers strip. Project// sync remains schema-v1 compatible, so apply the same projection inbound// before either inserting or restoring this machine's local choices.- remote = sanitizeRecordForWire('musicVideoProject', remote);+ remote = stripMusicVideoLocalRenderPins(remote);if (!local) return { next: remote, inserted: true, remoteWins: true, changed: true };// Render pins are install-capability choices and therefore wire-local// (#3245). sanitizeRecordForWire omits them from peer payloads; restore this