test(wave201): concat_engine_pure 单测补全 +85测 #1167

Merged
xiaoxia merged 5 commits from test/wave201-concat-engine-pure into develop 2026-07-30 00:25:42 +08:00
Owner

变更内容

补全视频拼接引擎纯逻辑模块 apps/worker/video_processing/concat_engine_pure.py 单元测试,覆盖15个纯函数,新增85个测试用例。

覆盖函数

帧率处理 (2个)

  • parse_fps - 帧率解析(数字/分数/字符串/默认值)
  • format_fps_filter - fps滤镜参数格式化

参数计算 (2个)

  • resolve_output_params - 输出参数三级优先级解析(配置→探测→默认)
  • calculate_scaled_size - 等比缩放+黑边填充计算

Stream Copy判断 (1个)

  • can_use_stream_copy - 无损拼接可行性判断(编码/分辨率/帧率一致性)

文件列表生成 (1个)

  • generate_concat_file_list - concat demuxer文件列表(含单引号转义)

滤镜构建 (5个)

  • build_scale_pad_filter - scale+pad等比缩放滤镜
  • build_fps_filter - fps滤镜
  • build_setpts_filter - setpts时间戳重置
  • build_concat_filter - concat滤镜(支持音视频轨)
  • build_single_segment_filter_chain - 单段完整预处理链

验证与工具 (4个)

  • validate_concat_config - 拼接配置验证(8项规则)
  • validate_video_path - 路径安全验证(遍历攻击防护)
  • estimate_total_duration - 总时长估算
  • count_valid_segments - 有效段统计

测试数据

  • 新增测试: 85个
  • 测试通过率: 100%
  • 全部为纯函数单元测试,无外部依赖
## 变更内容 补全视频拼接引擎纯逻辑模块 `apps/worker/video_processing/concat_engine_pure.py` 单元测试,覆盖15个纯函数,新增85个测试用例。 ### 覆盖函数 **帧率处理 (2个)** - `parse_fps` - 帧率解析(数字/分数/字符串/默认值) - `format_fps_filter` - fps滤镜参数格式化 **参数计算 (2个)** - `resolve_output_params` - 输出参数三级优先级解析(配置→探测→默认) - `calculate_scaled_size` - 等比缩放+黑边填充计算 **Stream Copy判断 (1个)** - `can_use_stream_copy` - 无损拼接可行性判断(编码/分辨率/帧率一致性) **文件列表生成 (1个)** - `generate_concat_file_list` - concat demuxer文件列表(含单引号转义) **滤镜构建 (5个)** - `build_scale_pad_filter` - scale+pad等比缩放滤镜 - `build_fps_filter` - fps滤镜 - `build_setpts_filter` - setpts时间戳重置 - `build_concat_filter` - concat滤镜(支持音视频轨) - `build_single_segment_filter_chain` - 单段完整预处理链 **验证与工具 (4个)** - `validate_concat_config` - 拼接配置验证(8项规则) - `validate_video_path` - 路径安全验证(遍历攻击防护) - `estimate_total_duration` - 总时长估算 - `count_valid_segments` - 有效段统计 ## 测试数据 - 新增测试: **85个** - 测试通过率: 100% - 全部为纯函数单元测试,无外部依赖

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1167 | | 预览链接 | [https://pr-1167.preview.xiaoxiajianji.com](https://pr-1167.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
Collaborator

【阻塞级判定】

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

📊 审查概览

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

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

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

  1. [.gitea/workflows/acr-cleanup.yml:81] 移除硬编码IP地址
    • 具体内容:代码中使用了 staging_host="${STAGING_SSH_HOST:-47.98.113.167}",虽然方便调试,但将生产环境IP硬编码在代码中存在信息泄露风险且不够灵活。建议强制要求配置 STAGING_SSH_HOST 环境变量,移除默认值。

良好实践

  1. [.gitea/workflows/acr-cleanup.yml] dry_run 参数默认值设置为 true,防止误操作导致数据删除,安全意识良好。
  2. [.env.example] 配置文件注释详尽,包含使用说明和默认值逻辑,对开发者友好。
  3. [.gitea/workflows/acr-cleanup.yml] 清理逻辑中加入了白名单机制(获取staging运行中镜像),有效防止误删正在使用的镜像。

格式检查通过 | 逻辑审查需修改 | 建议关注性能


🤖 由 AI 代码审查机器人自动生成 | 2026-07-29 14:53:35 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:通过 - 建议级问题数量:1 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 1. **[.gitea/workflows/acr-cleanup.yml:81] 移除硬编码IP地址** - 具体内容:代码中使用了 `staging_host="${STAGING_SSH_HOST:-47.98.113.167}"`,虽然方便调试,但将生产环境IP硬编码在代码中存在信息泄露风险且不够灵活。建议强制要求配置 `STAGING_SSH_HOST` 环境变量,移除默认值。 ### ✅ 良好实践 1. **[.gitea/workflows/acr-cleanup.yml]** `dry_run` 参数默认值设置为 `true`,防止误操作导致数据删除,安全意识良好。 2. **[.env.example]** 配置文件注释详尽,包含使用说明和默认值逻辑,对开发者友好。 3. **[.gitea/workflows/acr-cleanup.yml]** 清理逻辑中加入了白名单机制(获取staging运行中镜像),有效防止误删正在使用的镜像。 --- ✅ 格式检查通过 | ✅ 逻辑审查需修改 | ✅ 建议关注性能 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-07-29 14:53:35 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
xiaoxia changed target branch from main to develop 2026-07-30 00:08:01 +08:00
xiaoxia added 5 commits 2026-07-30 00:08:01 +08:00
test(shared): add wave198 ai_service unit tests (+41)
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 12s
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 1m58s
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 / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (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
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled
cb85b33ee9
Add comprehensive unit tests for shared.ai_service pure logic:
- _parse_recommend_response (27 tests): basic parsing, clips handling,
  field validation/boundaries, markdown code blocks, confidence clamping,
  config deep copy, total duration calculation
- _fallback_recommend_clips (10 tests): structure, intro/outro,
  showcase count, no assets, asset assignment, title/duration/order
- _call_ai_cover_service (4 tests): upload/manual/ai_frame types,
  frame_time range validation
test(wave199): sticker_engine_pure 单测补全 +141测
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 46s
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) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m39s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m22s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 50s
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 - Code Quality (pull_request) Failing after 2m29s
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 / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (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
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
d92ff7aa36
补全贴纸引擎纯逻辑模块单元测试,覆盖23个纯函数:
- 安全类型转换: safe_float/safe_int/safe_bool
- 尺寸估算: estimate_sticker_size/estimate_text_size
- 时间计算: calculate_fade_out_start/calculate_end_time/has_time_range
- 滤镜构建: build_scale_filter/build_opacity_filter/build_image_fade_filters
- drawtext相关: escape_drawtext_text/build_drawtext_alpha_expr/build_stroke_params/build_shadow_params
- 贴纸管理: sort_stickers_by_z_index/filter_enabled_stickers/count_sticker_types
- overlay相关: build_overlay_position/build_pre_filter_label
- 验证函数: validate_image_sticker/validate_text_sticker
- enable表达式: build_enable_expr

141个测试全部通过。
test(wave200): pip_engine_pure 单测补全 +86测
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 36s
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) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m7s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m21s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 2m10s
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (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
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled
cafe063859
补全画中画引擎纯逻辑模块单元测试,覆盖10个函数:
- compute_pip_size: 尺寸计算与钳制
- compute_pip_position: 位置计算与边界钳制
- build_pip_pre_filter: 预处理滤镜链(scale/圆角/边框/透明度/动画)
- build_animation_filters: fade类入场出场动画
- build_overlay_expr: overlay位置表达式(4方向滑入滑出)
- build_enable_expr: 时间控制表达式
- build_pip_filters: 完整滤镜链编排
- validate_pip_layer: 配置验证(12项校验)
- count_visible_layers: 可见图层统计
- sort_layers_by_z_index: z-index排序

86个测试全部通过。
test(wave201): concat_engine_pure 单测补全 +85测
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 23s
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) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m24s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m10s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m16s
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 / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (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
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
90f703e49e
补全视频拼接引擎纯逻辑模块单元测试,覆盖15个纯函数:
- parse_fps: 帧率解析(数字/分数/字符串)
- format_fps_filter: fps滤镜格式化
- resolve_output_params: 输出参数解析(配置→探测→默认三级优先级)
- calculate_scaled_size: 等比缩放+填充偏移计算
- can_use_stream_copy: stream copy可行性判断
- generate_concat_file_list: concat demuxer文件列表生成
- build_scale_pad_filter: scale+pad滤镜构建
- build_fps_filter: fps滤镜构建
- build_setpts_filter: setpts滤镜构建
- build_concat_filter: concat滤镜构建
- build_single_segment_filter_chain: 单段视频预处理滤镜链
- validate_concat_config: 拼接配置验证
- validate_video_path: 视频路径安全验证
- estimate_total_duration: 总时长估算
- count_valid_segments: 有效段统计

85个测试全部通过。
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 / Check if frontend-only change (pull_request) Successful in 20s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m15s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m1s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m21s
AI Code Review / AI Code Review (pull_request) Successful in 2m18s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m53s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 5m18s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
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 API Image (pull_request) Successful in 3m52s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 3m53s
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 / Integration Tests (pull_request) Successful in 3m1s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 9m39s
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 / CI Gate (pull_request) Successful in 28s
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 58s
7edb66869f
xiaoxia merged commit 77a49e3365 into develop 2026-07-30 00:25:42 +08:00

🗑️ 预览环境已清理

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

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

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