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
address review (claude): type-guard sceneLabel against non-string heading from peer sync
[._.]/ Adam Eivyee0ba0e98fb6
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex 77c6fe57cd..3a5fe86fc8 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -753,9 +753,15 @@ function sceneComponentMix(components) {}// A scene's display label for finding text/location — its heading, falling back-// to the summary, then a sequence-based label.-const sceneLabel = (s) =>- (s.heading || s.summary || `scene ${typeof s.sequence === 'number' ? s.sequence + 1 : '?'}`).trim();+// to the summary, then a sequence-based label. Type-guarded because the reverse+// outline rides peer sync (#1348): a hand-edited / older-peer scene could carry a+// non-string heading, and a bare `.trim()` on it would throw and abort the check.+const sceneLabel = (s) => {+ const heading = typeof s?.heading === 'string' ? s.heading.trim() : '';+ const summary = typeof s?.summary === 'string' ? s.summary.trim() : '';+ const seq = typeof s?.sequence === 'number' ? s.sequence + 1 : '?';+ return heading || summary || `scene ${seq}`;+};// ---------------------------------------------------------------------------// Registry entries.diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex ae938c957a..3a7797cd06 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -623,6 +623,12 @@ describe('scene.component-balance — deterministic check', () => {expect(runScene([])).toEqual([]);expect(runScene([null, 'x', {}])).toEqual([]);});++ it('does not throw on a non-string heading (peer-synced / malformed scene)', () => {+ const findings = runScene([{ heading: 123, sequence: 0, components: { dialogue: true } }]);+ expect(findings).toHaveLength(1);+ expect(findings[0].location).toBe('Scene: scene 1'); // falls back past the non-string heading+ });});describe('relationships.reciprocity — deterministic check', () => {