fix(points) P0: 分辨率映射改为短边规则,修复竖屏积分少算68%的计费bug #2154

Merged
auto-approve-bot merged 1 commits from fix/2154-resolution-mapping-short-side into develop 2026-10-03 01:30:19 +08:00
Owner

P0 Bug

原 resolve_video_dimensions() 把 p 值当 height,9:16 竖屏 720p 返回 (405,720),但 Seedance 2.5 720p 9:16 v10实测输出是 720×1280,导致竖屏单少算 68% 积分。

修复

p 值=短边像素数:

  • 16:9 横屏:短边是 height,width=ceil(short*16/9)偶对齐(480p→854×480,720p→1280×720,1080p→1920×1080)
  • 9:16 竖屏:短边是 width,height=ceil(short*16/9)偶对齐(480p→480×854,720p→720×1280,1080p→1080×1920)
  • 1:1 方屏:w=h=short
  • _infer_resolution_key 改为接收 (w,h) 按 min(w,h) 短边推断(settle 按实际尺寸查价目表)
  • _RESOLUTION_HEIGHT 改名 _RESOLUTION_SHORT_SIDE

价格验证

  • 15s/720p/9:16: 9.52 → 29.68 ✅
  • 30s/1080p/9:16: 46.34 → 146.14 ✅
  • 15s/720p/16:9 与 9:16 同价(像素数相同,合理)

测试

  • 16407 passed(新增9组尺寸断言+偶数校验+短边推断回归+精确价格断言)
  • 本地 py_compile + 全量单测全绿
## P0 Bug 原 resolve_video_dimensions() 把 p 值当 height,9:16 竖屏 720p 返回 (405,720),但 Seedance 2.5 720p 9:16 v10实测输出是 720×1280,导致竖屏单少算 68% 积分。 ## 修复 p 值=短边像素数: - 16:9 横屏:短边是 height,width=ceil(short*16/9)偶对齐(480p→854×480,720p→1280×720,1080p→1920×1080) - 9:16 竖屏:短边是 width,height=ceil(short*16/9)偶对齐(480p→480×854,720p→720×1280,1080p→1080×1920) - 1:1 方屏:w=h=short - _infer_resolution_key 改为接收 (w,h) 按 min(w,h) 短边推断(settle 按实际尺寸查价目表) - _RESOLUTION_HEIGHT 改名 _RESOLUTION_SHORT_SIDE ## 价格验证 - 15s/720p/9:16: 9.52 → **29.68** ✅ - 30s/1080p/9:16: 46.34 → **146.14** ✅ - 15s/720p/16:9 与 9:16 同价(像素数相同,合理) ## 测试 - 16407 passed(新增9组尺寸断言+偶数校验+短边推断回归+精确价格断言) - 本地 py_compile + 全量单测全绿
xiaoxia added 1 commit 2026-10-03 01:17:19 +08:00
fix(points) P0: 分辨率映射改为短边规则,修复竖屏积分少算68%的计费bug
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 0s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (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 / 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 / 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 / PR Build API Image (pull_request) Successful in 56s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m20s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m44s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m4s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 4m53s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 5m4s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 5m26s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 5m37s
AI Code Review / AI Code Review (pull_request) Successful in 6m53s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 12m15s
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 1s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 9m55s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 30s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 5m46s
6161ecdc35
原逻辑把 p 值当 height,9:16 竖屏时返回 (405,720),实际 Seedance 720p 9:16 输出是 (720,1280)。
正确规则:p 值=短边像素数。
- 横屏16:9:短边是height,width=ceil(short*16/9)偶对齐(720p→1280×720、1080p→1920×1080、480p→854×480)
- 竖屏9:16:短边是width,height=ceil(short*16/9)偶对齐(720p→720×1280、1080p→1080×1920、480p→480×854)
- 方屏1:1:w=h=short
- _RESOLUTION_HEIGHT 改名 _RESOLUTION_SHORT_SIDE 语义更准确
- _infer_resolution_key 改为接收(w,h)按 min(w,h) 短边推断(settle 用实际输出尺寸查价目表)
- w/h max(1,...) 防御前置,避免 UnboundLocalError

修复前后价格对比:
- 15s/720p/9:16:9.52 → 29.68(+211%,原少收68%)
- 30s/1080p/9:16:46.34 → 146.14
- 15s/720p/16:9 与 15s/720p/9:16 同价(像素数相同,合理)
- 15s/720p/1:1:16.78

新增单测:
- 9组(resolution,ratio)→(w,h)精确断言(含480p ceil+偶对齐)
- 所有组合偶数校验
- _infer_resolution_key 按短边推断(含竖屏720×1280→720p回归测试,防止重蹈覆辙)
- 3组灵应指定的精确积分数值断言(29.68/146.14/横竖同价)
全量单测 16407 passed。
xiaoxia reviewed 2026-10-03 01:17:31 +08:00
xiaoxia left a comment
Author
Owner

P0 BUG FIX - 单测16407全绿、精确价格断言通过、尺寸映射全组合验证

P0 BUG FIX - 单测16407全绿、精确价格断言通过、尺寸映射全组合验证

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #2154 | | 预览链接 | [https://pr-2154.preview.xiaoxiajianji.com](https://pr-2154.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot merged commit d0582d1600 into develop 2026-10-03 01:30:19 +08:00
auto-approve-bot deleted branch fix/2154-resolution-mapping-short-side 2026-10-03 01:30:21 +08:00

🗑️ 预览环境已清理

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

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

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