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): match shot-description route cap to UI limit (4000), not sanitizer (2000)

Adam Eivya1bd5cd0d61d
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 2eabdaa2bb..3498ebcb4c 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -1137,7 +1137,12 @@ export const storyboardShotSchema = z.object({
// description-less shot — the route's job is only to reject a bad enum, not to
// tighten the existing client contract.
id: z.string().trim().max(80).optional(),
- description: z.string().max(2000).optional(),
+ // Bound loosely to the UI's textarea limit (maxLength=4000), NOT the
+ // sanitizer's SHOT_DESCRIPTION_MAX (2000). The sanitizer truncates a long
+ // description to 2000 downstream; the route must not REJECT one the UI lets a
+ // user type (2001–4000) — that would turn the previously-passthrough scenes
+ // contract into a 400. The route's job here is only to reject a bad enum.
+ description: z.string().max(4000).optional(),
durationSeconds: z.number().int().min(1).max(30).optional(),
continuityFromShotId: z.string().trim().max(80).nullable().optional(),
shotType: z.preprocess(
diff --git a/server/lib/validation.test.js b/server/lib/validation.test.js
index d17176ed16..0956d2c890 100644
--- a/server/lib/validation.test.js
+++ b/server/lib/validation.test.js
@@ -913,6 +913,15 @@ describe('validation.js', () => {
expect(r.data.screenDirection).toBeNull();
});
+ it('accepts a long description (2001–4000) the UI permits — the sanitizer truncates, the route must not 400', () => {
+ // Regression: the route cap must match the UI textarea (maxLength=4000),
+ // NOT the sanitizer's 2000 — rejecting a UI-allowed edit would turn the
+ // previously-passthrough scenes PATCH into a 400.
+ const r = storyboardShotSchema.safeParse({ id: 's', description: 'x'.repeat(3500) });
+ expect(r.success).toBe(true);
+ expect(storyboardShotSchema.safeParse({ id: 's', description: 'x'.repeat(4001) }).success).toBe(false);
+ });
+
it('passes through render-time fields stamped onto a shot (startFrameJobId)', () => {
const r = storyboardShotSchema.safeParse({ id: 's', description: 'x', startFrameJobId: 'job-9' });
expect(r.success).toBe(true);