diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index 57910990..5f616d52 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -6958,3 +6958,19 @@ - 相关记录:BUG-441、BUG-449、BUG-450、BUG-452 - 复发自:BUG-450 - 修复版本:待发布 + +## BUG-454 | 新增后台页面未同步 capability audit 路由契约 + +- 状态:resolved +- 首次发现:2026-08-31 +- 最近更新:2026-08-31 +- 影响面:`backend-quality-gate.yml` 的 Python quality gate、`_capability_audit()` 应用路由扫描 +- 用户现象:推送 `53450f5bf362c85d8b3bfbae7f2ab724e30f3208` 到 `staging` 后,quality gate run `2217` 的 `validate` 失败,部署未继续。 +- 触发条件:新增 `frontend/src/app/admin/feature-pricing/page.tsx` 与 `frontend/src/app/admin/pricing-simulator/page.tsx` 后,运行 `tests/test_api_server_security.py::test_capability_audit_scans_registry_and_local_sources`。 +- 根因:`_scan_app_routes()` 按文件系统扫描真实 `page.*` 路由,而测试在 `tests/test_api_server_security.py` 中维护旧的硬编码完整列表,未加入两个新路由。 +- 修复:在路由快照断言中加入 `admin/feature-pricing` 与 `admin/pricing-simulator`,保持测试与真实页面树的排序结果一致。未修改 workflow 配置或路由扫描逻辑。 +- 验证:针对性 capability audit 测试通过;随后执行 quality gate 关注的 Python 测试集合,确认原失败断言已消除。 +- 防复发:新增或删除前端 `page.*` 路由时,必须同步 capability audit 的路由契约测试;quality gate 失败时先查看失败测试,不把下游 `publish` 的附带状态当成根因。 +- 相关记录:无 +- 复发自:无 +- 修复版本:待发布 diff --git a/tests/test_api_server_security.py b/tests/test_api_server_security.py index 1f89ee99..61624d4b 100644 --- a/tests/test_api_server_security.py +++ b/tests/test_api_server_security.py @@ -1575,11 +1575,13 @@ def test_capability_audit_scans_registry_and_local_sources() -> None: 'admin/credit-transactions', 'admin/customers', 'admin/feature-flags', + 'admin/feature-pricing', 'admin/model-releases', 'admin/models', 'admin/orders', 'admin/packages', 'admin/payments', + 'admin/pricing-simulator', 'admin/products', 'admin/roles', 'admin/security',