feat(#1714): complete 请求携带 file_size,修复同名兜底误杀新视频 #1731

Merged
auto-approve-bot merged 1 commits from feat/1714-complete-file-size into develop 2026-09-06 12:44:06 +08:00
Owner

背景

配合后端 #1714 续单(同名兜底去重误杀新视频修复)。

根因:direct 上传 complete 不传 file_size(后端收到 0),导致 find_recent_active_by_library_and_name 的大小校验 if file_size>0 不生效,30 分钟内同名视频(如 iPhone 的 IMG_2285.MOV)即使内容/大小全新也被同名兜底误判重复跳过。

改动(仅前端 apps/web)

  • api/assets/upload.ts
    • completeDirectUpload 请求体新增可选 file_size?: number
    • prepareDirectUploadHandlecomplete 闭包透传 data.file.size —— 队列链路(useAssetUpload)与非队列链路(uploadAssetDirect,配音/封面/克隆用)同时生效,无需改 hooks
  • 测试:
    • completeDirectUpload 新增用例断言请求体携带 file_size
    • uploadAssetDirect 老流程用例断言 complete body 含 file_size: file.size

后端配合项

后端 complete_direct_upload_find_duplicate_asset 时传 file_size=request.file_size(后端 PR 处理);前端本 PR 合入后 complete 即会带上该字段,旧后端忽略多余字段、向后兼容。

测试

  • 全量 669 passed(141 文件),tsc / eslint / prettier / build 全绿
## 背景 配合后端 #1714 续单(同名兜底去重误杀新视频修复)。 根因:direct 上传 complete 不传 `file_size`(后端收到 0),导致 `find_recent_active_by_library_and_name` 的大小校验 `if file_size>0` 不生效,30 分钟内同名视频(如 iPhone 的 IMG_2285.MOV)即使内容/大小全新也被同名兜底误判重复跳过。 ## 改动(仅前端 apps/web) - `api/assets/upload.ts` - `completeDirectUpload` 请求体新增可选 `file_size?: number` - `prepareDirectUploadHandle` 的 `complete` 闭包透传 `data.file.size` —— 队列链路(useAssetUpload)与非队列链路(uploadAssetDirect,配音/封面/克隆用)同时生效,无需改 hooks - 测试: - `completeDirectUpload` 新增用例断言请求体携带 `file_size` - `uploadAssetDirect` 老流程用例断言 complete body 含 `file_size: file.size` ## 后端配合项 后端 `complete_direct_upload` 调 `_find_duplicate_asset` 时传 `file_size=request.file_size`(后端 PR 处理);前端本 PR 合入后 complete 即会带上该字段,旧后端忽略多余字段、向后兼容。 ## 测试 - 全量 669 passed(141 文件),tsc / eslint / prettier / build 全绿
xiaoxia added 1 commit 2026-09-06 12:38:31 +08:00
feat(#1714): complete 请求携带 file_size,修复同名兜底误杀新视频
AI Code Review / AI Code Review (pull_request) Successful in 1m30s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m41s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m45s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 2m47s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 6s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 14s
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Validate - Style (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Validate - Security (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (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 / PR Build Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
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 / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (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 / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 9s
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 2s
2c9db4430c
completeDirectUpload 请求体新增 file_size,prepareDirectUploadHandle
的 complete 闭包透传 data.file.size(队列/非队列两条链路同时生效)。

后端 complete_direct_upload 的 _find_duplicate_asset 同名兜底分支
需要用 file_size 做大小严格校验:此前前端不传(后端收到 0),
导致 30 分钟内同名视频(如 iPhone IMG_2285.MOV)即使内容/大小全新
也被同名兜底误判重复跳过。

单测:completeDirectUpload 透传 file_size;uploadAssetDirect 老流程
断言 complete body 携带 file_size。
Collaborator

【阻塞级判定】

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

📊 审查概览

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

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

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

良好实践

  1. 注释详尽:在接口定义和代码实现处均添加了清晰的注释,说明了 file_size 字段的作用(后端去重校验)以及缺失该字段的潜在后果,提高了代码的可维护性。
  2. 测试覆盖完善:不仅添加了针对 file_size 字段的单元测试,还在集成测试中补充了相应的断言,确保了功能变更的正确性。

🤖 由 AI 代码审查机器人自动生成 | 2026-09-06 04:39:53 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:通过 - 建议级问题数量:0 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 无 ### ✅ 良好实践 1. **注释详尽**:在接口定义和代码实现处均添加了清晰的注释,说明了 `file_size` 字段的作用(后端去重校验)以及缺失该字段的潜在后果,提高了代码的可维护性。 2. **测试覆盖完善**:不仅添加了针对 `file_size` 字段的单元测试,还在集成测试中补充了相应的断言,确保了功能变更的正确性。 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-09-06 04:39:53 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1731 | | 预览链接 | [https://pr-1731.preview.xiaoxiajianji.com](https://pr-1731.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot approved these changes 2026-09-06 12:41:17 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-09-06 12:41:17 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot merged commit 9bca7e53e3 into develop 2026-09-06 12:44:06 +08:00
auto-approve-bot deleted branch feat/1714-complete-file-size 2026-09-06 12:44:06 +08:00

🗑️ 预览环境已清理

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

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

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