fix: from-assets 创建片段后调用 mark_clips_ready 转为 ready 状态 #1517

Merged
xiaoxia merged 2 commits from fix/mark-clips-ready-after-from-assets into develop 2026-08-27 10:31:13 +08:00
Owner

问题

用户点击"确认生成"后报错"渲染失败: 没有可渲染的就绪片段"。

根因:/clips/from-assets 接口创建片段后状态为 pending,但从未调用 mark_clips_ready() 将其转为 ready,渲染管线找不到就绪片段。

修复

create_clips_from_assets_editor 函数的 return 之前,调用 plan_svc.mark_clips_ready(plan_id)

mark_clips_ready 已存在于 edit_plan_service.py,逻辑:遍历 plan 下所有 pending 且 asset_id 非空的片段,调用 mark_ready() 转为 ready。

变更文件

  1. apps/api/app/api/routes/templates_editor/clips.py — 新增 plan_svc.mark_clips_ready(plan_id) 调用
  2. tests/unit/test_editor_clips_random_start.py — 新增 TestMarkClipsReadyAfterCreation 测试类,验证 mark_clips_ready 被正确调用

验证

  • 11 个 from-assets 相关单测全过
  • 新增测试断言 mark_clips_ready.assert_called_once_with(plan_id)
## 问题 用户点击"确认生成"后报错"渲染失败: 没有可渲染的就绪片段"。 根因:`/clips/from-assets` 接口创建片段后状态为 `pending`,但从未调用 `mark_clips_ready()` 将其转为 `ready`,渲染管线找不到就绪片段。 ## 修复 在 `create_clips_from_assets_editor` 函数的 `return` 之前,调用 `plan_svc.mark_clips_ready(plan_id)`。 `mark_clips_ready` 已存在于 `edit_plan_service.py`,逻辑:遍历 plan 下所有 pending 且 asset_id 非空的片段,调用 `mark_ready()` 转为 ready。 ## 变更文件 1. `apps/api/app/api/routes/templates_editor/clips.py` — 新增 `plan_svc.mark_clips_ready(plan_id)` 调用 2. `tests/unit/test_editor_clips_random_start.py` — 新增 `TestMarkClipsReadyAfterCreation` 测试类,验证 mark_clips_ready 被正确调用 ## 验证 - 11 个 from-assets 相关单测全过 - 新增测试断言 `mark_clips_ready.assert_called_once_with(plan_id)`
xiaoxia added 1 commit 2026-08-27 10:13:03 +08:00
fix: call mark_clips_ready after from-assets clip creation
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
AI Code Review / AI Code Review (pull_request) Successful in 3m10s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 3m23s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 3m43s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 3m48s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 4m20s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 4m37s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m59s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 3m15s
CI/CD Pipeline / Validate - Code Quality (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
20215f41bd
The /clips/from-assets endpoint creates clips with pending status
but never transitions them to ready. The render pipeline requires
ready clips, causing '没有可渲染的就绪片段' error on confirm generation.

Add plan_svc.mark_clips_ready(plan_id) before returning from
create_clips_from_assets_editor so clips are immediately marked ready.

Fixes: P0 blocking generation flow

🚀 预览环境已部署

项目 详情
PR号 #1517
预览链接 https://pr-1517.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1517 | | 预览链接 | [https://pr-1517.preview.xiaoxiajianji.com](https://pr-1517.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot added 1 commit 2026-08-27 10:20:05 +08:00
style: auto-format with black + isort + prettier [skip ci-format-check]
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2m52s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 3m24s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 3m32s
AI Code Review / AI Code Review (pull_request) Successful in 3m57s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 4m47s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m3s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 5m3s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m44s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 6m27s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 7m15s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 4m43s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m23s
CI/CD Pipeline / CI Gate (pull_request) Successful in 58s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 4m15s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 4m52s
17099ce905
Collaborator

【阻塞级判定】

  • 是否存在阻塞级问题:否
  • 阻塞级问题数量:0 个

📊 审查概览

  • 整体评价:通过
  • 建议级问题数量:0 个

🔴 阻塞级问题(必须修复)

💡 改进建议(不阻塞合并)

良好实践

  1. 测试覆盖充分:新增单元测试 TestMarkClipsReadyAfterCreation 准确验证了 mark_clips_ready 方法的调用时机和参数,确保了代码修改的有效性,防止回归。
  2. 注释清晰:在 clips.py 中添加了清晰的注释,说明了修改的业务背景(确保渲染管线能找到就绪片段),提高了代码的可维护性。
  3. 逻辑修复及时:针对渲染管线依赖片段状态的问题,在创建后立即标记状态,逻辑闭环合理。

🤖 由 AI 代码审查机器人自动生成 | 2026-08-27 02:24:00 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:通过 - 建议级问题数量:0 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 无 ### ✅ 良好实践 1. **测试覆盖充分**:新增单元测试 `TestMarkClipsReadyAfterCreation` 准确验证了 `mark_clips_ready` 方法的调用时机和参数,确保了代码修改的有效性,防止回归。 2. **注释清晰**:在 `clips.py` 中添加了清晰的注释,说明了修改的业务背景(确保渲染管线能找到就绪片段),提高了代码的可维护性。 3. **逻辑修复及时**:针对渲染管线依赖片段状态的问题,在创建后立即标记状态,逻辑闭环合理。 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-08-27 02:24:00 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
auto-approve-bot approved these changes 2026-08-27 10:30:31 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-08-27 10:30:32 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
xiaoxia merged commit 9bd3e7e30a into develop 2026-08-27 10:31:13 +08:00

🗑️ 预览环境已清理

PR #1517 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #1517 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.