fix(api): keep consultation_workflow alive when API hours are floats
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled

API birth payloads store hour/minute as floats, and datetime() rejected them
after sensitivity was wired into every consultation_workflow call.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-04 16:24:56 +08:00
co-authored by Cursor
parent 7cab9043fc
commit c140191357
7 changed files with 307 additions and 3 deletions
+16
View File
@@ -8081,3 +8081,19 @@
- 相关记录:BUG-522
- 复发自:BUG-522
- 修复版本:待发布
## BUG-524 | consultation_workflow 在 float 时辰上崩溃,全量 HTTP 500
- 状态:resolved
- 首次发现:2026-09-04
- 最近更新:2026-09-04
- 影响面:`POST /api/consultation_workflow``execute_consultation_workflow``_build_birth_time_sensitivity``_birth_datetime_from_args`;报告 worker 与聊天深度咨询共用该端点
- 用户现象:staging 上 standard personal_full 生成失败,`failureCode = calculation_unavailable`。同一端点对 provisional 出生时间返回 HTTP 500。
- 触发条件:API 出生 payload 的 `hour`/`minute` 为 float`_high_rigor_birth_payload` 的既有口径),且 `birth_time_accuracy``provisional``approximate`,因而会走到 `_birth_datetime_from_args`
- 根因:上游同步把 `_build_birth_time_sensitivity` 无条件接入 consultation_workflow。CLI argparse 的 hour/minute 是 intAPI 路径是 float。`datetime()` 不能接受 float,抛 `TypeError`。异常只被 `except ValueError` 包住,于是冒成 500。
- 修复:`_birth_datetime_from_args` 对年月日时分做 `int()` 规范化,不改变 API float 口径。敏感度构建失败时写入 blocked/`not_available` 状态对象并继续 workflow,不再打死整个端点。
- 验证:`tests/test_consultation_workflow_birth_time_sensitivity.py`(已列入 `CORE_PYTEST_TARGETS`);本地 HTTP 对 career/marriage/wealth/timing/health 与不带敏感度字段的聊天形状均为 200/`success=true`;五份响应喂给 `buildReportEvidenceBundleV2` 得到 5 张 claim card、`blockedSections` 为空。staging quick 门 `585 passed, 1 skipped`
- 防复发:float hour/minute 的 API body 必须能走 `execute_consultation_workflow` 且不 500;敏感度层失败必须降级,不得再变成未捕获 `TypeError`。不得把 `_high_rigor_birth_payload` 的 hour/minute 改成 int。
- 相关记录:无
- 复发自:无
- 修复版本:待发布