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

fix(pipeline): derive manuscript fields from arc limits (#6769)

[._.]/ Adam Eivy516dbcfdde60
diff --git a/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsx b/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsx
index d7a1cdb526..1d2e42d276 100644
--- a/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsx
+++ b/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsx
@@ -1,11 +1,12 @@
import { useState } from 'react';
import { Loader2, X, BookText } from 'lucide-react';
import { WORLD_PREMISE_MAX } from '../../../services/apiUniverseBuilder.js';
+import { ARC_LIMITS } from '../../../../../server/lib/storyArc.js';
// Field-count guard for derived synopsis textareas — mirrors the server caps so
// the user isn't surprised by a 400 on commit.
const DERIVE_SYNOPSIS_MAX = 8000;
-const DERIVE_TITLE_MAX = 300;
+const ISSUE_TITLE_MAX = 300;
// Review/edit panel for the derive-from-manuscript proposal. The arc + bible
// fields and the single-volume title/synopsis are editable; each existing issue
@@ -48,10 +49,10 @@ export default function DeriveFromManuscriptPreview({ preview, committing, onCan
onConfirm({
arc,
bible,
- volume,
+ volume: { ...volume, title: volume.title.slice(0, ARC_LIMITS.SEASON_TITLE_MAX) },
issues: issues.map((it) => ({
id: it.id,
- title: it.title.slice(0, DERIVE_TITLE_MAX),
+ title: it.title.slice(0, ISSUE_TITLE_MAX),
synopsis: it.ideaLocked ? '' : it.synopsis.slice(0, DERIVE_SYNOPSIS_MAX),
})),
});
@@ -78,7 +79,7 @@ export default function DeriveFromManuscriptPreview({ preview, committing, onCan
<div className="grid gap-3 @md:grid-cols-2">
<label className="block space-y-1">
<span className="text-[11px] uppercase tracking-wider text-gray-500">Series logline</span>
- <input className={inputCls} value={bible.logline} maxLength={500}
+ <input className={inputCls} value={bible.logline} maxLength={ARC_LIMITS.LOGLINE_MAX}
onChange={(e) => { setBible((b) => ({ ...b, logline: e.target.value })); setArc((a) => ({ ...a, logline: e.target.value })); }} />
</label>
<label className="block space-y-1">
@@ -94,13 +95,13 @@ export default function DeriveFromManuscriptPreview({ preview, committing, onCan
</label>
<label className="block space-y-1">
<span className="text-[11px] uppercase tracking-wider text-gray-500">Protagonist arc</span>
- <textarea className={`${inputCls} resize-y`} rows={2} value={arc.protagonistArc} maxLength={8000}
+ <textarea className={`${inputCls} resize-y`} rows={2} value={arc.protagonistArc} maxLength={ARC_LIMITS.PROTAGONIST_ARC_MAX}
onChange={(e) => setArc((a) => ({ ...a, protagonistArc: e.target.value }))} />
</label>
<label className="block border-t border-port-border pt-2 space-y-2">
<span className="text-[11px] uppercase tracking-wider text-gray-500">Volume</span>
- <input className={inputCls} value={volume.title} maxLength={DERIVE_TITLE_MAX} placeholder="Volume title"
+ <input className={inputCls} value={volume.title} maxLength={ARC_LIMITS.SEASON_TITLE_MAX} placeholder="Volume title"
onChange={(e) => setVolume((v) => ({ ...v, title: e.target.value }))} />
</label>
@@ -110,7 +111,7 @@ export default function DeriveFromManuscriptPreview({ preview, committing, onCan
<div key={it.id} className="bg-port-card border border-port-border rounded p-2 space-y-1">
<div className="flex items-center gap-2">
<span className="text-[11px] text-gray-500 shrink-0">#{it.number}</span>
- <input className={inputCls} value={it.title} maxLength={DERIVE_TITLE_MAX} placeholder="Issue title"
+ <input className={inputCls} value={it.title} maxLength={ISSUE_TITLE_MAX} placeholder="Issue title"
aria-label={`Title for issue ${it.number}`}
onChange={(e) => setIssueField(it.id, 'title', e.target.value)} />
</div>
diff --git a/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.test.jsx b/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.test.jsx
new file mode 100644
index 0000000000..1764991ebf
--- /dev/null
+++ b/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.test.jsx
@@ -0,0 +1,32 @@
+import { describe, expect, it, vi } from 'vitest';
+import { fireEvent, render, screen } from '@testing-library/react';
+import DeriveFromManuscriptPreview from './DeriveFromManuscriptPreview.jsx';
+
+const preview = {
+ arc: { protagonistArc: '' },
+ bible: {},
+ volume: {},
+ issues: [{ id: 'issue-1', number: 1, title: '', currentSynopsis: '' }],
+};
+
+describe('DeriveFromManuscriptPreview field caps', () => {
+ it('uses server caps and trims the volume title before confirming', () => {
+ const onConfirm = vi.fn();
+ render(<DeriveFromManuscriptPreview preview={preview} committing={false} onCancel={vi.fn()} onConfirm={onConfirm} />);
+
+ const volumeTitle = screen.getByPlaceholderText('Volume title');
+ const protagonistArc = screen.getByText('Protagonist arc').parentElement.querySelector('textarea');
+ const issueTitle = screen.getByPlaceholderText('Issue title');
+ expect(volumeTitle.maxLength).toBe(200);
+ expect(protagonistArc.maxLength).toBe(4000);
+ expect(issueTitle.maxLength).toBe(300);
+
+ const longTitle = 'x'.repeat(250);
+ fireEvent.change(volumeTitle, { target: { value: longTitle } });
+ fireEvent.click(screen.getByRole('button', { name: /apply/i }));
+
+ expect(onConfirm).toHaveBeenCalledWith(expect.objectContaining({
+ volume: { title: longTitle.slice(0, 200), logline: '', synopsis: '' },
+ }));
+ });
+});