feat(新手引导): 支持十圈进度与逐圈发奖 #200

Merged
guke merged 3 commits from fix-newUserGuildVideoFix0729 into main 2026-07-30 10:49:24 +08:00
Member
No description provided.
zuochenyong added 1 commit 2026-07-29 22:44:59 +08:00
zuochenyong added 1 commit 2026-07-29 22:53:19 +08:00
zuochenyong added 1 commit 2026-07-29 22:54:27 +08:00
Member

🤖 review-pr 深审结论

🔴 建议改后再合(置信度 0.88)— 功能逻辑与迁移都验证通过,但打破了 guide_video 全部测试,且夹带无关改动。

实跑(worktree 合并最新 main)

  • 迁移正常alembic upgrade head(sqlite) 全链跑通;新列(seq/started_at 改 nullable、duration_ms/config_version/settled_circles/prepared_at/expires_at、status 16→24)与两索引(ux_coin_transaction_guide_video_ref/ix_guide_video_play_expires_at)全部落地;down_revision 唯一接 guide_video_scene_unique,不分叉。
  • 功能逻辑正确(手动 smoke,忠实生产每圈独立 session):prepare→start→10 圈各发 reward_coin//10、合计满额、重放幂等 already_grantedmax_playsplay_limit_reached
  • 钱包统一加锁安全:原担心 autoflush=False+populate_existing=True 会在同事务多次发奖时丢余额(inactivity 先 grant_coins 再 grant_cash)。实跑复现推翻:真实 grant_coins(-100)+grant_cash(-50) 最终 coin/cash 均正确清零;全量测试对比 base 无新增失败。

问题

  • [high] 打破 guide_video 全部测试tests/test_guide_video.py 6 用例 1 failed + 5 error。根因:改了客户端 API 契约(start 需 play_token、reward 改 circleset_videoanalysis=)与 repository 签名,但完全没更新测试文件,fixture set_video()analysis= 直接抛 ValueError。新 prepare/start/reward 流程零自动化覆盖。请补/改测试。
    • 诚实基线:base main 本身已有 9 个既有失败(compare_record/coupon_proxy/invite*/risk_monitor/withdraw_tiers),与本 PR 无关,未计入。
  • [med] 夹带无关改动 app/admin/main.py — 端口注释 8771→8773、CORS dev 源 3001→3002。与「十圈发奖」无关,像本地联调环境泄漏;CORS 去掉 localhost:3001 可能打断其他同事的 admin 前端。建议拆出或还原。
  • [med] 部署依赖 + 存量视频会被重判:新增 FFPROBE_BINARY 运行期依赖;迁移 _backfill_configs 会对存量引导视频重新 ffprobe 并套新约束(30–180s、h264/hevc、aac)。存量若不满足(时长不符/服务器无 ffprobe)→ analysis_status=invalidenabled=False,功能静默关闭需重传。上线前请先装 ffprobe 并知悉存量可能被禁用。

正面:upload 临时文件原子发布(os.replace)+失败清理、cleanup_old_videos 保护期设计合理。低危:prepared 行(seq=NULL)无回收、崩溃残留 .upload 临时片。

只读深审 · worktree 合并最新 main · 已实跑(迁移+功能+钱包并发)

## 🤖 review-pr 深审结论 🔴 **建议改后再合**(置信度 0.88)— 功能逻辑与迁移都验证通过,但打破了 guide_video 全部测试,且夹带无关改动。 **实跑(worktree 合并最新 main)** - ✅ **迁移正常**:`alembic upgrade head`(sqlite) 全链跑通;新列(seq/started_at 改 nullable、duration_ms/config_version/settled_circles/prepared_at/expires_at、status 16→24)与两索引(`ux_coin_transaction_guide_video_ref`/`ix_guide_video_play_expires_at`)全部落地;`down_revision` 唯一接 `guide_video_scene_unique`,不分叉。 - ✅ **功能逻辑正确**(手动 smoke,忠实生产每圈独立 session):prepare→start→10 圈各发 `reward_coin//10`、合计满额、重放幂等 `already_granted`、`max_plays` 后 `play_limit_reached`。 - ✅ **钱包统一加锁安全**:原担心 `autoflush=False`+`populate_existing=True` 会在同事务多次发奖时丢余额(inactivity 先 grant_coins 再 grant_cash)。**实跑复现推翻**:真实 `grant_coins(-100)+grant_cash(-50)` 最终 coin/cash 均正确清零;全量测试对比 base **无新增**失败。 **问题** - **[high] 打破 guide_video 全部测试** — `tests/test_guide_video.py` 6 用例 **1 failed + 5 error**。根因:改了客户端 API 契约(start 需 `play_token`、reward 改 `circle`、`set_video` 需 `analysis=`)与 repository 签名,但**完全没更新测试文件**,fixture `set_video()` 少 `analysis=` 直接抛 `ValueError`。新 prepare/start/reward 流程零自动化覆盖。请补/改测试。 - 诚实基线:base main 本身已有 9 个既有失败(compare_record/coupon_proxy/invite*/risk_monitor/withdraw_tiers),与本 PR 无关,未计入。 - **[med] 夹带无关改动 `app/admin/main.py`** — 端口注释 8771→8773、CORS dev 源 3001→3002。与「十圈发奖」无关,像本地联调环境泄漏;CORS 去掉 `localhost:3001` 可能打断其他同事的 admin 前端。建议拆出或还原。 - **[med] 部署依赖 + 存量视频会被重判**:新增 `FFPROBE_BINARY` 运行期依赖;迁移 `_backfill_configs` 会对存量引导视频重新 ffprobe 并套新约束(30–180s、h264/hevc、aac)。存量若不满足(时长不符/服务器无 ffprobe)→ `analysis_status=invalid`、`enabled=False`,功能静默关闭需重传。上线前请先装 ffprobe 并知悉存量可能被禁用。 **正面**:upload 临时文件原子发布(`os.replace`)+失败清理、`cleanup_old_videos` 保护期设计合理。低危:`prepared` 行(seq=NULL)无回收、崩溃残留 `.upload` 临时片。 <sub>只读深审 · worktree 合并最新 main · 已实跑(迁移+功能+钱包并发)</sub>
guke merged commit ebacf01742 into main 2026-07-30 10:49:24 +08:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: WonderableAI/shaguabijia-app-server#200