chore: harden production readiness gates

This commit is contained in:
Codex
2026-07-01 06:09:23 +08:00
parent f3f6028633
commit bb938cf6e2
13 changed files with 695 additions and 63 deletions

View File

@@ -1,6 +1,6 @@
# 后端当前能力盘点
更新时间2026-06-30
更新时间2026-07-01
当前后端已经完成商用 SaaS 题库系统的主干骨架PostgreSQL 多租户 schema、Node.js 业务 API、PocketBase 数据导入工具、本地 seed、API 集成测试和对象存储签名 provider。
@@ -18,6 +18,7 @@
| RLS/租户隔离 | 可联调 | 表层普遍有 `tenant_id` 和 RLS 策略API 已支持 `tk_` 迁移 session 与 Supabase Auth JWT 双入口,并覆盖跨租户/伪造身份集成测试;生产前继续补真实云端 JWT/RLS 回归 |
| API 分层 | 可联调 | `apps/api/src/core` + `apps/api/src/features/*` |
| Docker API | 可联调 | `docker-compose.api.yml``apps/api/Dockerfile` 可用 |
| 生产配置门禁 | 可联调 | `readiness:production`/`:db` 和 API/worker 启动 fail-fast 会阻断弱密钥、mock/未知短信 provider、legacy 身份头、local_dev/未知存储、非 HTTPS 存储公开 URL、非官方阿里云 OSS endpoint、阿里云 OSS 内网直签、未接外部资源扫描、provider 公开配置混入密钥、OAuth/支付回调非 HTTPS 或缺必填字段 |
| 测试 | 可联调 | `npm run check:refactor` 覆盖 TS 检查、导入校验、生产 readiness 脚本测试、seed、API 集成测试;排行榜已覆盖默认关闭、四类指标、班级范围和跨租户拒绝 |
| 根 workspace | 可联调 | 根目录已清理为新技术栈 monorepo 编排层 |
@@ -193,6 +194,7 @@
```bash
npx supabase db reset
npm run audit:runtime
npm run security:repo
npm run check:refactor
npm run check:taro
npm run build:taro:h5:student
@@ -212,9 +214,13 @@ npm run test:worker:assets
npm run test:worker:exports
npm run test:worker:public-banks
npm run test:worker:student-supervision
npm run smoke:launch-persona
npm run perf:api:local
git diff --check
```
当前产品边界:学生头像只支持男女预设,不做上传、裁剪或第三方头像同步;排行榜后端具备可选能力,但默认关闭,学生端默认不请求,只有租户显式购买/开启活动并完成专项压测后再补日/周榜预聚合和防刷。
`check:refactor` 包含:
- API TypeScript 检查