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>
3.5 KiB
PROGRESS · consultation_workflow 全量 500(出生时间敏感度 float 崩溃)(2026-09-04)
工作树:/Users/jesse/Downloads/Copse/astrology/.worktrees/report-sensitivity-crash-20260904
分支:codex/report-sensitivity-crash-20260904
基线:任务书写 285c5722;开工 git fetch 后 origin/staging HEAD 为 45e00f46(含本任务书)。
任务书:仓库根 TASK-report-sensitivity-crash-20260904.md
未改 _high_rigor_birth_payload 的 float 口径,未改前端 worker,未改 .gitea/workflows/**,不提升 main。
| 任务 | 状态 | BUG |
|---|---|---|
| 1 类型修复 + 降级加固 + 回归测试 | 完成 | BUG-524 |
| 2 staging 部署后真实 personal_full | 待部署 | BUG-524 |
| 3 聊天路径回归确认 | 待部署 | BUG-524 |
开工复现
.venv/bin/python -m pytest tests/test_consultation_workflow_birth_time_sensitivity.py -q --tb=short 修复前:
.FFFFFF.F
TypeError: 'float' object cannot be interpreted as an integer
栈与任务书一致:execute_consultation_workflow → _build_birth_time_sensitivity → _birth_datetime_from_args。payload 仍把 hour/minute 解析为 float(该用例本身通过)。不带敏感度字段的聊天形状因默认 confirmed 早退,修复前也能过。
实现要点
_birth_datetime_from_args:datetime(int(year), int(month), int(day), int(hour), int(minute), _arg_second(args))。execute_consultation_workflow:敏感度构建的ValueError不再升成打死端点的BadRequest;其余异常降级为:
schema=jyotish.report_birth_time_sensitivity.v1
status=not_applicable
availability=not_available
blocked=true
reason=birth_time_sensitivity_unavailable
status 留在前端已有 Zod 枚举(not_applicable / candidate_window_only)内,避免降级对象被 consultationWorkflowResponseSchema 打成 workflow_contract_invalid。真正的缺字段/非法主题仍由 _high_rigor_birth_payload 等抛 BadRequest。
本地 HTTP 对照(虚构 1993-06-15 10:30)
引擎 .venv/bin/python scripts/jyotish_api_server.py --port 5200,swisseph_available=true。
| 请求 | HTTP | success | sensitivity.status |
|---|---|---|---|
| career / marriage / wealth / timing / health(provisional + representative_time 10:30) | 200 | true | candidate_window_only |
| 不带敏感度字段(聊天形状) | 200 | true | not_applicable |
五份主题响应喂给 buildReportEvidenceBundleV2:claimCards = career / health_pressure / marriage / timing / wealth(5 张),blockedSections 空。
测试
.venv/bin/python -m pytest tests/test_consultation_workflow_birth_time_sensitivity.py tests/test_flexible_birth_time_engine.py tests/test_consultation_workflow_domains.py -q
............................................................
9 条新回归 + 既有 flexible/domains 全部通过。
质量门(staging 现行:--profile quick --skip-yoga-logic --skip-frontend-runtime):
585 passed, 1 skipped, 201 warnings in 436.00s (0:07:15)
Quality gate passed.
elapsed_ms: 751689
该次 pytest argv 尚未包含新文件(CORE 钉是门跑完后补上的)。随后把 tests/test_consultation_workflow_birth_time_sensitivity.py 列入 CORE_PYTEST_TARGETS,并加 test_quality_gate_runs_this_file。补钉后:
.venv/bin/python -m pytest tests/test_consultation_workflow_birth_time_sensitivity.py -q
.......... [100%]
10 passed。