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]): keep first-wins past cap, only warn
[._.]/ Adam Eivyd7da063456cb
diff --git a/server/lib/storyArc.js b/server/lib/storyArc.jsindex c863575010..534607b651 100644--- a/server/lib/storyArc.js+++ b/server/lib/storyArc.js@@ -323,12 +323,16 @@ export function sanitizeSeasonList(rawList, opts = {}) {for (const raw of rawList) {const s = sanitizeSeason(raw, opts);if (!s) continue;+ const atCap = byId.size >= ARC_LIMITS.SEASONS_PER_SERIES_MAX;if (byId.has(s.id)) {duplicateIds.push(s.id);- byId.set(s.id, s);+ // Within-cap duplicates still LWW; past-cap duplicates only warn so the+ // historical first-wins-past-cap outcome is preserved and the warning+ // is the only new signal.+ if (!atCap) byId.set(s.id, s);continue;}- if (byId.size >= ARC_LIMITS.SEASONS_PER_SERIES_MAX) continue;+ if (atCap) continue;byId.set(s.id, s);}if (duplicateIds.length) {diff --git a/server/lib/storyArc.test.js b/server/lib/storyArc.test.jsindex f35a2baf63..a3a9afc116 100644--- a/server/lib/storyArc.test.js+++ b/server/lib/storyArc.test.js@@ -229,7 +229,7 @@ describe('storyArc — sanitizeSeasonList', () => {expect(sanitizeSeasonList(many)).toHaveLength(ARC_LIMITS.SEASONS_PER_SERIES_MAX);});- it('still detects duplicate ids that appear after the retention cap is full', () => {+ it('warns about post-cap duplicate ids without overwriting the surviving entry', () => {const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});const filler = Array.from({ length: ARC_LIMITS.SEASONS_PER_SERIES_MAX },@@ -237,11 +237,14 @@ describe('storyArc — sanitizeSeasonList', () => {);const out = sanitizeSeasonList([...filler,- { id: 'sea-fill-0', title: 'overwrite', number: 1 },+ { id: 'sea-fill-0', title: 'should-not-overwrite-past-cap', 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');+ // Past-cap duplicates surface via the warning but do NOT LWW-overwrite —+ // preserves the historical first-wins-past-cap behavior so adding the+ // detector is purely additive.+ const surviving = out.find((s) => s.id === 'sea-fill-0');+ expect(surviving.title).toBe('f0');expect(warnSpy).toHaveBeenCalledTimes(1);expect(warnSpy.mock.calls[0][0]).toContain('sea-fill-0');});