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: conflict restore now brings back storyboard plot/temp track and deck card orientation (#12946)

[._.]/ Adam Eivy97c1576debad
diff --git a/server/lib/conflictJournal.js b/server/lib/conflictJournal.js
index 2cf4188965..0db3be7531 100644
--- a/server/lib/conflictJournal.js
+++ b/server/lib/conflictJournal.js
@@ -570,10 +570,13 @@ export const RESTORABLE_FIELDS = Object.freeze({
// column), `cards[]` is the roster itself (restored with the deck row by
// `restoreDeck`, not offered as an individually-overlayable field), and the
// install-capability pins never reach a snapshot (stripped from the wire).
- deck: ['name', 'description', 'styleNotes', 'influences', 'layoutPrompt', 'samples', 'cardSize', 'universeId'],
+ deck: ['name', 'description', 'styleNotes', 'influences', 'layoutPrompt', 'cardOrientation', 'cardOrientationPrompt', 'samples', 'cardSize', 'universeId'],
// A storyboard restores its authored plan: identity fields, the panel-maker
- // recipe and the beats → panels → takes tree. Id and timestamps stay structural.
- storyboard: ['name', 'logline', 'aspectRatio', 'artStyle', 'universeId', 'moodBoardId', 'recipe', 'beats'],
+ // recipe, the plot, the temp track and the beats → panels → takes tree. `tempTrack`
+ // restores with `beats` so sanitizeStoryboard re-resolves each beat pin against
+ // the restored markers. `plotLlm` is a per-user provider pick and stays local;
+ // id and timestamps stay structural.
+ storyboard: ['name', 'logline', 'aspectRatio', 'artStyle', 'universeId', 'moodBoardId', 'recipe', 'plot', 'tempTrack', 'beats'],
// FableLoom restores the authored story graph, playback configuration, and
// story-level render preferences.
// Universe/series ids are structural links and stay on the live record.
diff --git a/server/lib/conflictJournal.test.js b/server/lib/conflictJournal.test.js
index 264699dd0b..c6225d214d 100644
--- a/server/lib/conflictJournal.test.js
+++ b/server/lib/conflictJournal.test.js
@@ -27,6 +27,8 @@ vi.mock('./fileUtils.js', async (importOriginal) => {
});
const cj = await import('./conflictJournal.js');
+const { sanitizeRecordForWire } = await import('./syncWire.js');
+const { sanitizeStoryboard } = await import('./storyboardRecord.js');
afterAll(() => rmSync(TEST_DATA_ROOT, { recursive: true, force: true }));
@@ -708,3 +710,27 @@ describe('conflictJournal — unreadable base-hash store fails closed (#7260)',
errSpy.mockRestore();
});
});
+
+describe('conflictJournal — RESTORABLE_FIELDS parity with the wire shape', () => {
+ // Every top-level wire key must be classified: restorable (the Conflicts diff
+ // shows it and a restore writes it back) or structural (listed here with a
+ // reason). A new wire field fails this until someone decides which it is.
+ const storyboardWire = () => sanitizeRecordForWire('storyboard', sanitizeStoryboard({ id: 'sb-1', name: 'Board' }));
+ const deckWire = () => sanitizeRecordForWire('deck', {
+ id: 'd-1', name: 'Deck', kind: 'tarot', universeId: null, description: '', styleNotes: '', influences: [],
+ layoutPrompt: '', cardOrientation: 'portrait', cardOrientationPrompt: null, samples: [],
+ imageMode: null, imageModelId: null, cardSize: { width: 1, height: 1 }, promptLlm: null,
+ completion: {}, cards: [], createdAt: '2026-05-01T00:00:00Z', updatedAt: '2026-05-01T00:00:00Z',
+ deleted: false, deletedAt: null,
+ });
+ const COMMON = ['id', 'createdAt', 'updatedAt', 'deleted', 'deletedAt'];
+ const STRUCTURAL_FIELDS = {
+ storyboard: [...COMMON, 'plotLlm'], // plotLlm: per-user provider pick
+ deck: [...COMMON, 'kind', 'cards'], // kind mints the roster; cards restore with the deck row
+ };
+
+ it.each([['storyboard', storyboardWire], ['deck', deckWire]])('classifies every %s wire key', (kind, wire) => {
+ const classified = new Set([...cj.RESTORABLE_FIELDS[kind], ...STRUCTURAL_FIELDS[kind]]);
+ expect(Object.keys(wire()).filter((key) => !classified.has(key))).toEqual([]);
+ });
+});
diff --git a/server/services/storyboards/sync.test.js b/server/services/storyboards/sync.test.js
index 9b13244c94..c7b9765098 100644
--- a/server/services/storyboards/sync.test.js
+++ b/server/services/storyboards/sync.test.js
@@ -121,3 +121,24 @@ describe('storyboard federation', () => {
expect(await svc.restoreStoryboard(id, {})).toBeNull();
});
});
+
+describe('storyboard conflict restore', () => {
+ it('restores plot, temp track and beat pins together', async () => {
+ const board = await svc.createStoryboard({ name: 'Pinned' });
+ const { beatId } = await svc.addBeat(board.id, { title: 'Opening' });
+ const original = {
+ ...(await svc.getStoryboard(board.id)),
+ plot: 'The original plot',
+ tempTrack: { filename: 'track.mp3', name: 'Demo', sections: [{ id: 'sec-1', label: 'Verse', at: 1 }], lines: [] },
+ };
+ original.beats = original.beats.map((beat) => (beat.id === beatId ? { ...beat, pin: 'sec-1' } : beat));
+ // The peer's revision replaced plot and track; the pin lost its marker.
+ await svc.restoreStoryboard(board.id, { plot: 'Peer plot', tempTrack: null, beats: original.beats });
+ expect((await svc.getStoryboard(board.id)).beats[0].pin).toBeNull();
+
+ const restored = await svc.restoreStoryboard(board.id, original);
+ expect(restored.plot).toBe('The original plot');
+ expect(restored.tempTrack.sections.map((s) => s.id)).toEqual(['sec-1']);
+ expect(restored.beats[0].pin).toBe('sec-1');
+ });
+});