Files
Jyotisha/docs/tasks/PROGRESS-report-md-page-20260906.md
T
Jesse_ChenandCursor cfcd369d4f feat(report): render longform Markdown as the report and close gaps2 holes
New reports skip the writer, persist pl9 Markdown as the body, and settle zero-token usage on the catalog model. Planned longform sections now emit blocked rows instead of vanishing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 21:46:16 +08:00

51 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PROGRESS · 报告详情页改渲染长报告 MD2026-09-06
工作树:`.worktrees/report-md-page-20260906`
分支:`codex/report-md-page-20260906`
基线:`origin/staging` `e428e9d0`
任务书:`TASK-report-md-page-20260906.md`(硬依赖 gaps2,已在同一 worktree 完成)
未改 `.gitea/workflows/**`,不提升 main。
## 开工回执
- 目标:新报告 worker 只生成 pl9 长报告 MD;详情页渲染该 MD;writer 停用保留;零模型用量必须结算。
- 顺序:gaps2 装配缺口 → MD-only 生成/计费 → 详情页 TOC/懒渲染 → 导出与报告中心 → 质量门。
- 最大风险:`complete_personal_report_job` 仍要合法 v2 封面文档;计费 `completeUsage` 必须接受 0 token,且不得把 `actualModelId` 写成 `unknown`
## 我替领导拍的板
- 计费:沿用 `report.full` 预留,结算 `inputTokens=0 outputTokens=0 costMicrousd=0``actualModelId` 用创建时的目录默认模型 id。缺少合法模型 id 时 **在报告标 ready 之前** 重试,避免预留悬挂。
- 封面文档:writer 不再跑;写入一份最小合法 v2 文档(各主题走 blocked disclosure),页面不渲染它。卡片摘要来自生成时对 MD「摘要」的截取,仍落在封面 `executiveSummary.summary`,列表 JSON 路径不变。
- 旧报告:无附录 MD 即显示「旧版本报告,请重新生成」,不维护五章视图。professional-reference POST 改为只读缓存,缺失返回 410。
- 导出:详情页用内存中的同一份 MD 下载;文件名 `个人报告-YYYY-MM-DD`。打印为次按钮。
## 任务状态
| 任务 | 状态 | 说明 |
| --- | --- | --- |
| gaps2 | 完成 | 见 `PROGRESS-report-longform-gaps2-20260906.md`BUG-561 / BUG-562 |
| MD-only 生成 + 计费 | 完成 | `PERSONAL_REPORT_WRITER_ENABLED=false`0-token settle |
| 详情页 TOC/懒渲染 | 完成 | `react-markdown` + `remark-gfm` + `skipHtml`;首屏导航+摘要;H2 懒渲染 |
| 导出 / 报告中心 | 完成 | 「导出报告(.md)」;一步式等待文案 |
| 端到端 staging | 待部署后 | 本机质量门先跑;staging 真实创建仍需部署 |
## 计费适配
`complete_usage` 已允许 `input_tokens >= 0`。生产 worker 在长报告路径上:
1. 先加载模型目录,没有默认模型则 `model_unavailable`(可重试),不跑引擎。
2. 生成成功后带 `actualModelId=catalog.defaultModelId`、0 token。
3. worker-core 若看到空/`unknown` 模型 id,在 `completeReportReady` 之前抛错,避免报告已 ready、预留永不结算。
## 首屏渲染
本地对含导航/摘要/宽表/诚实标签的样例 Markdown 做 `renderToStaticMarkup``frontend/tests/personal-report-longform-md.test.ts` 锁首屏 < 1500ms(本机实测约 30ms)。完整 ~250KB / 2700 行报告的浏览器首屏仍需 staging 部署后补测;H2 分段懒渲染后首屏只挂载导航+摘要。
## 质量门命令
```bash
.venv/bin/python -m pytest tests/test_report_longform_gaps2.py tests/test_timing_precision_contract.py tests/test_report_longform_parity.py -q
cd frontend && ./node_modules/.bin/tsc --noEmit
cd frontend && ./node_modules/.bin/tsx --test tests/personal-report-longform-md.test.ts tests/personal-report-view.test.ts tests/personal-report-export.test.ts tests/personal-report-entry.test.ts tests/report-polling-contract.test.ts tests/professional-report-reference-route.test.ts tests/personal-report-worker.test.ts tests/personal-report-api.test.ts
```