fix(rectification): honor declared birth-time uncertainty and split windows over two hours (BUG-571–573)

Intake stores how sure the user is; rectification now searches that range, offers a one-click widen when event fit is low at the edge, and trisects windows longer than two hours before the minute grid.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-07 12:18:50 +08:00
co-authored by Cursor
parent b2a8d3a005
commit 8e31680b45
49 changed files with 3047 additions and 142 deletions
@@ -0,0 +1,56 @@
# PROGRESS · 出生时间「有多确定」只问一次(2026-09-07)
工作树:`.worktrees/rectification-declared-uncertainty-20260907`
分支:`codex/rectification-declared-uncertainty-20260907`(跟踪 `origin/staging`
基线:任务书落地 commit `ad9283d1`(含 BUG-565570);合入前 rebase 到当时 `origin/staging`(含 BUG-574 `b2a8d3a0`)。
未改 `SKILL.md`(仍 10.0.14)、未改采用门 / 确认门 / `MIN_SEPARATION_LEAD` / 分钟级 `_relative_support`、未改 `page.tsx`、未改 `jyotish_api_server.py`、未改 `contracts/probe-question-v1.json`。迁移文件为 `20260907020000_rectification_declared_uncertainty.sql``20260907010000` 已被 `personal_report_card_summary` 占用)。
本单状态:**待验收**。BUG-571 / 572 / 573 已实现。
| 任务 | 状态 | BUG |
| --- | --- | --- |
| D1 intake 三档 + ±120 | 完成 | — |
| D2 校正窗口读档案 | 完成 | BUG-571 |
| D5 子段扫描 | 完成 | BUG-573 |
| D3 放宽窗口一键卡 | 完成 | BUG-572 |
| D6 日级可靠度 + 手测脚本 | 完成 | — |
| D4 记录 | 完成 | 本文件 / BUG_HISTORY / CHANGELOG / DESIGN / VOICE / testing |
## 实现要点
- 窗口阶段看 **exclusive span**04:0006:00 = 120 → minute03:0007:00 = 240 → block_scan)。放宽上限看 **inclusive width ≤ 241**
- 子段是当前窗三等分、无共享分钟。unknown 仍先扫五个声明时段(步长 10),赢段再切三段。
- 放宽卡优先级高于区分卡。`hospital_record` 答 A 只改窗口。
- 日级可靠度只在**本回合刚写入**的 day 事件上问(`source_turn_id === askedTurnId`),不拦采用门、不改历史账本上的旧日事件采集顺序。
### 书面偏差
| 项 | 任务书 | 实际 | 原因 |
| --- | --- | --- | --- |
| D6 写回 | 「用现有证据修订链,不新造 RPC」 | 薄 RPC `set_agentic_rectification_evidence_date_reliability`(原地 high/medium | revise/supersede 会新开证据行、改指纹,误伤训练门 |
| 放宽 D 文案 | 「说不好」 | 「说不好 / 先这样」 | `clippedCopy` 最短 4 字 |
| `block_scan` 全零均分 | 五段各 20% | 100/n(三段 33.3/33.3/33.4 | 自定义 blocks 时写死 20 只给到 60 |
| 迁移时间戳 | `20260907010000_...` | `20260907020000_...` | staging 已占用 `20260907010000_personal_report_card_summary.sql` |
### 既有断言改动
| 文件 | 原值 | 新值 | 原因 |
| --- | --- | --- | --- |
| `rectification-v9-case-service` 04:4505:15 | 有钟点一律 | 仅 `family_exact` / 医院记录;approximate 另写 | BUG-571 |
| `database-rectification-block-scan` 08:0011:59 | 选定后 `minute` | 选定后仍 `block_scan` | span 239>120 |
| `rectification-block-scan` 选下午 | 进分钟 | 仍 `block_scan` | 12:0017:59 span 359 |
| `birth-time-intake` `/前后两小时/` | 扫组件源码 | 扫 `approximateUncertaintyOptions` | 文案在 model |
## 测试
| 命令 | 结果 |
| --- | --- |
| 非 DB `rectification-*` + `consultation-*` + `report-*` + `personal-report-*` + `birth-time-*` + `account-api` + `agent-voice-copy-contract` | **1913 pass / 0 fail**(≥ 1521 |
| `.venv/bin/python -m pytest tests/test_rectification_v5_services.py -k 'not seven_events'` | **33 pass / 0 fail**(含自定义三段 100 与 33.3/33.3/33.4 |
| `test_block_scan_seven_events_finishes_within_fifteen_seconds` | 本机连跑偶发超 15s,与 BUG-570 同一 P2,未改断言 |
| `npx tsc --noEmit` | 0 错 |
| `./node_modules/.bin/eslint --quiet src tests` | 0 error |
| `frontend npm run test:db` | **37 pass / 0 fail**547.7s;含 `database-rectification-block-scan`08:0011:59 选定后仍 `block_scan`08:0009:00 进 `minute`,widen 扩大成功 / 缩小失败 / service_role-only |
排除 `*-database.test.ts` 于非 DB 套件。ERR-011Python 用 `.venv/bin/python -m pytest`。未改 `page.tsx`。未改分钟级 `_relative_support`。无 Docker 缺口,未写 `BLOCKED.md`
+1 -1
View File
@@ -67,7 +67,7 @@
| `TASK-rectification-range-reading-20260906.md` | `PROGRESS-rectification-range-reading-20260906.md` | 可信区间成为一等公民:采用时落库 `adopted_credible_range`,报告 `read_report_candidate_range` 与聊天 `verified_chart(accepted)` 都改读它并接同一份 `birth_time_sensitivity`(现在报告读的是开工窗口,BUG-568);引擎 >15 分钟只取 3 样本改为 ≤31 逐分钟;采用旁白加「稳定 / 随分钟变」两句;`declared_birth_window` 复用 | 已验收通过(test:db 37/0 为执行方数字,本机无 Docker) | `814c924e`(BUG-568);两条迁移待应用 |
| `TASK-rectification-unknown-time-20260906.md` | `PROGRESS-rectification-unknown-time-20260906.md` | 完全不知道出生时间的两段式路线:`stage=block_scan` 以 10 分钟步长扫 24 小时只做事件计分、出五时段四选卡(不写账本不采用),选定后进现有分钟流程;引擎加 `minute_step`;开场读 `birth_time_clue`;删 intake 劝退文案 | 已验收(带修复单:时段支持度按段长偏置,下午段先天 25%,P1) | `814c924e`;修复单 `TASK-rectification-capability-fix-20260907.md`BUG-570 |
| `TASK-rectification-capability-fix-20260907.md` | `PROGRESS-rectification-capability-fix-20260907.md` | 能力补齐修复单:答后旁白把 `range_start/range_end`(搜索窗口)当范围比较,每题都说「范围没变」;`block_scan` 五段支持度按段内原始分求和,长时段先天占优(24/24/36/30/30 个候选);`TRACK_LABEL` 音译与产品 Vimshottari/Narayana 口径不一;BLK-001 写到 `docs/BLOCKED.md` 应回根目录 | 已验收通过(P2block_scan 15 s 壁钟断言在门禁里可能间歇红) | `517df002`BUG-569570);staging 未部署,需先 Migrate Staging Database |
| `TASK-rectification-declared-uncertainty-20260907.md` | `PROGRESS-rectification-declared-uncertainty-20260907.md` | 出生时间「有多确定」只在 intake 问一次:三档(医院记录 / 家人大概 ±15·30·60·120 / 时段或未知),校正窗口读档案(现在有钟点一律 ±15,声明值被忽略,BUG-571);吻合率 <60% 且代表分钟贴窗口边缘时出服务端一键放宽卡,放宽后重算并写回档案(BUG-572);窗口 >120 分钟先切三子段迭代到 ≤120 再进分钟(BUG-573);日级事件问一次可靠度;四个脚本化手测场景进 docs/testing | 待领取 | `codex/rectification-declared-uncertainty-20260907` |
| `TASK-rectification-declared-uncertainty-20260907.md` | `PROGRESS-rectification-declared-uncertainty-20260907.md` | 出生时间「有多确定」只在 intake 问一次:三档(医院记录 / 家人大概 ±15·30·60·120 / 时段或未知),校正窗口读档案(现在有钟点一律 ±15,声明值被忽略,BUG-571);吻合率 <60% 且代表分钟贴窗口边缘时出服务端一键放宽卡,放宽后重算并写回档案(BUG-572);窗口 >120 分钟先切三子段迭代到 ≤120 再进分钟(BUG-573);日级事件问一次可靠度;四个脚本化手测场景进 docs/testing | 待验收 | `codex/rectification-declared-uncertainty-20260907` |
| `TASK-api-not-configured-mislabel-20260904.md` | `PROGRESS-api-not-configured-mislabel-20260904.md` | 16 处路由把数据库瞬断(部署切换窗口)兜底翻译成 503「服务尚未配置」;改为仅配置错误用该文案,其余 `service_unavailable`,收敛为共享 helper | 已验收 | `5483649b`(BUG-542);2 条子进程测试留 CI Node 22 复核 |
| `TASK-rectification-ux-20260902.md` | `PROGRESS-rectification-ux-20260903.md` | 会话面空白假死与交互摩擦 | 已验收 | `d159f08e`(09-03 在新基线重做后合入,BUG-505509 |