feat(#1714): complete 请求携带 file_size,修复同名兜底误杀新视频 (#1731)
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 4s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 4s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 4s
CI/CD Pipeline / Check push changed paths (push) Successful in 8s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 29s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 30s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 43s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 32s
CI/CD Pipeline / CI Gate (pull_request) Successful in 11s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Successful in 41s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 43s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 42s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m43s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 1m53s
CI/CD Pipeline / Integration Tests (push) Successful in 2m17s
CI/CD Pipeline / Validate - Style (push) Successful in 2m44s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m10s
AI Code Review / AI Code Review (pull_request) Failing after 3m38s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m28s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 5m23s
CI/CD Pipeline / Validate - Security (push) Successful in 5m39s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m3s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 5m4s
CI/CD Pipeline / Unit Tests (push) Successful in 8m16s
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Failing after 242h31m46s
CI/CD Pipeline / Deploy Production (push) Failing after 242h31m46s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 242h31m48s
CI/CD Pipeline / CI Gate (push) Failing after 242h31m48s
CI/CD Pipeline / Build Production Web Image (push) Failing after 242h31m49s
CI/CD Pipeline / Build Production API Image (push) Failing after 242h31m49s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Failing after 242h38m35s
CI/CD Pipeline / Retag skipped Staging API Image (push) Failing after 242h38m36s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 242h38m57s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 242h39m20s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 242h39m21s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 242h39m27s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 242h39m22s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 242h39m29s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 242h40m5s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 242h39m29s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 242h40m5s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 242h39m30s
CI/CD Pipeline / Validate - Style (pull_request) Failing after 242h40m8s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 242h39m30s
CI/CD Pipeline / Frontend Lint (push) Failing after 242h40m8s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 242h40m4s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 242h40m14s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 242h40m6s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 242h40m15s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 242h40m6s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 242h40m15s
CI/CD Pipeline / PR Build API Image (push) Failing after 242h40m16s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 242h40m6s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 242h40m17s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Failing after 242h40m7s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 242h40m18s
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 243h13m10s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 243h13m33s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 243h14m40s
CI/CD Pipeline / Validate - Security (pull_request) Failing after 243h14m42s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 243h14m49s
CI/CD Pipeline / PR Build Web Image (push) Failing after 243h14m50s

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #1731.
This commit is contained in:
2026-09-06 12:44:05 +08:00
committed by auto-approve-bot
parent 70dde8cbfb
commit 9bca7e53e3
2 changed files with 20 additions and 0 deletions
+16
View File
@@ -242,6 +242,20 @@ describe("assets API", () => {
await expect(completeDirectUpload({ name: "test-item" })).resolves.not.toThrow()
})
it("请求体携带 file_size(后端同名兜底去重的大小校验依赖它)", async () => {
await completeDirectUpload({
project_id: "p-1",
library_id: "l-1",
storage_key: "uploads/k.mp4",
file_size: 12345,
} as never)
const completeCalls = mockPost.mock.calls.filter(
([u]: [string]) => u === "/upload/direct/complete",
)
expect(completeCalls).toHaveLength(1)
expect(completeCalls[0][1]).toMatchObject({ file_size: 12345 })
})
it("should reject on API error", async () => {
mockGet.mockRejectedValue(new Error("Network error"))
mockPost.mockRejectedValue(new Error("Network error"))
@@ -354,6 +368,8 @@ describe("assets API", () => {
([u]: [string]) => u === "/upload/direct/complete",
)
expect(completeCalls).toHaveLength(1)
// complete 请求必须带上 file_size,否则后端同名兜底会误杀同名新视频
expect(completeCalls[0][1]).toMatchObject({ file_size: file.size })
XMLHttpRequest.prototype.open = origOpen
XMLHttpRequest.prototype.send = origSend
if (origSetReadyState) {