fix(ci): 修复npm registry配置 + package-lock.json同步 + pro套餐测试 #1264

Merged
auto-approve-bot merged 4 commits from fix/npm-registry-and-lockfile-sync into develop 2026-08-07 18:11:01 +08:00
Owner

修复内容

1. npm registry 配置优化

  • web.Dockerfile: 移除 npm config set registry,改用 npm ci --registry=https://registry.npmmirror.com 内联参数
  • preview-deploy.yml: 同上,移除全局 npm config set registry
  • step_frontend_install.sh: 同上
  • 构建命令: npx tsc/vite build 改为 ./node_modules/.bin/tsc/vite build 直接调用,避免 npx 额外解析

2. package-lock.json 同步

  • 重新生成 package-lock.json,补全 @testing-library/dom 等 16 个缺失包
  • 修复 npm ci 报 package.json/lock file 不同步的错误

3. pro 套餐测试修复

  • test_all_tiers_exist 更新预期集合,添加 pro 套餐(PR #1262 新增)

影响的 CI 失败

  • Run #24686: Frontend Unit Tests (npm ci 不同步)
  • Run #24686: Build Staging Web Image (npm ci 不同步)
  • Run #24686: Unit Tests (test_all_tiers_exist)
## 修复内容 ### 1. npm registry 配置优化 - **web.Dockerfile**: 移除 `npm config set registry`,改用 `npm ci --registry=https://registry.npmmirror.com` 内联参数 - **preview-deploy.yml**: 同上,移除全局 npm config set registry - **step_frontend_install.sh**: 同上 - **构建命令**: `npx tsc/vite build` 改为 `./node_modules/.bin/tsc/vite build` 直接调用,避免 npx 额外解析 ### 2. package-lock.json 同步 - 重新生成 package-lock.json,补全 `@testing-library/dom` 等 16 个缺失包 - 修复 `npm ci` 报 package.json/lock file 不同步的错误 ### 3. pro 套餐测试修复 - `test_all_tiers_exist` 更新预期集合,添加 pro 套餐(PR #1262 新增) ## 影响的 CI 失败 - Run #24686: Frontend Unit Tests (npm ci 不同步) ❌ → ✅ - Run #24686: Build Staging Web Image (npm ci 不同步) ❌ → ✅ - Run #24686: Unit Tests (test_all_tiers_exist) ❌ → ✅

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1264 | | 预览链接 | [https://pr-1264.preview.xiaoxiajianji.com](https://pr-1264.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia added 2 commits 2026-08-07 17:41:51 +08:00
- web.Dockerfile: 移除npm config set registry,改用--registry内联参数;
  npx tsc/vite build改为./node_modules/.bin/直接调用
- preview-deploy.yml: 同上,移除全局npm config set registry
- step_frontend_install.sh: 移除全局npm config set registry,改用--registry内联
- package-lock.json: 重新生成,补全@testing-library/dom等缺失包
- test_wave78_duplication_domain.py: test_all_tiers_exist添加pro套餐
fix(ci): ci-pipeline.yml E2E测试npm ci添加--registry镜像参数
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 / 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 / Check if frontend-only change (pull_request) Successful in 39s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 58s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m8s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m29s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m32s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m45s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 2m0s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 2m15s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m0s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m48s
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 / PR Build API Image (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 / 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
9f0524c714
xiaoxia force-pushed fix/npm-registry-and-lockfile-sync from b8bef76bf2 to 9f0524c714 2026-08-07 17:41:51 +08:00 Compare
xiaoxia added 1 commit 2026-08-07 17:45:44 +08:00
fix(ci): 修复 Prettier 格式化问题 (FormFields.tsx)
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 / 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 / Check if frontend-only change (pull_request) Successful in 27s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m5s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m6s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m57s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 2m6s
AI Code Review / AI Code Review (pull_request) Failing after 2m14s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m51s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m11s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 2m33s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m0s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 3m55s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 4m20s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 5m26s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m44s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 9m9s
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
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
CI/CD Pipeline / CI Gate (pull_request) Failing after 6s
47a1b8933c
auto-approve-bot approved these changes 2026-08-07 17:50:34 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-08-07 17:50:34 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
xiaoxia added 1 commit 2026-08-07 17:57:45 +08:00
fix(ci): 修复 test_list_tiers 缺少 pro 套餐
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 / Deploy Staging (Watchtower auto-deploy) (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 / Check if frontend-only change (pull_request) Successful in 33s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 42s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m4s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m28s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m24s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m58s
AI Code Review / AI Code Review (pull_request) Successful in 2m9s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m47s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 2m15s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m9s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 4m39s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 5m36s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 6m56s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m37s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 9m28s
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
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
CI/CD Pipeline / CI Gate (pull_request) Successful in 8s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 12m40s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 15s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 22s
1be2f51a06
Collaborator

【阻塞级判定】

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

📊 审查概览

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

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

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

  1. [apps/web/package-lock.json] 核心类型依赖标记为 devOptional 的风险

    • 具体内容:diff 显示 @types/react@types/prop-types 被标记为 "devOptional": true。这通常意味着如果安装失败(例如环境不兼容),npm 会忽略错误而不中断安装。作为核心类型定义库,如果它们缺失会导致 TypeScript 类型检查失效或产生大量 any 类型,掩盖潜在错误。建议确认这是否为 npm 自动生成的行为,如果是手动修改,建议改回 "dev": true 以确保类型安全。
  2. [.gitea/workflows/ci-pipeline.yml, scripts/ci/step_frontend_install.sh, infra/docker/web.Dockerfile] 镜像源地址硬编码

    • 具体内容:https://registry.npmmirror.com 在多个文件中被硬编码。虽然本次修改统一了行为,但为了便于维护和应对镜像源变更,建议将镜像源地址提取为 CI/CD 的环境变量(如 NPM_REGISTRY_URL)或 Workflow 的顶层变量,实现一处修改全局生效。

良好实践

  1. 构建加速优化:在 CI 和 Dockerfile 中将 npm config set registry 改为 npm ci --registry=...,避免了修改全局 npm 配置文件,更加安全且符合幂等性原则。
  2. 构建性能优化:在 preview-deploy.ymlweb.Dockerfile 中,将 npx 命令替换为直接调用 ./node_modules/.bin/ 下的二进制文件。在已确保 node_modules 存在的前提下,这能显著减少 npx 的包解析开销,提升构建速度。
  3. 测试用例更新:及时更新了 test_wave78_duplication_domain.py 中的断言,确保测试覆盖了新增的 "pro" 层级,保证了测试的有效性。

🤖 由 AI 代码审查机器人自动生成 | 2026-08-07 09:59:51 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:通过 - 建议级问题数量:2 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 1. **[apps/web/package-lock.json] 核心类型依赖标记为 devOptional 的风险** - 具体内容:diff 显示 `@types/react` 和 `@types/prop-types` 被标记为 `"devOptional": true`。这通常意味着如果安装失败(例如环境不兼容),npm 会忽略错误而不中断安装。作为核心类型定义库,如果它们缺失会导致 TypeScript 类型检查失效或产生大量 `any` 类型,掩盖潜在错误。建议确认这是否为 `npm` 自动生成的行为,如果是手动修改,建议改回 `"dev": true` 以确保类型安全。 2. **[.gitea/workflows/ci-pipeline.yml, scripts/ci/step_frontend_install.sh, infra/docker/web.Dockerfile] 镜像源地址硬编码** - 具体内容:`https://registry.npmmirror.com` 在多个文件中被硬编码。虽然本次修改统一了行为,但为了便于维护和应对镜像源变更,建议将镜像源地址提取为 CI/CD 的环境变量(如 `NPM_REGISTRY_URL`)或 Workflow 的顶层变量,实现一处修改全局生效。 ### ✅ 良好实践 1. **构建加速优化**:在 CI 和 Dockerfile 中将 `npm config set registry` 改为 `npm ci --registry=...`,避免了修改全局 npm 配置文件,更加安全且符合幂等性原则。 2. **构建性能优化**:在 `preview-deploy.yml` 和 `web.Dockerfile` 中,将 `npx` 命令替换为直接调用 `./node_modules/.bin/` 下的二进制文件。在已确保 `node_modules` 存在的前提下,这能显著减少 `npx` 的包解析开销,提升构建速度。 3. **测试用例更新**:及时更新了 `test_wave78_duplication_domain.py` 中的断言,确保测试覆盖了新增的 `"pro"` 层级,保证了测试的有效性。 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-08-07 09:59:51 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
auto-approve-bot merged commit 36d590e55a into develop 2026-08-07 18:11:01 +08:00
auto-approve-bot deleted branch fix/npm-registry-and-lockfile-sync 2026-08-07 18:11:01 +08:00

🗑️ 预览环境已清理

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

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

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