fix(report): bind professional report hash to the delivered packet (BUG-693, BUG-694)
Independent Staging Quality Gate / validate (push) Successful in 9m45s
Independent Staging Quality Gate / publish (push) Successful in 2m14s

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:
jesse-ux
2026-09-15 10:09:26 +08:00
parent 039b0a2608
commit 1d2aeffaef
8 changed files with 403 additions and 32 deletions
@@ -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` blockedERR-013)。未声称已云端同步。
## 环境缺口
- 无项目 `.venv`(根目录 `.venv` 是空文件);用 Anaconda 3.11.7 + pytest 9.1.1
- 无 Chrome / 无报告页登录态:本单对用户不可感知,无真机清单
+1 -1
View File
@@ -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` |
### 前端基础与工程