test: add production launch evidence gate

This commit is contained in:
Codex
2026-06-30 02:31:25 +08:00
parent 52cef9f13d
commit 9a8a85a8c0
10 changed files with 822 additions and 2 deletions

View File

@@ -250,6 +250,7 @@ npm run check:importer
npm run check:taro
npm run test:readiness
npm run test:auth:remote-smoke
npm run test:launch-gate
npm run smoke:auth:remote
npm run audit:runtime
npm run pb:import:dry-run
@@ -304,6 +305,23 @@ npm run test:rls
这个命令会先执行本地 smoke seed再在事务内模拟 Supabase `authenticated/anon/platform_admin` JWT claims验证主租户和合作商租户的品牌、设置、域名、成员、题库、订单、资源、SaaS 账单等代表性表不会跨租户泄露;同时验证无 `tenant_id` claim 不能读取租户数据,普通租户上下文不能跨租户写入。脚本里的临时 grant 会随事务回滚,不会改变实际 schema 权限。
## 生产上线证据门禁
正式切换前不要只看“口头跑过测试”。把真实生产/预生产验收结果整理成证据文件,再运行上线门禁:
```bash
cp docs/refactor/production-launch-evidence.template.json docs/refactor/production-launch-evidence.json
npm run launch:gate -- --evidence docs/refactor/production-launch-evidence.json
```
`production-launch-evidence.json` 不入 Git里面只记录验收摘要、artifact 路径、审批人和时间,不保存真实 access token、支付密钥、对象存储密钥或用户隐私明细。门禁会要求以下证据全部齐备并通过`readiness:production``readiness:production:db`、真实 `smoke:auth:remote``test:rls`、PocketBase production dry-run、`pb:import:validate`、API/worker/Taro 构建、`audit:runtime``@codex-security` 扫描,以及备份、回滚、真实数据抽样、生产 provider、对象存储控制、支付对账和三套 H5 `runtime-config.json` 人工确认。
模板文件:
```text
docs/refactor/production-launch-evidence.template.json
```
## PocketBase 迁移 Dry-Run
把旧 PocketBase 导出的集合 JSON 放到仓库根目录 `pb_export/` 后,先执行不写数据库的静态 dry-run