a3bb78e06b
Security Quality Gate / npm audit, Bandit, pip-audit, detect-secrets (pull_request) Failing after 16m35s
6.2 KiB
6.2 KiB
AI 合同平台 V2 交付质量门复跑记录
记录时间:2026-07-03 18:12:07 +08:00
最新复核:2026-07-11 17:02:50 +08:00
结论
本轮交付质量门通过。
- 本地后端测试、前端 typecheck、前端生产构建均通过。
npm audit、Bandit、pip-audit均通过。- 最新 Bandit focused rerun 清零,
bandit-focused-rerun.json、npm-audit.json、pip-audit-project.json均为 0 findings / vulnerabilities。 - 已部署到
192.168.3.90smoke 环境,远端 Docker smoke、Contract API schema-check、AI Platform schema-check 均通过。 - 搜索/RAG 性能修复后,发布质量门已带
--run-benchmark复跑通过。 - Trace governance 仍按既定策略处理:smoke 可继续开启观察,production 暂不开启,24 小时观察窗口列为上线前检查项,不阻塞当前开发。
本地质量门
| 项目 | 命令 | 结果 |
|---|---|---|
| Contract API 测试 | python -m pytest yuqei-contract-platform\services\contract-api\tests -q |
通过,117 个测试已收集并执行通过 |
| AI Platform API 测试 | python -m pytest yuqei-ai-platform\services\ai-platform-api\tests -q |
通过,61 passed |
| Worker 测试 | python -m pytest yuqei-ai-platform\services\worker\tests -q |
通过,6 passed |
| Python SDK 测试 | python -m pytest yuqei-ai-sdk-python\tests -q |
通过,3 passed |
| 前端 typecheck | npm run web:typecheck |
通过 |
| 前端生产构建 | npm run web:build |
通过,Next.js 生产构建完成,64 个静态页面生成完成 |
安全扫描
Artifact 目录:
project-docs\qa-artifacts\v2-security-scan\2026-07-11T15-46-09
| 项目 | 命令 | 结果 |
|---|---|---|
| npm 生产依赖审计 | npm audit --omit=dev --audit-level=high --json |
通过,0 vulnerabilities |
| Bandit Python 源码扫描 | .\.venv-audit\Scripts\bandit.exe -r ... -f json -o ...\bandit-project.json |
通过,高/中/低危均为 0 |
| Python 依赖审计 | .\.venv-audit\Scripts\pip-audit.exe --path .venv-project\Lib\site-packages -f json -o ...\pip-audit-project.json --progress-spinner off |
通过,41 个依赖,0 known vulnerabilities |
本轮修复:
yuqei-ai-platform\services\ai-platform-api\src\yuqei_ai_platform_api\schema_check.py:Alembic version 查询改为固定 SQL 文本,避免 Bandit B608 对常量表名插值的告警。yuqei-contract-platform\services\contract-api\src\yuqei_contract_api\schema_check.py:Alembic version 查询改为固定 SQL 文本,避免 Bandit B608 对常量表名插值的告警。yuqei-ai-platform\services\ai-platform-api\src\yuqei_ai_platform_api\schema_check.py:secret_ref_columns的成功展示文案改回默认文案,消除 Bandit B105 误报。project-docs\V2-phase3-action-hint-smoke-verification-2026-06-30.md、project-docs\V2-phase3-display-cache-smoke-verification-2026-06-30.md:移除旧 smoke 记录里的明文 SSH 密码示例,改为临时凭据占位符;本次 deploy artifact 中的 staging 副本和.tgz也已同步脱敏。
远端 smoke
部署目标:
- Web:
http://192.168.3.90:13000 - Contract API:
http://192.168.3.90:18100 - AI Platform API:
http://192.168.3.90:18101 - Compose project:
yuqei-contract-v2-smoke - 远端目录:
/opt/apps/ai-contract-platform-v2-smoke
部署命令:
$env:SSHPASS='<由运维临时提供>'
powershell.exe -NoProfile -ExecutionPolicy Bypass -File yuqei-infra\scripts\deploy-v2-smoke-docker.ps1 `
-UseSshpass `
-AllowDirtyWorktree `
-KeepRemoteBackup
部署 artifact:
project-docs\qa-artifacts\v2-smoke-docker-deploy\2026-07-11T14-47-14
部署结果:
V2_SMOKE_DOCKER_DEPLOY_PASS- Web、Contract API、AI Platform health endpoints 可达。
- AI golden sample asset gate 通过:90 samples,6 suites,16 checks。
- 远端数据库 baseline 通过:
yuqei_contract、yuqei_ai、yuqei_ops存在。 - Contract review worker run-once 通过。
远端 schema-check:
| 服务 | URL | 结果 |
|---|---|---|
| Contract API | http://192.168.3.90:18100/api/v1/runtime/schema-check |
status=ok,Alembic head 20260710_0030,database yuqei_contract,display cache mismatch 0 |
| AI Platform API | http://192.168.3.90:18101/api/v1/runtime/schema-check |
status=ok,Alembic head 20260703_0021,database yuqei_ai,pg_trgm/vector 和 pgvector schema 均通过 |
页面/API 抽样:
GET http://192.168.3.90:18101/api/v1/runtime/trace-governance/policy:可访问,返回默认策略。GET http://192.168.3.90:13000/admin/ai-runtime:HTTP 200,页面可访问。
当前剩余项
- Trace governance:production 暂不开启;24 小时 smoke 观察窗口放入上线前检查项。
- 准生产长窗口观察:不阻塞当前开发,但上线前应复核 worker execution 数量、失败率、worker heartbeat 和归档/脱敏计数。
发布质量门固化
本轮已新增统一发布质量门脚本和手动 CI workflow:
- 脚本:
yuqei-infra\scripts\run-release-quality-gate.py - Workflow:
.github\workflows\release-quality-gate.yml - 最新验证 artifact:
project-docs\qa-artifacts\v2-release-quality-gate\2026-07-11T17-02-36
本地验证命令:
python yuqei-infra\scripts\run-release-quality-gate.py `
--web-base-url http://192.168.3.90:13000 `
--contract-api-base http://192.168.3.90:18100 `
--ai-api-base http://192.168.3.90:18101 `
--run-benchmark
验证结果:
V2_RELEASE_QUALITY_GATE_PASS- Contract API schema-check:pass。
- AI Platform schema-check:pass。
- Docker smoke summary:pass,读取
project-docs\qa-artifacts\v2-smoke-docker-deploy\2026-07-11T14-47-14\v2-smoke-docker-deploy-summary.json。 - Interface benchmark summary:pass,读取
project-docs\qa-artifacts\v2-release-quality-gate\2026-07-11T17-02-36\interface-benchmark\interface-benchmark-summary.json。 - 接口压测:7 个场景全部通过,错误率均为 0。
CI 使用说明:
- GitHub Actions 新增
Release Quality Gate手动 workflow。 - 该 workflow 需要能访问
192.168.3.90的 self-hosted runner,默认 label 为self-hosted, yuqei-smoke。 - workflow 可选择只校验已有 smoke/benchmark summary,也可设置
run_benchmark=true在 gate 内先跑接口 benchmark。