fix(canvas): block invalid video duration confirmation

This commit is contained in:
2026-08-18 11:32:38 +08:00
parent 566f99f5ed
commit 11b19832a3
3 changed files with 39 additions and 1 deletions

View File

@@ -29,6 +29,8 @@
- The confirmation card now filters enabled server-provided video durations to the inclusive 2-6 second client boundary.
- A legacy Quote whose selected duration is outside that boundary renders an explicit disabled `请选择时长` placeholder instead of visually selecting one allowed value while retaining a different hidden draft value.
- Selecting 6 seconds updates the controlled draft, survives the debounced server re-quote, and is used by final confirmation.
- Final-review P1 follow-up: a video Quote with `null`, an out-of-range duration, a disabled duration, or a duration absent from the filtered server options now disables the confirmation button and is rejected again inside the shared `handleConfirm` path used by direct, quick-reply, and text confirmation.
- Only an explicit allowed selection followed by a successful server re-quote re-enables confirmation.
- Existing request seams were verified: Renderer sends `durationSeconds: 6`, and the Main cloud adapter sends `duration_seconds: 6` to Works Square.
## Verification
@@ -40,6 +42,9 @@
- `corepack pnpm exec eslint src/pages/ImageCanvas/index.tsx tests/unit/image-canvas-page.test.tsx tests/unit/works-square-design-workspace.test.ts` — passed with no output.
- `corepack pnpm run build:vite` — passed for Renderer, Electron Main, and Preload; only the existing dynamic-import and chunk-size warnings were reported.
- `git diff --check` — passed; Git reported only the repository's LF-to-CRLF checkout warning.
- Final-review P1 red test: the legacy 10-second Quote initially left `确认并开始生成` enabled.
- Final-review P1 focused regression: legacy 10-second initial state disables confirmation and text confirmation sends no request; selecting 6 seconds, completing re-quote, and confirming sends 6 — passed.
- Post-P1 focused suite: 3 files / 92 tests passed; typecheck and scoped ESLint passed; Renderer/Main/Preload `build:vite` passed with the same existing warnings.
## Follow-ups