fix(#1895): /subscription/plans 路由挂载位置修复(解决 404) #1955

Merged
auto-approve-bot merged 2 commits from fix/1895-subscription-plans-route into develop 2026-09-16 09:59:30 +08:00
Owner

问题

PR #1951 把 GET /subscription/plans 挂在了 points_router(prefix=/points)上,导致实际路径是 /points/subscription/plans 而非前端期望的 /subscription/plans,返回 404。

修复

  • 将 plans 端点迁移到 subscription_router(prefix=/subscription),与 /current /change-plan /cancel 等端点在一起
  • 清理 points.py 中误用的 imports 和端点
  • 单测绕过 integration fixture 的 sys.modules 注入,直接从真实文件加载

验证

  • GET /subscription/plans 正确返回月卡/季卡/年卡档位
  • 不影响 points 路由(recharge/check/rules/membership 等)
  • 15523+ 单测全绿(1 个并发登录 flaky 是已有问题)
## 问题 PR #1951 把 GET /subscription/plans 挂在了 points_router(prefix=/points)上,导致实际路径是 /points/subscription/plans 而非前端期望的 /subscription/plans,返回 404。 ## 修复 - 将 plans 端点迁移到 subscription_router(prefix=/subscription),与 /current /change-plan /cancel 等端点在一起 - 清理 points.py 中误用的 imports 和端点 - 单测绕过 integration fixture 的 sys.modules 注入,直接从真实文件加载 ## 验证 - GET /subscription/plans 正确返回月卡/季卡/年卡档位 - 不影响 points 路由(recharge/check/rules/membership 等) - 15523+ 单测全绿(1 个并发登录 flaky 是已有问题)
xiaoxia added 1 commit 2026-09-16 09:44:32 +08:00
fix(#1895): move /subscription/plans to correct router (fix 404)
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m25s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m8s
AI Code Review / AI Code Review (pull_request) Successful in 6m31s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 5h38m51s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 5h39m4s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 5h38m4s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1s
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 3m39s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m39s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m45s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 3m20s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 3m17s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 5h38m10s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 5h38m10s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 5h38m11s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 5h38m18s
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 / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 5h37m58s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 5h38m4s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 5h38m6s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 5h37m58s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 5h38m1s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 5h38m11s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 6h14m2s
9df214b170
The /subscription/plans endpoint was incorrectly mounted on points_router (which
has prefix=/points), making it accessible at /points/subscription/plans instead
of /subscription/plans. Moved it to the subscription_router (prefix=/subscription)
where it belongs, next to /current /change-plan /cancel /toggle-auto-renew etc.

Also cleaned up:
- Removed misplaced endpoint and unused imports (MembershipPlanItem/MembershipPlansResponse,
  MEMBERSHIP_PRICES) from points.py
- Fixed unit tests to load the real subscription module (avoiding sys.modules
  shadowing by the integration test fixture)
- Added proper typing import to subscription.py

Endpoint: GET /subscription/plans → returns {plans: [...]} with monthly/quarterly/yearly
tiers, price_cents, monthly_price_cents, duration_days, points_discount, features.

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1955 | | 预览链接 | [https://pr-1955.preview.xiaoxiajianji.com](https://pr-1955.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot added 1 commit 2026-09-16 09:51:36 +08:00
style: auto-format with black + isort + ruff + prettier [skip ci-format-check]
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 46s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 47s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m19s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m0s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m7s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 3m11s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 3m16s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m30s
AI Code Review / AI Code Review (pull_request) Successful in 6m39s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 7m3s
CI/CD Pipeline / CI Gate (pull_request) Successful in 2s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 4m41s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 18s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 2m31s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 5h24m48s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 5h31m46s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 5h31m53s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 5h31m56s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 5h31m2s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 5h23m58s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 5h23m58s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 5h30m54s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 5h23m56s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 5h30m54s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 5h30m59s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 5h31m2s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 5h30m56s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 5h30m59s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 5h31m3s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 5h31m3s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 5h31m5s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 5h59m50s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 6h6m54s
76b2cf6f32
auto-approve-bot merged commit 41cd9cdc56 into develop 2026-09-16 09:59:30 +08:00
auto-approve-bot deleted branch fix/1895-subscription-plans-route 2026-09-16 09:59:31 +08:00

🗑️ 预览环境已清理

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

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

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