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
fix([med-pipeline-server-services-pipeline-arcplanner]): detect duplicate ids even past the retention cap
[._.]/ Adam Eivy5c403a5ea984
diff --git a/server/lib/storyArc.js b/server/lib/storyArc.jsindex 589d8435f4..c863575010 100644--- a/server/lib/storyArc.js+++ b/server/lib/storyArc.js@@ -323,9 +323,13 @@ export function sanitizeSeasonList(rawList, opts = {}) {for (const raw of rawList) {const s = sanitizeSeason(raw, opts);if (!s) continue;- if (byId.has(s.id)) duplicateIds.push(s.id);+ if (byId.has(s.id)) {+ duplicateIds.push(s.id);+ byId.set(s.id, s);+ continue;+ }+ if (byId.size >= ARC_LIMITS.SEASONS_PER_SERIES_MAX) continue;byId.set(s.id, s);- if (byId.size >= ARC_LIMITS.SEASONS_PER_SERIES_MAX) break;}if (duplicateIds.length) {const distinct = [...new Set(duplicateIds)];diff --git a/server/lib/storyArc.test.js b/server/lib/storyArc.test.jsindex 11df8fa61e..f35a2baf63 100644--- a/server/lib/storyArc.test.js+++ b/server/lib/storyArc.test.js@@ -228,6 +228,23 @@ describe('storyArc — sanitizeSeasonList', () => {const many = Array.from({ length: ARC_LIMITS.SEASONS_PER_SERIES_MAX + 5 }, (_, i) => ({ title: `s${i}`, number: i + 1 }));expect(sanitizeSeasonList(many)).toHaveLength(ARC_LIMITS.SEASONS_PER_SERIES_MAX);});++ it('still detects duplicate ids that appear after the retention cap is full', () => {+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});+ const filler = Array.from(+ { length: ARC_LIMITS.SEASONS_PER_SERIES_MAX },+ (_, i) => ({ id: `sea-fill-${i}`, title: `f${i}`, number: i + 1 }),+ );+ const out = sanitizeSeasonList([+ ...filler,+ { id: 'sea-fill-0', title: 'overwrite', number: 1 },+ ]);+ expect(out).toHaveLength(ARC_LIMITS.SEASONS_PER_SERIES_MAX);+ const overwritten = out.find((s) => s.id === 'sea-fill-0');+ expect(overwritten.title).toBe('overwrite');+ expect(warnSpy).toHaveBeenCalledTimes(1);+ expect(warnSpy.mock.calls[0][0]).toContain('sea-fill-0');+ });});describe('storyArc — Vonnegut shape catalog', () => {