fix(consultation): count visible text only for session quota (BUG-732)

Replace append_consultation_question so the 200,000 quota sums only user-visible text, and add a 1,000,000-byte whole-JSON physical cap. Both still return session_full. Advisory lock, request_id idempotency, and the 200-message cap are unchanged.
This commit is contained in:
jesse-ux
2026-09-16 07:41:41 +08:00
parent 7227b1ed8d
commit dcfc2f15af
9 changed files with 794 additions and 1 deletions
+5
View File
@@ -1,5 +1,10 @@
# BLOCKED
## 对话额度拆分(2026-09-16,分支 `codex/consultation-session-capacity-20260915`BUG-732
- **无 Docker** 本机 `docker` 不在 PATH。`npm run test:db``npm run db:migrate:check`(需要 `SCHEMA_DATABASE_URL` 连 Postgres)未跑。`frontend/tests/database-consultation-session-capacity.test.ts` 在无 Docker 时 skip,**不得写成通过**。替代证据是 SQL 静态合同:额度求和表达式不含 `thinkingText` / `thinkingSections`,物理上限为 `length(elem::text)`,算式写在迁移注释里。
- **详情接口体积(5.3,已量,不改接口):** 用三域本命夹具(每轮正文 4,000 汉字 + 思考 4,000 汉字 + 实测 `thinkingSections` + 典型三个 receipt)构造 `GET /api/sessions/[id]``{ session }` JSON。19 轮 UTF-8 **562,240 B0.536 MiB**50 轮 **1,479,034 B1.411 MiB**,约为 2.63 倍。1.4 MiB 在 2 vCPU 上打开长会话会偏沉,分页 / 按需加载历史不在本单(任务书 §9)。PostgreSQL `length()` 按字节计,汉字正文 4,000 字 ≈ 12,000 字节,线上按字节撞 200,000 额度会早于「50 轮汉字」;50 轮数字是任务书字符口径对照。
## 只读页验收修复:镜像与浏览器(2026-09-16,分支 `codex/readonly-pages-fix-20260916`
- **无 Docker** 无法验证 API 镜像里 `COPY vendor` 与容器内 `node --version`。不得写成通过。