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): seed characters from legacy description fallback (#1305)

[._.]/ Adam Eivycc59c119fb13
diff --git a/server/services/pipeline/continuityBible.js b/server/services/pipeline/continuityBible.js
index 47772df397..84072c82b4 100644
--- a/server/services/pipeline/continuityBible.js
+++ b/server/services/pipeline/continuityBible.js
@@ -110,9 +110,9 @@ const factKey = (f) => `${f.category}::${(f.subject || '').toLowerCase().trim()}
*/
export function seedFactsFromCanon(canon) {
const out = [];
- const push = (kind, entry, descriptionField) => {
+ const push = (kind, entry, description) => {
const subject = clampStr(entry?.name, SUBJECT_MAX);
- const statement = clampStr(entry?.[descriptionField], STATEMENT_MAX);
+ const statement = clampStr(description, STATEMENT_MAX);
if (!subject || !statement) return;
out.push({
category: CANON_KIND_CATEGORY[kind],
@@ -126,9 +126,12 @@ export function seedFactsFromCanon(canon) {
anchorQuote: null,
});
};
- for (const c of Array.isArray(canon?.characters) ? canon.characters : []) push('character', c, 'physicalDescription');
- for (const p of Array.isArray(canon?.places) ? canon.places : []) push('place', p, 'description');
- for (const o of Array.isArray(canon?.objects) ? canon.objects : []) push('object', o, 'description');
+ // Characters: `physicalDescription` with the legacy `description` read-fallback
+ // (mirrors universeCanon.js / canonPrompt.js) so existing installs that stored
+ // canon under `description` still seed — and edits to it move sourceCanonHash.
+ for (const c of Array.isArray(canon?.characters) ? canon.characters : []) push('character', c, c?.physicalDescription || c?.description);
+ for (const p of Array.isArray(canon?.places) ? canon.places : []) push('place', p, p?.description);
+ for (const o of Array.isArray(canon?.objects) ? canon.objects : []) push('object', o, o?.description);
return out;
}
diff --git a/server/services/pipeline/continuityBible.test.js b/server/services/pipeline/continuityBible.test.js
index d0c4f9ec13..d1106e1297 100644
--- a/server/services/pipeline/continuityBible.test.js
+++ b/server/services/pipeline/continuityBible.test.js
@@ -195,6 +195,14 @@ describe('getFactsLedger', () => {
describe('pure helpers (__testing)', () => {
const { seedFactsFromCanon, buildFacts, sanitizeProseFact } = svc.__testing;
+ it('seedFactsFromCanon falls back to the legacy character `description` field', () => {
+ const facts = seedFactsFromCanon({
+ characters: [{ id: 'c1', name: 'Legacy', description: 'Old-style canon text' }],
+ });
+ expect(facts).toHaveLength(1);
+ expect(facts[0]).toMatchObject({ category: 'physical', subject: 'Legacy', statement: 'Old-style canon text' });
+ });
+
it('seedFactsFromCanon maps kinds to categories and respects locked', () => {
const facts = seedFactsFromCanon({
characters: [{ id: 'c1', name: 'A', physicalDescription: 'tall', locked: true }, { name: 'NoDesc' }],