Acceptance of a12f2c0d against TASK-report-density-fix-20260923: F1 to F6
all pass. On the fixture the fact tables are 130 rows across 600 visible
cells with no engine key, no array index and no long decimal, and every
sourcePath resolves back into the packet. The first major period reads 18
years. Python and TS appendix cleaning are byte-identical. Removing the
writer table guard turns four of its six tests red. Under Node 22 the
frontend goes from 3,730 tests / 26 failing to 3,748 / 26 with an identical
list; the Python quick gate goes from 946 passed / 1 failed to 948 / 0.
One thing still fails: the database test for the report snapshot passes a
428,557-byte SQL string to psql as a single argument, past Linux's 131,072
byte limit, so it dies with E2BIG before reaching Postgres. The snapshot row
has never run against a real database. Recorded as BUG-1011 with a fix brief.
The real-person checklist the executor's tool refused to write is added here.
Privacy scan on this tree before push: zero findings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
5.4 KiB
TASK-report-density-fix2-20260923 · 报告快照数据库测试无法启动
基线 commit
- 被验收实现:
a12f2c0d(fix(report): make density facts readable and printable,已在origin/staging;门禁 run 6294 红,未部署,/api/health仍为1bc6a954) - 修复分支:
codex/report-density-fix2-20260923,从origin/staging起
上一轮修复单验收结论
TASK-report-density-fix-20260923.md 的 F1–F6 全部通过,只剩本单一项。
| 项 | 结论 | 证据 |
|---|---|---|
| F1 事实表可读 | 通过 | fixture 上 8 组、130 行、600 个可见格:引擎键名 0、数组下标 0、超过 2 位小数 0;130 个 sourcePath 全部能在 packet 中取回;主运表首段"年数"为 18.00,出生剩余 0.72 年移入说明;年度盘为空是因为 packet 确实没有年度行星位置,说明如实写"未返回" |
| F2 隐私门 | 通过 | 登记只放行那 5 个字符:钉死 fixture 来源、JSON 节点、行号与整行内容;负向测试证明多一处、换输入、换行都会重新报错。本机 test_repo_privacy_markers.py 全过 |
| F3 记录 | 通过 | BUG-1003~1007、1009、1010 已写,状态如实为 investigating;PROGRESS 含三栏说明;"未提交、推送"已更正。真人清单执行方被工具拒写,已由 Claude 补写 docs/testing/report-density-20260922.md |
| F4 规则一份 | 通过 | 共用 scripts/reader_appendix_language.rules.json;同一份 fixture markdown,Python 与 TS 输出逐字节相同,"第 N 页"为 0,行数不变 |
| F5 写表拦截 | 通过 | 去掉拦截后 6 条新测试红 4 条,恢复后全绿;writer 提示词已写明不输出表格 |
| F6 打印 | 通过(真浏览器待清单) | 打印前展开全部 <details>、打印后恢复原状态;打印样式避免行跨页 |
| 前端 | 通过 | Node 22:基线 3,730 / 26 失败 → 3,748 / 26 失败,名单逐条一致 |
| tsc / lint / build | 通过 | 0 错 / 0 error;/ 仍 ○ Static;首屏 gzip 623,329(与上一轮相同) |
| Python 快速门 | 通过 | 基线 946 passed / 1 failed(隐私)→ 948 passed / 0 failed |
| 数据库测试 | 未通过(本单) | 见下 |
P3 各项未修,按原修复单不算未通过:复合状态译成重复短语 318 次、unclosed_divisional_chart 等四个状态词仍在附录、北交点Rahu 这类中英拼接来自引擎自带字段。
事故实证
frontend/tests/database-personal-report-sections.test.ts 的快照一例把整份快照内联进 SQL,经 tests/helpers/postgres-fixture.ts 的 psqlAs 以 psql -Atc <sql> 传入。按测试同样的构造方式生成的 SQL 为 428,557 字节,是单个命令行参数;Linux 单参数上限 MAX_ARG_STRLEN 为 131,072 字节。验收时把同一段 SQL 以同样方式传给 /bin/true,结果 spawn E2BIG。
所以这条测试在门禁(Linux + Docker)上启动 psql 之前就失败。快照行在真实 Postgres 里的写入、重复写入保留首版、他人不可读三条性质,至今没有任何一次真实运行。执行方两轮都因 Docker 地址池耗尽没跑,验收机没有 Docker。
根因
测试辅助函数把 SQL 放在命令行参数里。以前的数据库测试 SQL 都很短,从未碰到上限。
决策记录
- 本单不推翻任何决策。
- 修的是测试辅助函数的传参方式,不是缩小测试数据。不得用更短的 markdown 或裁剪过的快照来"让它过":快照体积正是要验证的东西之一。
硬红线
- 快照内容保持真实全量(fixture 原样)。
- 不改
personal_report_sections表结构、RPC 或迁移。 - 改辅助函数后,所有既有数据库测试必须照常通过;不得跳过、不得标 skip。
- 不得强推、rebase 或重写
staging。 - 测试总数不得低于 3,748。
任务分解
G1 · SQL 改走标准输入(BUG-1011)
psql 与 psqlAs 改为经标准输入(execFileSync 的 input)或临时文件(psql -f)传 SQL,不再放进 argv。
验收标准:
- 新增一条辅助函数测试:执行一段超过 131,072 字节的 SQL 并取回结果;
- 在有 Docker 的 Linux 上跑
npm run test:db --prefix frontend,快照一例与全部既有数据库测试通过,输出贴进进度记录; - 若本机仍无法跑 Docker,以门禁 run 的数据库步骤结果为准,把 run 编号与该步通过的测试名写进进度记录。不得写成"本地通过"。
G2 · 记录
docs/BUG_HISTORY.md 中 BUG-1011 按结果更新;进度记录追加本单一节。
让步顺序
只有 G1、G2 两项,都必须做。
已知且不属于本单的门禁红
staging 门禁自 2026-09-22 起在报告工作之前就一直红。本机与基线共有的前端失败里,除数据库类外还有 viewport-breakpoint-contract、chat-composer-queue、chat-panel-scroll-guard、model-configuration-security、health-deployment、staging-backend-workflows、identity-auth-integration、admin-database。本单修完后门禁仍可能因这些既有失败保持红色,需要另开单处理,不得在本单顺手修。
开工前置命令
git fetch origin --prune
git status -sb
git worktree add -b codex/report-density-fix2-20260923 .worktrees/report-density-fix2-20260923 origin/staging
docker info # 没有 Docker 就按 G1 最后一条走门禁证据
BUG 编号
BUG-1011(已由 Claude 写入 investigating 记录)。开工时核对最大号。