打回:consultation-route-service 两条既有测试对 toolInput 做 deepStrictEqual,绑定盘多出 node_mode / position_mode 后失败(staging 17/17,本分支 15/17)。 - 两处期望值补 node_mode: "mean" / position_mode: "apparent",写三栏注释,不删断言 - 该文件改后 17/17 通过 - 前端全量与 origin/staging 对比:两次都是 3582 测试 / 29 失败,失败名单逐条相同(差集为空) - Claude 放在本分支的 tests/test_explicit_calculation_modes_acceptance_bug1828.py 保留未改, 与另外两个测试一起跑 21 过 / 0 败 - tsc 0 错 Co-Authored-By: Grok (agent loop)
7.4 KiB
PROGRESS · 本命计算显式传入交点与位置口径(#185,BUG-1828,2026-11-09)
- 分支:
codex/explicit-profile-20261109(基线afac4ea9) - 任务书:
docs/tasks/TASK-explicit-profile-20261109.md - Bug:
docs/BUG_HISTORY.md末尾追加 BUG-1828
做了什么
后端(scripts/jyotish_api_server.py)
| 位置 | 改动 |
|---|---|
紧挨 _request_node_mode |
新增模块级 _request_calculation_modes(body):常量从 ondemand_calc.contract 取,两个字段都给 → caller_supplied,任一缺省 → 产品默认值 + product_default_explicit;node_mode 非 mean/true → 400;position_mode 非 apparent/mean → 400;为 mean → 400,消息含 position_mode_unsupported |
_request_node_mode |
行为不变(其他未纳入本单的调用方还在用) |
_build_api_chart_cache_payload |
calculation 加 position_mode;cache_schema_version 8 → 9(三栏注释) |
_high_rigor_birth_payload、_compute_full_reading_for_thematic、_compute_chart_sync(三处) |
隐式 body.get(..., 'mean') 改为 _request_calculation_modes(body)['node_mode'];主题报告不再把非法值静默改成 mean(改 400) |
execute_consultation_workflow |
两条返回路径都加 calculation_profile: {ayanamsa, node_mode, position_mode, profile_source} |
前端
| 文件 | 改动 |
|---|---|
frontend/src/lib/calculation-modes.ts(新) |
NODE_MODE_VALUES / POSITION_MODE_VALUES / 两个产品默认值,头注释写明与 scripts/ondemand_calc/contract.py 同值 |
consultation-workflow.ts |
consultationInputSchema 加 node_mode / position_mode(.default());loadOtherVersionCharts 的地点参数一并带出 |
consultation-route-service.ts |
ServerChartToolInput 加两个必填字段;绑定盘与申报时段两处组装都显式填产品默认值 |
chart-choice-both-versions.ts |
BirthPlace 加两个可选字段,有就带进请求体 |
consult-packet-warm.ts |
预热请求体带同样的两个口径(同一份常量),保证预热与正式请求的后端缓存键一致 |
consultation-agent-events.ts |
agentExecutionReceiptSchema 加可选 calculationProfile(.strict());旧回执不带也能通过 |
app/api/consult/route.ts |
回执组装处加 calculationProfile,取本轮绑定盘 toolInput 的两个口径;没有绑定盘的路径不加 |
自测
| 命令 | 结果 |
|---|---|
pytest tests/test_explicit_calculation_modes_bug1828.py |
11 过 / 0 败 |
连同 test_api_server_growth_contract.py、test_ondemand_calc_contract_20261109.py |
27 过 / 0 败 |
node --test tests/explicit-calculation-modes-1828.test.ts |
5 过 / 0 败 |
tests/consultation-workflow-request.test.ts |
3 过 |
tests/consultation-agentic-runtime.test.ts |
87 过 |
tests/consult-answer-basis-receipt-20261108.test.tsx |
4 过 |
tests/consult-audit-table-backstop-20261108.test.ts |
7 过 |
tests/consult-packet-warm-20261009.test.ts |
3 过 |
tsc --noEmit -p frontend |
0 错 |
npm run lint |
0 error |
偏离与说明
- 额外改了三个任务书没列的文件(都是类型/请求形状必须同步的地方,行为不变):
frontend/src/lib/personal-report-route-core.ts、frontend/src/lib/personal-report-worker.ts:ServerChartToolInput与consultationInputSchema变必填后,这两处构造ConsultationInput的地方编译不过,所以显式补上两个口径(用同一份常量)。若任务书要严格限定文件,请指回,我改成用z.input<>标注。frontend/tests/consultation-agentic-runtime.test.ts、frontend/tests/consultation-workflow-request.test.ts:既有 fixture 的toolInput/ConsultationInput字面量补两个字段(没有删任何断言)。
declared_window_chart没改(任务书列在范围外):我一度误替换,已按原文恢复原样,并在 PROGRESS 里列为后续单。position_mode = mean:任何入口都返回 400,不偷偷按 apparent 算。
jyotish_api_server.py 里仍然隐式默认 mean 的位置(留给后续单)
| 行 | 函数 | 写法 |
|---|---|---|
| 3065 | _attach_vedastro_main_entry_overview_from |
birth_payload.get('node_mode') or ... or 'mean' |
| 3704 | _compute_vedastro_range_scan |
body.get('node_policy') or body.get('node_mode') or 'mean' |
| 4489 | _run_high_rigor_historical_backtest |
birth_payload.get('node_mode', 'mean') |
| 6521 | _fallback_chart |
'node_mode': 'mean' |
| 6579 | _build_chart_prompt_pack |
birth.get('node_mode') or 'mean' |
| 8042 | _compute_declared_window_chart |
body.get('node_mode', body.get('nodeMode', 'mean')) |
位置口径在上面这些位置完全没有出现;等后续单把它们也改成显式口径时,cache_schema_version 需要再升一版。
第 1 次打回(FIX-explicit-profile-1,2026-11-09)
问题一:两条既有测试失败。 frontend/tests/consultation-route-service.test.ts 里
「route service loads complete server truth before billing…」与「global normalized places use
their exact coordinates and historical offset」对 toolInput 做 deepStrictEqual,绑定盘多了
node_mode / position_mode 之后就失败(staging 17/17,本分支 15/17)。
改法:两处期望值补上 node_mode: "mean"、position_mode: "apparent",按「原值 / 新值 / 原因」
写了三栏注释(原因:BUG-1828:绑定盘显式带交点 / 位置口径),没有删任何断言。
改后该文件 17/17 通过。
问题二:验收第 3、4 条没有写进测试。 Claude 已把 tests/test_explicit_calculation_modes_acceptance_bug1828.py
写好放在本分支,保留未改;本轮与 test_explicit_calculation_modes_bug1828.py、
test_api_server_growth_contract.py 一起跑:21 过 / 0 败。
前端全量(npm test)对照
同一天同一台机器上分别跑本分支与 origin/staging,两次都是 3582 个测试 / 29 失败,
失败名单逐条相同(差集为空):
| 侧 | 测试数 | 失败 |
|---|---|---|
| 本分支 | 3582 | 29 |
| origin/staging | 3582 | 29 |
| 只在分支上失败 | — | 0 |
| 只在 staging 上失败 | — | 0 |
29 条全部是本机环境缺口(Postgres / Docker / 部署脚本 / 备份与 RLS / 模型凭据),与本次改动无关:
database env validator*、staging env validator*、production env validators*、deployment scripts pass shell syntax validation、
changed staging workflows are syntactically valid YAML、first immutable deployment rolls back…、live staging sync*、
staging backups are encrypted…、same-second backups…、rejects *backup*、refuses full disks…、creates every absent backup path…、
find enumeration failures…、bounded npm install…、personal report job migration…、personal report sections enforce owner-read RLS…、
immutable Skill migration…、importing the registry creates no runtime directory、a used runtime root is removed when the process exits、
is-docs-only-range.sh…、staging model provider env preparation…、operation-level admin email reauthentication…、
appendix Python and TS share byte-identical golden…、a lookup does not reset the answer clock…(后两条在单独跑时都通过,属并行下的时钟/环境 flake,staging 同样出现)。
tsc --noEmit -p frontend:0 错。