fix(report): bind professional report hash to the delivered packet (BUG-693, BUG-694)
Rebind after sanitize, write an explicit binding_scope, and make the quality gate recompute coverage. Wall-clock fields stay in the packet but out of the hash.
This commit is contained in:
@@ -10773,3 +10773,35 @@
|
||||
- 相关记录:BUG-689、BUG-690、BUG-688、BUG-687、BUG-587
|
||||
- 复发自:BUG-689(邀请语复用两候选句)、BUG-690(公开字段未进深比较)
|
||||
- 修复版本:待发布
|
||||
|
||||
## BUG-693 | 专业报告 result_hash 只绑中间态,交付包一半键不在覆盖里
|
||||
|
||||
- 状态:resolved
|
||||
- 首次发现:2026-09-15
|
||||
- 最近更新:2026-09-15
|
||||
- 影响面:`build_professional_report_reference_packet`、`bind_result_to_profile`、`full_report_quality_gate` `provenance:result_binding`
|
||||
- 用户现象:专业参考包回执自称绑定完整,质量门 `provenance:result_binding` 恒 passed。实测第一次哈希 18 个顶层键 / 6.24 MB,交付对象 36 个顶层键 / 10.04 MB;`full_report_pack`、`chart_identity`、`timing_precision_contract`、`birth_provenance`、`rectification_evidence_contract` 等 18 个键未进 `result_hash`。
|
||||
- 触发条件:`pl9-export --pack full`。虚构盘 `1990-05-17 09:26 +08 / 31.23,121.47`。
|
||||
- 根因:`attach_calculation_profile` 在已有 profile 时早退。专业参考链末尾那次调用被当成重绑,实际什么都没做。质量门只比 `result_binding` 与 `input_hash` / `result_hash` 自洽。
|
||||
- 修复:对 `sanitize_professional_report_reference` 之后的交付对象显式 `bind_result_to_profile`。不改通用早退语义。质量门新增 `provenance:result_binding_scope`:按回执排除集重算哈希,缺 scope / 意外排除 / 对不上都 `blocked`。
|
||||
- 验证:`tests/test_calculation_profile_contract.py`、`tests/test_full_report_quality_gate.py`;虚构盘三次 CLI `result_hash` 一致,覆盖 33 个顶层键且含上述五个必覆盖键。
|
||||
- 防复发:专业参考链的绑定必须发生在返回对象上;排除集必须显式落在回执里并被质量门校验。
|
||||
- 相关记录:BUG-694、BUG-576
|
||||
- 复发自:无
|
||||
- 修复版本:待发布
|
||||
|
||||
## BUG-694 | 同一份输入两次专业报告 `result_hash` 不同
|
||||
|
||||
- 状态:resolved
|
||||
- 首次发现:2026-09-15
|
||||
- 最近更新:2026-09-15
|
||||
- 影响面:`bind_result_to_profile` 哈希载荷、`result_binding.binding_scope`
|
||||
- 用户现象:`input_hash` 相同,两次 CLI 的 `result_hash` 不同(`f4f65216…` / `d841a4b3…`)。回执只能证明自洽,不能证明同输入同结果。
|
||||
- 触发条件:同一虚构盘连续跑两次 `pl9-export --pack full --format json`。
|
||||
- 根因:被哈希的载荷含墙钟字段(`elapsed_seconds`、分阶段耗时、VedAstro `called_at` / cache 时间)。`kendra_lords` 由 `list(set(...))` 生成,跨进程顺序不稳定。
|
||||
- 修复:`binding_scope` 显式排除自引用(`report_quality_gate`、`shared_full_report_authority`)、生成时刻(`generated_at` 以及 `**.called_at` / `**.cache_created_at` / `**.cache_expires_at`)、墙钟耗时(`**.elapsed_seconds`)。业务字段仍输出。Kendra / trikona lords 改为排序后的稳定列表。
|
||||
- 验证:同输入两次构造 `result_hash` 相同;只改 `elapsed_seconds` 不变;改 `coverage` 必变。虚构盘三次 CLI 哈希 `2f4739a4…` 全同,内部 `elapsed_seconds` 仍为 2.74 / 2.86 / 2.83。
|
||||
- 防复发:排除集只能是自引用 / 生成时刻 / 墙钟三类,必须写进回执并由质量门重算。加第四类要改任务书。
|
||||
- 相关记录:BUG-693、BUG-576
|
||||
- 复发自:无
|
||||
- 修复版本:待发布
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# 进度 · 专业报告溯源绑定(2026-09-15)
|
||||
|
||||
## 范围
|
||||
|
||||
- 分支:`codex/report-provenance-binding-20260915`(基于 `origin/staging` @ `039b0a26`,含任务书 `416b9a69`)
|
||||
- 任务单:`docs/tasks/TASK-report-provenance-binding-20260915.md`
|
||||
- BUG-693 / BUG-694 resolved
|
||||
- 未改前端、校正流、数据库、迁移、Skill、`CHANGELOG.md`(D5)、`jyotish_api_server.py`
|
||||
- 不抄上游有界投影(D0)
|
||||
|
||||
## 完成
|
||||
|
||||
- T1:`build_professional_report_reference_packet` 先 sanitize 再对交付对象 `bind_result_to_profile`。去掉末尾那次无效的 `attach_calculation_profile(final_packet)`。质量门与 authority 读最终 `result_hash` 后挂上,二者按排除集不进哈希。
|
||||
- T2:`result_binding.binding_scope` 写入 `excluded_top_keys` / `excluded_paths`。墙钟按 `**.elapsed_seconds` 递归排除(含分阶段耗时与 `worksheets` 副本);生成时刻排除 `generated_at` 与 VedAstro `called_at` / cache 时间。`elapsed_seconds` 仍在包里。Kendra / trikona lords 改为排序列表,避免跨进程 `set` 顺序把哈希打散。
|
||||
- T3:质量门新增 `provenance:result_binding_scope`(缺 scope / 意外排除 / 重算对不上 → `blocked`)。既有 `provenance:result_binding` 自洽校验保留。
|
||||
- 未走让步。
|
||||
|
||||
## 修复后复跑(虚构盘 1990-05-17 09:26 +08 / 31.23,121.47,`--pack full --format json`)
|
||||
|
||||
| 次 | result_hash | input_hash[:16] | 顶层键 | 覆盖键 | 墙钟 s | 包内 elapsed_seconds |
|
||||
| --- | --- | --- | ---: | ---: | ---: | ---: |
|
||||
| 1 | `2f4739a484836116…` | `c6e284cfbd9f4efa` | 40 | 33 | 7.861 | 2.742 |
|
||||
| 2 | `2f4739a484836116…` | `c6e284cfbd9f4efa` | 40 | 33 | 8.113 | 2.859 |
|
||||
| 3 | `2f4739a484836116…` | `c6e284cfbd9f4efa` | 40 | 33 | 7.886 | 2.834 |
|
||||
|
||||
三次 `result_hash` 相同。`input_hash` 前缀与任务书 §2.2 一致。覆盖集含 `full_report_pack`、`chart_identity`、`timing_precision_contract`、`birth_provenance`、`rectification_evidence_contract`。`provenance:result_binding_scope` = passed。
|
||||
|
||||
墙钟中位数 **7.886 s**(本机 Windows / Anaconda 3.11)。任务书 Linux 基线约 2.6 s。同机改前单次约 7.5 s,绑定增量远低于 0.3 s 预算(任务书测 json.dumps+sha256 ≈ 0.1 s)。
|
||||
|
||||
## 验收数字
|
||||
|
||||
- `tests/test_calculation_profile_contract.py` + `tests/test_full_report_quality_gate.py`:全绿(3 skipped 为既有)
|
||||
- `tsc` / 前端:本单不改前端,未跑
|
||||
- `run_quality_gate.py --profile quick`:本机 Anaconda 缺 `mcp`,`interpretation_source_inventory_gate` 在导入 `mcp_server` 处失败。与本单无关。核心 `.py` 已 compile 通过。
|
||||
- `scripts/pre_work_check.py`:`focused_tests` 因本机无 `.workbuddy/skills/jyotish-vedic-astrology` 路径红一条;`remote_visibility` blocked(ERR-013)。未声称已云端同步。
|
||||
|
||||
## 环境缺口
|
||||
|
||||
- 无项目 `.venv`(根目录 `.venv` 是空文件);用 Anaconda 3.11.7 + pytest 9.1.1
|
||||
- 无 Chrome / 无报告页登录态:本单对用户不可感知,无真机清单
|
||||
@@ -136,7 +136,7 @@
|
||||
| — | `PROGRESS-report-progress-20260909.md` | 生成等待屏只有 spinner 与秒表:后端 `progressPercent` / `progressPhase` 与分章行已产出,前端解析后一字未渲染,且分章行在 `generating` 时根本不出服务端。改为按章分格进度条 + 章节清单,停滞 90 秒改「用时较长,仍在写」;不画百分比条、不做插值动画、不报预计剩余 | 已验收 | `848e39e6`、`5565b632`(BUG-601) |
|
||||
| `TASK-report-chart-render-20260909.md` | `PROGRESS-report-chart-render-20260909.md` | 报告页所有分盘标题下空白:引擎 22 张 `<svg>` 被 `skipHtml` 丢弃(09-06 Markdown 直渲回归)。引擎旁加 ```jyotish-chart 围栏 JSON,前端 zod 校验后用自绘北印式组件全部渲染;不放开原始 HTML | 已验收(2fdcb14f):tsc/lint 0 error、chart 测试 29/29、`/` Static、gzip +0.96%;围栏构造在 try 外的 P2 并入 `TASK-upstream-sync2-fix-20260909.md` 任务 3 | `codex/report-chart-render-20260909`(BUG-607) |
|
||||
| `TASK-report-chart-layout-fix-20260909.md` | `PROGRESS-report-chart-layout-fix-20260909.md` | 星盘渲染回归修复:22 张北印盘全部重叠(浮动 + 负 margin 凑两栏对连续多对无效)+ 滚动时 `components` 每渲染新建导致整篇报告卸载重建、页面卡;改 rehype 成组进既有两栏 grid、文章树 `useMemo`、目录状态下沉 | 待验收 | `87daffe2`(BUG-616/617);已 merge origin/staging `df090fd5` |
|
||||
| `TASK-report-provenance-binding-20260915.md` | `PROGRESS-report-provenance-binding-20260915.md` | 专业报告溯源绑定:`result_binding` 只绑到中间态包(实测 18/36 个顶层键、6.24 MB / 交付 10.04 MB),`full_report_pack`、`chart_identity`、`timing_precision_contract` 等全在覆盖外,而质量门只比自洽所以恒 passed(BUG-693);被哈希的载荷含墙钟 `ai_and_audit.summary.elapsed_seconds`,同一输入两次跑出不同 `result_hash`(BUG-694)。末尾按交付对象重绑 + 显式排除集写进回执 + 质量门补覆盖校验;上游 09-14 的有界投影实测收益 < 0.1 秒,不抄 | 待领取 | — |
|
||||
| `TASK-report-provenance-binding-20260915.md` | `PROGRESS-report-provenance-binding-20260915.md` | 专业报告溯源绑定:`result_binding` 只绑到中间态包(实测 18/36 个顶层键、6.24 MB / 交付 10.04 MB),`full_report_pack`、`chart_identity`、`timing_precision_contract` 等全在覆盖外,而质量门只比自洽所以恒 passed(BUG-693);被哈希的载荷含墙钟 `ai_and_audit.summary.elapsed_seconds`,同一输入两次跑出不同 `result_hash`(BUG-694)。末尾按交付对象重绑 + 显式排除集写进回执 + 质量门补覆盖校验;上游 09-14 的有界投影实测收益 < 0.1 秒,不抄 | 待验收 | `codex/report-provenance-binding-20260915` |
|
||||
|
||||
### 前端基础与工程
|
||||
|
||||
|
||||
Reference in New Issue
Block a user