73c2a1a51e
Staging at 4ef4c406 produced a standard five-theme document with nine
charts, five chapter bodies, and an empty blocked disclosure.
Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
5.8 KiB
Markdown
77 lines
5.8 KiB
Markdown
# PROGRESS · BUG-535 文档 charts 上限绑定 CHART_IDS(2026-09-04)
|
||
|
||
工作树:`/Users/jesse/Downloads/Copse/astrology/.worktrees/report-chart-cap-20260904`
|
||
分支:`codex/report-chart-cap-20260904`
|
||
基线:任务书写 `e674cd38`;开工 `origin/staging` HEAD 为 `d2955c62`(含本任务书 `40387ff9`)。
|
||
任务书:仓库根 `TASK-report-chart-cap-20260904.md`
|
||
未改 `.gitea/workflows/**`,不提升 main,未放宽字段级校验,未改 v1 `charts.max(3)`。
|
||
|
||
| 任务 | 状态 | BUG |
|
||
| --- | --- | --- |
|
||
| 1 上限绑定 + 消费点核对 + 回归 | 完成 | BUG-535 |
|
||
| 2 终稿 parse path 日志 | 完成 | BUG-535 |
|
||
| 3 部署后真实 personal_full | 完成:`4ef4c406` request `0679321b` ready,九图五章,blocked 空 | BUG-535 |
|
||
|
||
## 实现要点
|
||
|
||
- v2 文档 `charts.max(CHART_IDS.length)`,单一真源,不写裸数字 9。
|
||
- 装配侧 `assembleReportDocumentV2` 的允许分盘集合改为 `new Set(CHART_IDS)`;`DOCUMENT_VARGA_CHART_IDS` 从 `CHART_IDS` 去掉 `D1` 派生。
|
||
- 装配把 `actionNotes` 截到 `REPORT_DOCUMENT_V2_ACTION_NOTES_MAX`(24),**不放宽** schema。staging 第一次五章写完后又 `final_parse_rejected`,`parsePaths` 只有 `actionNotes`/`too_big`。
|
||
- 终稿 `safeParseServerReportDocument` 失败时,`generation_failed` 增加 `parsePaths: [{path, code}]`。只记路径与 zod/guard 代号,不记 `message`、不记正文或 hash 值。合同 guard 不再一律写成 `(guard)/guard`,而是字段路径 + 种类。
|
||
- 装配后的 `applyReportGuard` 把章节标成 blocked 时,会去掉「一定会」这类确定性用语,并让 `currentPhase` 跟 timing 章一致。**不放宽** parse 侧字段校验。
|
||
- JSON Schema `maxItems` / chart `enum`、Python `CHART_IDS` 与 `len(CHART_IDS)` 与 TS 对齐(合同三份真源)。冻结 skill 包 `6.9.14` / `6.9.15` 未动。
|
||
|
||
## 消费点核对(红线 3)
|
||
|
||
| 点 | 结论 |
|
||
| --- | --- |
|
||
| `personal-report-contract.ts` `z.enum(CHART_IDS)` + `charts.max` | 上限已绑定 `CHART_IDS.length`;枚举本来就是 9 个 |
|
||
| `REQUIRED_THEME_CHARTS` | 按主题要哪些分盘,不是张数上限;未改 |
|
||
| `personal-report-generation.ts` `DOCUMENT_VARGA_CHART_IDS` | 已改为从 `CHART_IDS` 去掉 D1 |
|
||
| 同文件装配 `Set([...])` | 已改为 `Set(CHART_IDS)` |
|
||
| `canonicalDocumentVargaChartId` 正则 | 引擎别名提取,不是计数上限;当前覆盖 D2/D6/D8/D9/D10/D11/D24/D30 |
|
||
| `report-evidence-bundle-v2.ts` `charts.max(24)` | bundle 上限 24,大于文档 9,无脱节 |
|
||
| `personal-report-document-view.tsx` | 按数组渲染,无硬编码 6 |
|
||
| `personal-report-route-core.ts` `themes.max(6)` | 主题数不是分盘数 |
|
||
| `report-theme-evidence-plan.ts` health `chartIds` | 证据计划,不是文档张数 |
|
||
| `contracts/personal-report/report-document.v2.schema.json` | 原 `maxItems: 6` 且 enum 缺 D6/D8/D30;已对齐,测试锁 `maxItems === CHART_IDS.length` |
|
||
| `scripts/personal_report_contract.py` | 原 enum 6 个、硬编码 `else 6`;已 `len(CHART_IDS)` 且补 D6/D8/D30 |
|
||
| `skills/.../6.9.14` 与 `6.9.15` 的合同副本 | 冻结包,仍是历史 v1 三盘;未改 |
|
||
|
||
## 测试
|
||
|
||
- 9 张全枚举文档过 `safeParseServerReportDocument`
|
||
- 超过 `CHART_IDS.length` 仍 `too_big`
|
||
- 四主题既有用例不回归
|
||
- 五主题(含 health)分章管线 READY,文档 charts 正好 9 张、blocked 为空
|
||
- 五主题每章 6 条行动仍 READY,`actionNotes.length === 24`
|
||
- `final_parse_rejected` 日志含 `thematicNarrative.0.title` / `too_big`,不含超长标题正文
|
||
- guard 失败日志含字段路径与种类(如 `requestedThemes`/`theme_coverage`、`actionNotes[0].note`/`forbidden_medical_diagnosis`),不含违规正文
|
||
- Python `test_v2_accepts_full_chart_ids_set`
|
||
|
||
## 门禁输出
|
||
|
||
- `./node_modules/.bin/tsc --noEmit`:0
|
||
- `npm run lint`:0 error / 74 warning(既有,未动)
|
||
- 定向:`personal-report-contract` + `personal-report-generation-v2` + `personal-report-api`:**110 pass / 0 fail**(含新增 9 图 parse、五主题 READY、超限 too_big、parsePaths 日志)
|
||
- `.venv/bin/python -m pytest tests/test_personal_report_contract.py`:**40 pass**(含 `test_v2_accepts_full_chart_ids_set`)
|
||
- 定向补跑 contract + generation + generation-v2:**96 pass**(含 guard 路径代号、blocked 段去掉「一定会」)
|
||
- 全量 `npm test`:Docker 库测争用超时(`database-*` 与部分会起 Postgres 的套件),与既有环境缺口同类;与本单无关
|
||
- `next build`:本单未改 UI/路由,未跑
|
||
|
||
### 任务 3 第一次(health `d4627a50`,含 `61194690`)
|
||
|
||
request `31025c49`:5× `consultation_workflow` 200;五章 ready;摘要 `stop`。终稿仍 `final_parse_rejected`。日志 `parsePaths: [{path:"actionNotes", code:"too_big"}]`——charts 上限已不是这条失败原因。未放宽 `actionNotes.max(24)`,装配截断到该上限后再验。
|
||
|
||
### 任务 3 第二次(health `a75929c1`)
|
||
|
||
request `f10daf6d`:五章 ready。终稿 `final_parse_rejected`,`parsePaths` 三条都是 `(guard)/guard`。charts 与 actionNotes 已过。日限默认 5 当天用满,staging 进程临时读 8(下次正式部署前 env 文件置回 8,验收后再恢复 5)。未放宽 schema。
|
||
|
||
### 任务 3 第三次(health `4ef4c406`)
|
||
|
||
request `0679321b`:**ready**。文档 v2:charts=9(D1/D2/D6/D8/D9/D10/D11/D24/D30),五章有正文(career 1459 / health_pressure 1224 / marriage 1016 / timing 744 / wealth 1136 字),actionNotes=22(上限 24),blocked 披露=0。阅读页可打开。Writer `finishReason=stop`;章 inputTokens 5866 / 6402(随后 repair 6435)/ 5806 / 6036 / 5921,摘要 1542。墙钟约 13s / 9s+21s / 10s / 8s / 12s / 3s。成本 5.22× 不在本单。staging 日限 env 文件已恢复 5。
|
||
|
||
## 让步
|
||
|
||
无。JSON Schema 的 charts `maxItems` 只能写数字,用合同测试把它锁到 `CHART_IDS.length`。`actionNotes` 合同上限未放宽。
|