chore: require real data api benchmark evidence

This commit is contained in:
Codex
2026-06-30 13:13:21 +08:00
parent 6e17e77aaf
commit 6d5ea62bf5
6 changed files with 136 additions and 5 deletions

View File

@@ -151,4 +151,37 @@ npm run perf:api:local
npm run launch:gate
```
`launch:gate` 会强制检查一条真实数据读路径压测证据:
```json
{
"id": "performance.api-real-data-read",
"status": "pass",
"command": "PERF_START_SERVER=false PERF_API_BASE=https://api.example.com PERF_DURATION_SECONDS=300 PERF_CONCURRENCY=30 PERF_RAMP_SECONDS=30 PERF_INCLUDE_WRITES=false npm run perf:api:local > docs/refactor/launch-artifacts/api-real-data-read-benchmark.log",
"completedAt": "2026-06-30T10:48:00+08:00",
"artifact": "launch-artifacts/api-real-data-read-benchmark.log",
"summary": {
"errors": 0,
"errorRate": 0,
"p95Ms": 0,
"p99Ms": 0,
"concurrency": 30,
"durationSeconds": 300,
"includeWrites": false
}
}
```
上线门禁的最低机器阈值:
- `errors = 0`
- `errorRate <= 0.001`
- `p95Ms <= 300`
- `p99Ms <= 800`
- `concurrency >= 30`
- `durationSeconds >= 120`
- `includeWrites = false`
这些字段应从 `perf:api:local` JSON 报告的 `summary.errors``summary.errorRate``summary.latencyOk.p95Ms``summary.latencyOk.p99Ms``config.concurrency``config.durationSeconds``config.includeWrites` 转写到证据摘要。更高的 50/100 并发、写入混合场景和容量结论仍应作为人工容量报告归档;门禁只负责挡住明显不达标的基础读路径。
证据中只记录报告路径、并发矩阵、P95/P99、错误率和结论不保存真实 token、支付密钥、用户隐私或完整响应。