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

review: defensive guards + document promote force-orphan policy

[._.]/ Adam Eivy0f8ddeb93664
diff --git a/server/services/canonUsage.js b/server/services/canonUsage.js
index fb63fb2ea2..a61b20ef28 100644
--- a/server/services/canonUsage.js
+++ b/server/services/canonUsage.js
@@ -98,7 +98,7 @@ export async function getUniverseCanonUsage(universeId) {
issueIds: [...issueIds],
issueCount: issueIds.size,
}))
- .sort((a, b) => b.issueCount - a.issueCount || a.seriesName.localeCompare(b.seriesName));
+ .sort((a, b) => b.issueCount - a.issueCount || (a.seriesName || '').localeCompare(b.seriesName || ''));
}
return out;
};
diff --git a/server/services/pipeline/seriesCanon.js b/server/services/pipeline/seriesCanon.js
index 7b483cb5d1..61b0cb4034 100644
--- a/server/services/pipeline/seriesCanon.js
+++ b/server/services/pipeline/seriesCanon.js
@@ -6,7 +6,13 @@
import { getUniverse } from '../universeBuilder.js';
-const EMPTY = Object.freeze({ characters: [], settings: [], objects: [] });
+// Frozen inner arrays too — otherwise a careless `canon.characters.push(...)`
+// at a caller would silently pollute every future orphan-series read.
+const EMPTY = Object.freeze({
+ characters: Object.freeze([]),
+ settings: Object.freeze([]),
+ objects: Object.freeze([]),
+});
/**
* Shape a universe record into `{ characters, settings, objects }` arrays,
diff --git a/server/services/writersRoom/promoteToPipeline.js b/server/services/writersRoom/promoteToPipeline.js
index 80c8df2880..d14ed21400 100644
--- a/server/services/writersRoom/promoteToPipeline.js
+++ b/server/services/writersRoom/promoteToPipeline.js
@@ -11,6 +11,13 @@
* creating duplicates. Pass `force: true` to make a fresh series anyway
* (useful for re-syncing after a destructive pipeline-side edit).
*
+ * `force: true` mints a brand-new universe alongside the fresh series — it
+ * does NOT delete the previously-linked universe. That's intentional: when
+ * canon has accumulated across crossover series sharing a universe, a
+ * destructive force-rebuild of one series shouldn't take its siblings' shared
+ * universe with it. The orphaned link is dropped from the work's manifest;
+ * the user can delete the stale universe explicitly if desired.
+ *
* One-way: this is only the WR → Pipeline transfer. The link is stable
* forever, but content does NOT auto-sync — calling this again on a linked
* work returns the existing pair without re-copying. A future "re-sync"