Skip to content

fix: clamp clip resize height to schema max (2160)#113

Merged
dazzatronus merged 1 commit into
mainfrom
fix/clip-resize-height-clamp
May 19, 2026
Merged

fix: clamp clip resize height to schema max (2160)#113
dazzatronus merged 1 commit into
mainfrom
fix/clip-resize-height-clamp

Conversation

@dazzatronus
Copy link
Copy Markdown
Contributor

@dazzatronus dazzatronus commented May 19, 2026

Summary

  • clampDimensions() capped both axes at 3840, but ResolvedClipSchema requires height ≤ 2160. Any clip resize that crossed 2160 px height threw an unhandled ZodError inside the pixi pointerup listener.
  • Split MAX_DIMENSION into MAX_WIDTH (3840) and MAX_HEIGHT (2160) so the interaction clamp stops at the same bound the schema enforces.

Root cause

  • src/core/interaction/clip-interaction.ts — symmetric MAX_DIMENSION: 3840 clamp.
  • src/core/ui/selection-handles.ts:567 — pointer-up calls edit.commitClipUpdate(...).
  • src/core/edit-session.ts:1062ResolvedClipSchema.parse(finalConfig) throws synchronously.
  • @shotstack/schemas/zodwidth: z.number().lte(3840), height: z.number().lte(2160).

Sentry

Top issue by volume on dashboard-v2: DASHBOARD-V2-29 — 1,690 captured events / 14 days at 5% sample rate (~34k actual occurrences).

Test plan

  • npx jest tests/clip-interaction.test.ts — 56 / 56 pass (assertions updated to use the new constants; the 3840×3840 boundary case now expects the legal 3840×2160 maximum).
  • npm run typecheck — clean.
  • Full suite via pre-push hook — 1775 / 1775 pass.
  • Manual: drag the bottom edge of a clip past 2160 px on a vertical (9:16) canvas — handle should stop at 2160 instead of throwing.

Out of scope (deliberate, YAGNI)

  • No safeParse migration in edit-session.ts — once the clamp matches the schema, the throw path is unreachable.
  • No new public event (ClipUpdateRejected) — nothing subscribes to it.
  • No upstream OpenAPI/spec change — the 2160 asymmetry is a separate API discussion; dashboards render fine inside the existing 4K bound.
  • No package version bump — release flow handles that.

@dazzatronus dazzatronus self-assigned this May 19, 2026
@dazzatronus dazzatronus merged commit 9f4a112 into main May 19, 2026
1 check passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant