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

address review (codex): preserve series.styleGuide in merge + conflict-restore allowlists

[._.]/ Adam Eivy2703bc4b751f
diff --git a/server/lib/conflictJournal.js b/server/lib/conflictJournal.js
index 0e380cef5a..3f5efce4b4 100644
--- a/server/lib/conflictJournal.js
+++ b/server/lib/conflictJournal.js
@@ -292,7 +292,7 @@ export async function detectConflict({ kind, id, local, remote }) {
// schemaVersion/locked/origin/deleted are neither restorable nor shown).
export const RESTORABLE_FIELDS = Object.freeze({
universe: ['name', 'starterPrompt', 'logline', 'premise', 'styleNotes', 'categories', 'compositeSheets', 'influences', 'characters', 'places', 'objects'],
- series: ['name', 'logline', 'premise', 'styleNotes', 'titleLogo', 'author', 'stylePromptOverride', 'stylePromptOverrideMode', 'targetFormat', 'issueCountTarget', 'arc', 'seasons'],
+ series: ['name', 'logline', 'premise', 'styleNotes', 'styleGuide', 'titleLogo', 'author', 'stylePromptOverride', 'stylePromptOverrideMode', 'targetFormat', 'issueCountTarget', 'arc', 'seasons'],
// mediaCollection restores only the user-authored content scalars. `items`
// are union-merged (never lost, nothing to restore); `universeId`/`seriesId`
// are structural links managed by the link/unlink helpers, not `updateCollection`
diff --git a/server/services/recordMerge.js b/server/services/recordMerge.js
index 62984691be..f5fb44a32d 100644
--- a/server/services/recordMerge.js
+++ b/server/services/recordMerge.js
@@ -258,7 +258,7 @@ const resolveScalars = (fields, survivor, loser, fieldChoices = {}, fieldOverrid
const UNIVERSE_SCALARS = ['name', 'starterPrompt', 'logline', 'premise', 'styleNotes'];
const SERIES_SCALARS = [
- 'name', 'logline', 'premise', 'styleNotes', 'titleLogo', 'author',
+ 'name', 'logline', 'premise', 'styleNotes', 'styleGuide', 'titleLogo', 'author',
'stylePromptOverride', 'stylePromptOverrideMode', 'targetFormat', 'issueCountTarget', 'arc',
// Preserve a Writers Room promotion link: if only the loser is linked it must
// be carried to the survivor (else the link is lost when the loser is
diff --git a/server/services/recordMerge.test.js b/server/services/recordMerge.test.js
index 40694b43d2..880e2cf641 100644
--- a/server/services/recordMerge.test.js
+++ b/server/services/recordMerge.test.js
@@ -112,6 +112,16 @@ describe('recordMerge — pure union helpers', () => {
expect(autoResolved).toContainEqual({ field: 'writersRoomWorkId', from: 'loser' });
});
+ it('buildSeriesUnion preserves a loser-only style guide', () => {
+ const styleGuide = { tense: 'past', povPerson: 'third-limited', contentRating: 'PG-13' };
+ const { record, autoResolved } = merge.buildSeriesUnion(
+ { name: 'S', seasons: [], styleGuide: null },
+ { name: 'S', seasons: [], styleGuide },
+ );
+ expect(record.styleGuide).toEqual(styleGuide);
+ expect(autoResolved).toContainEqual({ field: 'styleGuide', from: 'loser' });
+ });
+
it('buildUniverseUnion applies fieldChoices to resolve conflicts', () => {
const { conflicts, record } = merge.buildUniverseUnion(
{ name: 'Dup', starterPrompt: 'A', categories: {}, influences: {}, characters: [], places: [], objects: [] },