fix(design): normalize video quote options

This commit is contained in:
2026-08-18 13:06:01 +08:00
parent 11b19832a3
commit eb2a6e8c97
3 changed files with 129 additions and 8 deletions

View File

@@ -0,0 +1,47 @@
# Task: Fix video intent rendering as image confirmation
## Identity
- Task ID: 20260818-video-confirm-media-9b7c
- Mode: Feature
- Branch: codex/20260818-video-confirm-media-9b7c-video-confirm-media
- Worktree: D:\Datas\OthersProjects\makelore-video-confirm-media-9b7c
- Base commit: 11b19832a35477d2136c6ea953dd9c408fd84816
- Owner: codex
- Status: Ready for Integration
## Scope
- Normalize the server's public generation-option payload for the Electron/Main-to-Renderer shared design contract.
- Support both canonical client options (`value`/`disabled`) and the current server configuration shape (`id` or `seconds`/`enabled`) without changing the Renderer API.
- Add a regression proving a video Quote retains its medium and exposes selectable 2/6 second durations.
## Intent And Constraints
- The raw trace proves this run reached `medium=video` and `bailian_video_direct_v1`; the UI failure was caused by option-shape loss, not by a server image decision.
- Preserve existing image and legacy conversation compatibility.
- Do not expose provider credentials or change the HTTP API; normalization belongs at the Electron adapter boundary.
## Outcome
- Added a typed adapter normalizer that maps `value`/`id`/`seconds` to the shared `value` field and maps `enabled=false` to `disabled=true` (while retaining canonical payloads).
- The Renderer now receives video durations as numeric selectable options, so the duration control and video confirmation validation can work with the live server response.
- Added a regression test using the server-shaped video options and asserting the mapped video medium, model, and durations.
## Verification
- `pnpm exec vitest run tests/unit/works-square-design-workspace.test.ts` — 32 passed.
- `pnpm exec vitest run tests/unit/image-canvas-page.test.tsx tests/unit/works-square-design-workspace.test.ts` — 79 passed.
- `pnpm run typecheck` — passed.
- `pnpm exec eslint electron/image-workspace/works-square-workspace.ts tests/unit/works-square-design-workspace.test.ts` — passed.
- `pnpm run build:vite` — passed (existing chunk-size and dynamic-import warnings only).
- `git diff --check` — passed (only the repository's CRLF conversion warnings).
## Follow-ups
- Ship this client commit with the server intent-guard commit; run the packaged desktop smoke test against a live video Quote.
- A future API contract cleanup may make the server publish canonical option names directly, but the adapter normalizer is the compatibility boundary for now.
## Promotion Candidates
- None recorded.