fix: 3个bug修复 - flush/append_log/plan_id兜底 #1476

Merged
auto-approve-bot merged 6 commits from fix/three-bugs-flush-log-planid into develop 2026-08-24 11:26:00 +08:00
Owner

Bug 1 (P0): replace_all_clips_transactional 缺 db.flush()

文件: apps/api/app/services/edit_plan_service.py

问题: db.add(model) 新建的 clip 未 flush 到数据库,紧接着查询 status=="pending" 查不到这些新记录,ready 标记永远不生效。

修复: 在查询 pending_with_asset 之前加 db.flush(),让新建 clip 先写入事务(未 commit),查询才能找到并标记 ready。

Bug 2 (P1): generation.py 失败日志 append_log 参数重复

文件: apps/worker/worker_app/tasks/generation.py

问题: append_log("任务失败", str(error), stage="render") — "任务失败" 作为第一个位置参数已赋给 stage,又传关键字 stage="render" → TypeError。

修复: 改为 append_log("render", str(error), level="ERROR", error_type=...)。排查其他调用点无同样问题。

Bug 3 (P0): 正式生成缺少 plan_id 兜底关联

文件: apps/api/app/api/routes/generation_tasks.py

问题: 预览 API 有兜底逻辑(前端未传 source_edit_plan_id 时通过 template_id + user_id 查找 plan),但正式生成 API 没有,导致 Worker 拿不到 plan_id 无法走 DB 渲染路径。

修复: 任务创建并入队后,若 source_edit_plan_id 为空且 template_id 存在,通过 SQLAlchemyEditPlanRepository.list_by_template 查找该用户最新的 plan 关联。

测试

新增 7 个回归测试(test_three_bugs_fix.py),127 个相关测试全过。

## Bug 1 (P0): replace_all_clips_transactional 缺 db.flush() **文件**: `apps/api/app/services/edit_plan_service.py` **问题**: `db.add(model)` 新建的 clip 未 flush 到数据库,紧接着查询 `status=="pending"` 查不到这些新记录,ready 标记永远不生效。 **修复**: 在查询 `pending_with_asset` 之前加 `db.flush()`,让新建 clip 先写入事务(未 commit),查询才能找到并标记 ready。 ## Bug 2 (P1): generation.py 失败日志 append_log 参数重复 **文件**: `apps/worker/worker_app/tasks/generation.py` **问题**: `append_log("任务失败", str(error), stage="render")` — "任务失败" 作为第一个位置参数已赋给 `stage`,又传关键字 `stage="render"` → TypeError。 **修复**: 改为 `append_log("render", str(error), level="ERROR", error_type=...)`。排查其他调用点无同样问题。 ## Bug 3 (P0): 正式生成缺少 plan_id 兜底关联 **文件**: `apps/api/app/api/routes/generation_tasks.py` **问题**: 预览 API 有兜底逻辑(前端未传 source_edit_plan_id 时通过 template_id + user_id 查找 plan),但正式生成 API 没有,导致 Worker 拿不到 plan_id 无法走 DB 渲染路径。 **修复**: 任务创建并入队后,若 `source_edit_plan_id` 为空且 `template_id` 存在,通过 `SQLAlchemyEditPlanRepository.list_by_template` 查找该用户最新的 plan 关联。 ## 测试 新增 7 个回归测试(`test_three_bugs_fix.py`),127 个相关测试全过。
xiaoxia added 1 commit 2026-08-24 10:18:43 +08:00
fix: 3个bug修复 - flush/append_log/plan_id兜底
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1m30s
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 / Validate - Migration (alembic) (pull_request) Successful in 1m55s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m8s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m32s
AI Code Review / AI Code Review (pull_request) Successful in 2m17s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m38s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 45s
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 / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / Staging API 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 / ACR Image Cleanup (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
f8eb32144f
Bug 1 (P0): edit_plan_service.replace_all_clips_transactional
- db.add(model)后加db.flush(),让新建clip写入事务
- 后续查询status=='pending'才能找到新记录并标记ready
- 根因:未flush的记录对SQLAlchemy query不可见

Bug 2 (P1): generation.py 失败日志append_log参数重复
- 原代码: append_log('任务失败', str(error), stage='render')
- '任务失败'作为第一个位置参数已赋给stage,又传stage='render' → TypeError
- 修复: append_log('render', str(error), level='ERROR', error_type=...)
- 排查其他调用点无同样问题

Bug 3 (P0): 正式生成API缺少plan_id兜底关联
- 预览API有兜底:前端未传source_edit_plan_id时通过template_id+user_id查找plan
- 正式生成API没有此逻辑,导致Worker拿不到plan_id无法走DB渲染路径
- 修复:任务创建并入队后,若source_edit_plan_id为空且template_id存在,
  通过SQLAlchemyEditPlanRepository.list_by_template查找该用户最新的plan关联

新增7个回归测试,127个相关测试全过

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1476 | | 预览链接 | [https://pr-1476.preview.xiaoxiajianji.com](https://pr-1476.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot added 1 commit 2026-08-24 10:25:57 +08:00
style: auto-format with black + isort + prettier [skip ci-format-check]
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 30s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m52s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m1s
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
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m30s
AI Code Review / AI Code Review (pull_request) Successful in 4m25s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 3m11s
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m42s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (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 / PR Build Worker Image (pull_request) Successful in 43s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 7m2s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 3m0s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 6m14s
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 7m36s
CI/CD Pipeline / CI Gate (pull_request) Failing after 19s
b348507d25
auto-approve-bot approved these changes 2026-08-24 10:35:34 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

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

CI全绿,自动审批通过。

CI全绿,自动审批通过。
xiaoxia added 1 commit 2026-08-24 10:56:56 +08:00
test: 补充plan_id兜底逻辑执行测试,diff覆盖率100%
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 E2E Tests (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 / Check if frontend-only change (pull_request) Successful in 50s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 45s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m50s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m51s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m56s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m33s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m48s
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
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
9bfe0b9963
新增3个端到端测试覆盖generation_tasks.py的兜底关联逻辑:
- test_fallback_sets_plan_id_when_empty: 验证空plan_id时自动查找并关联
- test_no_fallback_when_plan_id_already_set: 验证已有plan_id时不触发兜底
- test_fallback_handles_exception_gracefully: 验证查找异常不阻塞主流程

总计10个回归测试,diff覆盖率从7%提升到100%(14/14行全覆盖)
auto-approve-bot added 1 commit 2026-08-24 11:00:21 +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 E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1m9s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m44s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m43s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m59s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m58s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 47s
AI Code Review / AI Code Review (pull_request) Failing after 2m9s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m43s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m58s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m9s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 7m5s
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) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
59d5986b20
xiaoxia added 1 commit 2026-08-24 11:09:32 +08:00
fix: AI Review修复 - plan_id兜底改为DB层过滤
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 / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 41s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 29s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m40s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m52s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m54s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m15s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m52s
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
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
26b27a34fd
AI Code Review阻塞问题:list_by_template(limit=20)+内存过滤user_id
存在边界缺陷(超过20条或排序不确定时可能关联错误plan)

修复:直接查EditPlanModel,在DB层按template_id+user_id过滤
并按created_at desc取最新一条,无limit风险

更新测试:mock改为DB query chain,新增no_match场景
11个回归测试全过
auto-approve-bot added 1 commit 2026-08-24 11:13:06 +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 E2E Tests (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 / Check if frontend-only change (pull_request) Successful in 46s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 29s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m47s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m50s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m48s
AI Code Review / AI Code Review (pull_request) Successful in 2m2s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m14s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m48s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m43s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 4m11s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 6m8s
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 / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m16s
CI/CD Pipeline / CI Gate (pull_request) Successful in 6s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 1m13s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m20s
bf5244a6e1
Collaborator

【阻塞级判定】

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

📊 审查概览

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

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

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

  1. [apps/api/app/api/routes/generation_tasks.py] 异常捕获范围过宽

    • 具体内容:代码中使用了 except Exception 来捕获数据库查询异常。虽然注释说明了“不影响主流程”,但捕获 Exception 会掩盖如 KeyboardInterruptMemoryError 等系统级错误。建议改为捕获具体的数据库异常(如 sqlalchemy.exc.SQLAlchemyError)。
  2. [apps/api/app/api/routes/generation_tasks.py] 模块导入位置

    • 具体内容:from packages.adapters.sqlalchemy_impl.models import EditPlanModel 放在了函数内部。虽然 Python 有模块缓存机制,但在函数内部导入通常不符合 PEP8 规范,也不利于静态分析工具检查。建议将其移至文件顶部。
  3. [coverage.xml] 提交了非源码文件

    • 具体内容:coverage.xml 是代码覆盖率测试生成的报告文件,属于构建产物,不应提交到版本控制系统。建议将其添加到 .gitignore 中,避免污染代码历史。

良好实践

  • 事务处理优化:在 apps/api/app/services/edit_plan_service.py 中,正确使用了 db.flush() 来确保在同一事务内新创建的数据对后续查询可见,修复了潜在的数据一致性问题。
  • 容错设计:在 apps/api/app/api/routes/generation_tasks.py 中,新增的自动关联编辑计划逻辑包含了完善的异常处理和降级策略,确保了辅助功能的失败不会阻断核心业务流程。
  • 日志规范化:在 apps/worker/worker_app/tasks/generation.py 中,调整了日志记录的参数结构,将阶段信息前置,有助于日志解析和检索。

🤖 由 AI 代码审查机器人自动生成 | 2026-08-24 03:15:06 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:通过 - 建议级问题数量:3 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 1. **[apps/api/app/api/routes/generation_tasks.py] 异常捕获范围过宽** - 具体内容:代码中使用了 `except Exception` 来捕获数据库查询异常。虽然注释说明了“不影响主流程”,但捕获 `Exception` 会掩盖如 `KeyboardInterrupt` 或 `MemoryError` 等系统级错误。建议改为捕获具体的数据库异常(如 `sqlalchemy.exc.SQLAlchemyError`)。 2. **[apps/api/app/api/routes/generation_tasks.py] 模块导入位置** - 具体内容:`from packages.adapters.sqlalchemy_impl.models import EditPlanModel` 放在了函数内部。虽然 Python 有模块缓存机制,但在函数内部导入通常不符合 PEP8 规范,也不利于静态分析工具检查。建议将其移至文件顶部。 3. **[coverage.xml] 提交了非源码文件** - 具体内容:`coverage.xml` 是代码覆盖率测试生成的报告文件,属于构建产物,不应提交到版本控制系统。建议将其添加到 `.gitignore` 中,避免污染代码历史。 ### ✅ 良好实践 - **事务处理优化**:在 `apps/api/app/services/edit_plan_service.py` 中,正确使用了 `db.flush()` 来确保在同一事务内新创建的数据对后续查询可见,修复了潜在的数据一致性问题。 - **容错设计**:在 `apps/api/app/api/routes/generation_tasks.py` 中,新增的自动关联编辑计划逻辑包含了完善的异常处理和降级策略,确保了辅助功能的失败不会阻断核心业务流程。 - **日志规范化**:在 `apps/worker/worker_app/tasks/generation.py` 中,调整了日志记录的参数结构,将阶段信息前置,有助于日志解析和检索。 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-08-24 03:15:06 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
auto-approve-bot merged commit 706b9057d6 into develop 2026-08-24 11:26:00 +08:00
auto-approve-bot deleted branch fix/three-bugs-flush-log-planid 2026-08-24 11:26:01 +08:00

🗑️ 预览环境已清理

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

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

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