fix(api): technique explorer bhava_chalit sample carries the birth moment (BUG-1077 acceptance)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
Jesse_Chen
2026-09-28 15:55:50 +08:00
co-authored by Claude Opus 5.5
parent 36fae8fabf
commit 4189750c6a
4 changed files with 22 additions and 1 deletions
+1
View File
@@ -7,6 +7,7 @@
- 本工作树无 `.venv`(主检出的 `.venv` 软链指向不存在的路径):Python 测试用系统 `python3`(pyswisseph 2.10.03)。基线即红的 10 条(`test_varga_vedastro_mode` 9 条、`test_ayanamsa_mode_ownership` 1 条)同名不变。
- Bhava / 行运真实引擎耗时与 429 频率未测;部署后看 `/api/bhava_chalit` 与带日期的 `/api/chart` 的 `chart_view_engine_failed` 日志。
- 未推送、未部署。
## TASK-chart-types-and-report-buttons T6/T7:真实 PostgreSQL 迁移测试、登录态真机待验(2026-09-28)
- 本机无 Docker:`npm run test:db` 未跑。T6 新增迁移 `20260928010000_profile_ayanamsa_six.sql`(只放宽 `profiles_ayanamsa_check`)与 `frontend/tests/database-profile-ayanamsa-six.test.ts`(本机 docker unavailable 跳过),结果以门禁 DB job 为准。替代证据:`ayanamsa-six-paths-20260928.test.ts` 的迁移源文本合同;24 条既有 DB / 部署套件失败名单与基线逐条一致。
+2
View File
@@ -14494,9 +14494,11 @@
- 修复:新模块 `scripts/bhava_chalit_mc.py` `resolve_bhava_mc_lon`:显式 `mc_lon` 优先;否则有出生时刻与地点就用 `swe.houses_ex(jd, lat, lon, b'R', FLG_SWIEPH | FLG_SIDEREAL)` 在请求岁差下取恒星黄道 MC(与报告链同一调用);再否则 sripati / porphyry 直接 400,不猜。不需要 MC 的宫制(equal / whole_sign / placidus / koch)行为不变。端点只改了既有一行的位置(净增 0 行,类方法数不变)。星盘页 Bhava 层另有一道防线:`mapBhava` 遇到宫制回退、缺 MC、或 MC 恰等于 `asc + 270` 一律返回 unavailable,不画等宫。
- 验证:`tests/test_api_server_security.py` 三条新测试先写先红(基线上「缺 MC 与出生时刻应 400」未抛出、「带出生时刻时跨度不全为 30」得到 `[30.0, 30.0, …]`),修后绿;MC 与独立的 `houses_ex` 调用差 < 1e-3°,同一调用的上升与引擎本命上升差 < 0.01°;equal 宫制无出生时刻仍可用。真实响应存为 `frontend/tests/fixtures/chart-view-bhava-golden.json`(星盘页 golden 的虚构盘:太阳、水星、土星换宫)。`frontend/tests/chart-bhava.test.tsx` 断言占位 MC 与宫制回退都不出盘。
- 防复发:任何取 Bhava 宫头的新调用方都经 `bhava_chalit_mc.resolve_bhava_mc_lon`,不得再给 MC 写几何默认值。
- 验收补丁(Claude 2026-09-28):修复后技法浏览器 `_technique_example_payloads` 里的 `/api/bhava_chalit` 样例只带星体与上升、无出生时刻,会被新规则拒为 400;样例改为 `{**base, **birth, …}`(改既有行,api_server 净增 0),新增 `test_technique_example_bhava_chalit_runs_with_a_real_mc`。
- 相关记录:BUG-320(Bhava 进换升表);`TASK-chart-types-and-report-buttons-20260928` T5。
- 复发自:无
- 修复版本:本地 `c35e0195`(未推送)。
## BUG-1078 | 我的报告:实心按钮标签继承正文色(浅色黑字深红底、深色浅字浅珊瑚底),禁用态半透明
- 状态:investigating(修复已在本地分支 `codex/ayanamsa-report-buttons-20260928` 提交,未推送、未部署;真机未走)
+1 -1
View File
@@ -10168,7 +10168,7 @@ class JyotishAPIHandler(BaseHTTPRequestHandler, VedastroEvidenceMixin, SynastryM
return {
'/api/ashtakavarga': base,
'/api/bhava_bala': base,
'/api/bhava_chalit': {**base, 'mode': 'compare', 'house_system': 'sripati'},
'/api/bhava_chalit': {**base, **birth, 'mode': 'compare', 'house_system': 'sripati'},
'/api/career': {'planets': SAMPLE_PLANETS, 'asc_sign': 'Aries'},
'/api/case_validation': {**base, 'current_md': 'Jupiter', 'predicted_events': ['事业巅峰', '关系发展'], 'transit_desc': 'Double Jupiter Saturn activation'},
'/api/dasha': {**base, **birth, 'dasha': 'vimshottari'},
+18
View File
@@ -3906,3 +3906,21 @@ def test_aspects_endpoint_returns_pair_summary() -> None:
assert result['success'] is True
assert result['result']['summary']['total_aspects'] >= 0
assert 'by_type' in result['result']['summary']
def test_technique_example_bhava_chalit_runs_with_a_real_mc():
"""BUG-1077 follow-up: the explorer's sample must carry the birth moment.
After the placeholder MC was removed, the old sample (planets + ascendant
only) made Sripati refuse with 400, so the technique explorer's
`/api/bhava_chalit` example broke. The sample now includes `birth`, and the
houses are the real Sripati spans rather than twelve 30-degree houses.
"""
handler = _handler()
result = handler._compute_technique_example({'endpoint': '/api/bhava_chalit'})
assert result['success'] is True
target = result['result']
assert target['selected_house_system'] == 'sripati'
spans = [row['span_degrees'] for row in target['result']['boundaries']['houses']]
assert len(spans) == 12
assert not all(abs(span - 30.0) < 1e-6 for span in spans)