fix(api+ci): DELETE 204响应体全修复 + isort/black整理 + CI环境兼容 + 测试修复 #286

Merged
xiaoxia merged 27 commits from fix/delete-204-response-body into develop 2026-07-14 07:07:51 +08:00
Owner

变更概览

1. DELETE 204响应体全面修复(P0)

  • 修复14个DELETE接口的204响应体问题
  • 统一模式:response_class=Response + response_model=None + 函数返回None
  • 关键发现:函数有返回类型注解(如-> dict:)时,光有response_class=Response不够,必须同时加response_model=None,否则FastAPI从类型注解推断response_model导致204校验失败

涉及文件:

  • apps/api/app/api/routes/asset_libraries.py
  • apps/api/app/api/routes/assets.py
  • apps/api/app/api/routes/duplication.py
  • apps/api/app/api/routes/edit_plans.py
  • apps/api/app/api/routes/feature_flags.py
  • apps/api/app/api/routes/projects.py
  • apps/api/app/api/routes/tags.py
  • apps/api/app/api/routes/templates.py
  • apps/api/app/api/routes/titles.py
  • apps/api/app/api/routes/tts.py
  • apps/api/app/api/routes/voice_clones.py
  • apps/api/app/api/routes/voices.py

2. 代码格式整理

  • isort:15个文件import排序整理(对齐black profile, line_length=120)
  • black:3个文件格式化(unified_render_service.py, generation.py, check_migration_safety.py)
  • flake8:修复assets.py E303(3空行→2空行)

3. CI环境兼容修复

  • 移除--break-system-packages参数,兼容旧Runner pip 22.0.2
  • pip命令统一使用python3 -m pip,跨Ubuntu/CentOS兼容
  • Unit/Integration Tests加ffmpeg自动安装(支持apt-get/yum/dnf,失败不阻断)
  • Unit/Integration Tests加OSS占位环境变量

4. 测试修复

  • test_edit_plan_generation_api.py:7个用例,celery_app mock路径从edit_plans修正为edit_plans_generation
  • test_asset_library_delete.py:1个用例,断言英文→中文("Access denied" → "无权访问该项目")
  • test_config_oss.py_fresh_settings()改用clear=True,默认值测试不受CI环境变量影响
  • test_oss_direct_upload.py:重置settings时同步重置shared config
  • test_auth.py(集成):2个password_reset路径修正/password/forgot/forgot-password

CI状态

Validate | Unit Tests | Integration Tests | Frontend Lint

## 变更概览 ### 1. DELETE 204响应体全面修复(P0) - 修复14个DELETE接口的204响应体问题 - 统一模式:`response_class=Response` + `response_model=None` + 函数返回None - **关键发现**:函数有返回类型注解(如`-> dict:`)时,光有`response_class=Response`不够,必须同时加`response_model=None`,否则FastAPI从类型注解推断response_model导致204校验失败 **涉及文件:** - `apps/api/app/api/routes/asset_libraries.py` - `apps/api/app/api/routes/assets.py` - `apps/api/app/api/routes/duplication.py` - `apps/api/app/api/routes/edit_plans.py` - `apps/api/app/api/routes/feature_flags.py` - `apps/api/app/api/routes/projects.py` - `apps/api/app/api/routes/tags.py` - `apps/api/app/api/routes/templates.py` - `apps/api/app/api/routes/titles.py` - `apps/api/app/api/routes/tts.py` - `apps/api/app/api/routes/voice_clones.py` - `apps/api/app/api/routes/voices.py` ### 2. 代码格式整理 - **isort**:15个文件import排序整理(对齐black profile, line_length=120) - **black**:3个文件格式化(unified_render_service.py, generation.py, check_migration_safety.py) - **flake8**:修复assets.py E303(3空行→2空行) ### 3. CI环境兼容修复 - 移除`--break-system-packages`参数,兼容旧Runner pip 22.0.2 - pip命令统一使用`python3 -m pip`,跨Ubuntu/CentOS兼容 - Unit/Integration Tests加ffmpeg自动安装(支持apt-get/yum/dnf,失败不阻断) - Unit/Integration Tests加OSS占位环境变量 ### 4. 测试修复 - `test_edit_plan_generation_api.py`:7个用例,celery_app mock路径从`edit_plans`修正为`edit_plans_generation` - `test_asset_library_delete.py`:1个用例,断言英文→中文("Access denied" → "无权访问该项目") - `test_config_oss.py`:`_fresh_settings()`改用`clear=True`,默认值测试不受CI环境变量影响 - `test_oss_direct_upload.py`:重置settings时同步重置shared config - `test_auth.py`(集成):2个password_reset路径修正`/password/forgot` → `/forgot-password` ### CI状态 ✅ Validate | ✅ Unit Tests | ✅ Integration Tests | ✅ Frontend Lint
xiaoxia added 12 commits 2026-07-13 23:00:48 +08:00
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
添加response_class=Response,确保204响应无body。
fix(api): 修复voices.py中DELETE接口204响应体问题
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 16s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 16s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 50s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 21m44s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
274c1e6a63
添加response_class=Response,确保204响应无body。
xiaoxia added 1 commit 2026-07-13 23:46:26 +08:00
style: black format 3 files (unified_render_service, generation, check_migration_safety)
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 18s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 18s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 49s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 2m9s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
6a64fa4a2b
xiaoxia added 1 commit 2026-07-14 00:09:56 +08:00
fix(api): 全面修复DELETE 204响应体 + isort全量整理 + flake8修复
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 12s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 18s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 44s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 1m52s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
14130a2123
- 修复所有14个DELETE接口204响应体问题(response_class=Response + response_model=None)
- projects.py补充response_model=None(FastAPI从返回类型推断response_model导致204校验失败)
- isort全量格式化15个文件(对齐black profile,line_length=120)
- 修复assets.py flake8 E303(第77行前空行3→2)
- black格式化3个文件:unified_render_service.py, generation.py, check_migration_safety.py

Unit Tests: 1425 passed, 10 failed(10个失败均为已有问题,与204/isort无关)
xiaoxia changed title from fix(api): 修复所有DELETE接口204响应体问题(18个测试断言失败) to fix(api): 全面修复DELETE 204响应体 + isort全量整理 + flake8修复 2026-07-14 00:10:09 +08:00
xiaoxia added 7 commits 2026-07-14 00:33:18 +08:00
fix(format): black格式化 check_migration_safety.py
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 36s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 46s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 20s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m50s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
45da7b6f3a
xiaoxia added 1 commit 2026-07-14 00:36:44 +08:00
style: re-run black on 3 files after cherry-pick merge
CI/CD Pipeline / Unit Tests (pull_request) Failing after 57s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 1m20s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1m27s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 3m4s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
8191ca3909
xiaoxia added 1 commit 2026-07-14 00:45:30 +08:00
fix(test): 修复edit_plan_generation celery mock路径 + asset_library删除断言中文文案
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 35s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 55s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 26s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m50s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
f6bfaa5aaf
xiaoxia added 1 commit 2026-07-14 01:17:27 +08:00
fix(ci): Unit/Integration Tests 环境兼容修复 - ffmpeg安装 + OSS占位变量 + pip统一用python3 -m
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m25s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 1m29s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Failing after 11s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 2m40s
1c98e6d8d0
xiaoxia added 1 commit 2026-07-14 01:26:26 +08:00
fix(ci): ffmpeg安装容错 + OSS变量名修正 + config测试默认值隔离env
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 1m4s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m5s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 1m5s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1m8s
83043ea4f0
xiaoxia added 1 commit 2026-07-14 01:32:22 +08:00
fix(test): OSS测试重置shared config + 集成测试password_reset路径修正
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 15s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m5s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy 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 1m15s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 2m4s
e8fcfe9b19
xiaoxia added 1 commit 2026-07-14 01:37:47 +08:00
style: isort fix test_oss_direct_upload.py
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 27s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 51s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 57s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Deploy 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 2m58s
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 27s
CI/CD Pipeline / Frontend Lint (push) Successful in 57s
0ce0f54a30
xiaoxia changed title from fix(api): 全面修复DELETE 204响应体 + isort全量整理 + flake8修复 to fix(api+ci): DELETE 204响应体全修复 + isort/black整理 + CI环境兼容 + 测试修复 2026-07-14 01:42:52 +08:00
xiaoxia reviewed 2026-07-14 07:05:22 +08:00
xiaoxia left a comment
Author
Owner

CI全绿,代码检查通过,同意合并

CI全绿,代码检查通过,同意合并
xiaoxia merged commit 881eea9195 into develop 2026-07-14 07:07:51 +08:00
Sign in to join this conversation.