Sync develop → main (v0.1.101) #121

Merged
xiaoxia merged 10 commits from develop into main 2026-06-30 11:10:59 +08:00

10 Commits

Author SHA1 Message Date
xiaoxia b6ead113cf Merge pull request 'fix: 上传端点 500 根因修复 (list_by_project → find_by_project) + OSS 诊断能力' (#120) from fix/upload-size-limit-2000mb into develop
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
Tests / lint (pull_request) Failing after 217h42m35s
Tests / test (pull_request) Failing after 217h43m38s
PR#120: fix list_by_project → find_by_project (3 files)
2026-06-30 10:25:44 +08:00
Audit Bot 37152a0729 fix: list_by_project → find_by_project (修复上传/诊断端点 500)
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
根因:upload.py、chunked_upload.py、asset_diagnosis.py 调用了
asset_library_repository.list_by_project(),但 SQLAlchemy 实现
只有 find_by_project(),导致 AttributeError → 500。

同步修复 InMemory 实现的方法名以保持一致。
2026-06-30 10:14:08 +08:00
Audit Bot 05c9137ece fix: 上传端点异常处理 + OSS 诊断能力
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
问题:PR#119 修复变量名后上传端点仍然 500,说明根因不仅是变量名错误

修复:
1. upload.py — 所有 3 个上传端点添加完整异常捕获和日志
   - prepare_direct_upload: 捕获 RuntimeError→503 + 其他异常→500+日志
   - complete_direct_upload: file_exists() 异常捕获→503(之前未捕获→500)
   - upload_asset: upload_file() 异常捕获→503/500+日志(之前未捕获→500)

2. storage.py — OSSStorageService.__init__ 添加启动诊断日志
   - 凭证缺失时记录 missing env vars
   - oss2 SDK 未安装时记录错误
   - bucket 初始化成功/失败时记录

3. health.py — /ready 端点增加 OSS 检查
   - 检查凭证是否配置
   - 检查 oss2 SDK 是否可用
   - 调用 get_bucket_info() 验证连通性

部署后请调用 GET /api/v1/ready 查看 OSS 状态
2026-06-30 09:56:20 +08:00
xiaoxia bae9b509de Merge pull request 'fix: 修复上传端点 500 错误 — 配置字段名拼写错误' (#119) from fix/upload-size-limit-2000mb into develop
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
2026-06-30 09:30:08 +08:00
Audit Bot e6ecce79ee fix: rename OSS_DIRECT_UPLOAD_EXPRESS_SECRET to OSS_DIRECT_UPLOAD_EXPIRE_SECONDS
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
Root cause of upload endpoint 500 errors:
- config.py defined OSS_DIRECT_UPLOAD_EXPRESS_SECRET (wrong name)
- upload.py accessed settings.OSS_DIRECT_UPLOAD_EXPIRE_SECONDS (correct name)
- AttributeError on every call to prepare_direct_upload → 500

This fixes both /api/v1/upload/prepare-direct-upload and any other
upload endpoints that reference the expire seconds config.
2026-06-30 09:24:27 +08:00
xiaoxia 6dbb281acf Merge pull request 'fix: 上传文件大小限制从 800MB 提升至 2000MB' (#117) from fix/upload-size-limit-2000mb into develop
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
2026-06-30 07:50:46 +08:00
CI Test d934e0e322 chore(ci): add automatic Docker image cleanup after builds
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
- Add scripts/cleanup_old_images.sh: keeps only last 2 versions
  per service (api/worker/web), removes old local tags and registry
  blobs via Registry API, prunes dangling images
- Add cleanup step to deploy.yml build-production-runtime-images job
  with if:always() to ensure cleanup runs even on build failure
- Prevents disk space exhaustion from accumulated Docker images
  and Registry blobs on the build server
2026-06-30 06:58:48 +08:00
Audit Bot 304354208a fix(assets): add project_id to OSS direct upload and align size limit to 2048MB
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
P1: prepareDirectUpload and completeDirectUpload now require project_id,
uploadAssetDirect calls getOrCreateDefaultProject() to obtain it automatically.
P2: MAX_FILE_SIZE changed from 2*1024^3 to 2048*1024*1024 to align with
backend OSS_DIRECT_UPLOAD_MAX_MB=2000.
2026-06-30 00:07:27 +08:00
Audit Bot b5e27a5e9e feat(assets): add 2GB file size validation and OSS direct upload for large files
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
- Add MAX_FILE_SIZE (2GB) validation in handleUpload with friendly error message
- Route files >100MB through OSS presigned direct upload (uploadAssetDirect)
- Keep small file form upload (uploadAsset) for files <=100MB
- Update upload hint text to show '单文件不超过 2GB' limit
- Add directUploadMutation with proper loading state tracking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-29 22:13:08 +08:00
Audit Bot b98c83582b fix: 上传文件大小限制从 800MB 提升至 2000MB
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
P0 修复:
- config.py: OSS_DIRECT_UPLOAD_MAX_MB 默认值从 800 改为 2000
- config.py: 添加 AliasChoices 支持 MAX_UPLOAD_SIZE_MB 环境变量
  (.env.production 中 MAX_UPLOAD_SIZE_MB=2000 现在可被正确读取)

P1 修复:
- infra/nginx/xiaoxia-saas.conf: client_max_body_size 800m → 2g(3处)
- infra/docker/nginx-production.conf: client_max_body_size 800m → 2g
2026-06-29 22:11:22 +08:00