feat(functional): adopt upstream BPHS ch.34 profile v2; fix Pancha Mahapurusha self-conjunction; yoga engine reads the same functional roles
Ported verbatim from the upstream skill repo (yinduzhanxing e9beae6b) with product authorization 2026-10-02: scripts/functional_benefics.py, scripts/pancha_mahapurusha.py, references/functional-role-profile.md; only the two functional-role methods of scripts/yoga_engine.py (our file diverged). v5 77-case rectification eval: 5 cells up (to +7.8pp), one cell -1.3pp (one case); product accepted. Rectification memoization golden still to be regenerated (scores change with the grouping). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f85794661b
commit
57782aea8a
@@ -1,5 +1,5 @@
|
||||
"""BUG-1158 partial (product decision 2026-10-02): yogakaraka needs a kendra among
|
||||
4/7/10 AND a trikona among 5/9; the benefic / malefic / neutral grouping is unchanged."""
|
||||
"""BUG-1158 (product decisions 2026-10-02): yogakaraka needs a kendra among 4/7/10
|
||||
AND a trikona among 5/9; grouping follows the upstream BPHS ch.34 profile v2."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -11,23 +11,37 @@ YOGAKARAKAS = {
|
||||
"Aries": [], "Taurus": ["Saturn"], "Gemini": [], "Cancer": ["Mars"], "Leo": ["Mars"], "Virgo": [],
|
||||
"Libra": ["Saturn"], "Scorpio": [], "Sagittarius": [], "Capricorn": ["Venus"], "Aquarius": ["Venus"], "Pisces": [],
|
||||
}
|
||||
# v1 grouping, unchanged by the narrow fix (lagna lords stay benefic).
|
||||
LAGNA_LORD_BENEFIC = {
|
||||
# 原值: 窄修后分组与 v1 相同,非日月命主一律留在 functional_benefics(test_lagna_lord_stays_benefic)
|
||||
# 新值: 分组改用上游 yinduzhanxing e9beae6b 的 bphs_ch34_general_with_sign_exceptions_v2:
|
||||
# BPHS 第 34 章明文点名的上升 / 星按 ROLE_OVERRIDES 定(白羊火星中性、金牛金星凶、天秤金星中性、
|
||||
# 天蝎火星中性、射手木星中性),12 宫主不再一律判凶;其余命主仍为吉
|
||||
# 原因: 产品 2026-10-02 决定改用上游版功能吉凶(以生时校正 77 例评测不降超过 1 个百分点为前提),
|
||||
# 见 references/functional-role-profile.md 与 BUG-1158
|
||||
from scripts.functional_benefics import ROLE_OVERRIDES # noqa: E402
|
||||
|
||||
LAGNA_LORDS = {
|
||||
"Aries": "Mars", "Taurus": "Venus", "Gemini": "Mercury", "Virgo": "Mercury", "Libra": "Venus",
|
||||
"Scorpio": "Mars", "Sagittarius": "Jupiter", "Capricorn": "Saturn", "Aquarius": "Saturn", "Pisces": "Jupiter",
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("sign", SIGNS)
|
||||
def test_yogakaraka_needs_kendra_4_7_10_and_trikona_5_9(sign: str) -> None:
|
||||
@pytest.mark.parametrize("sign", sorted(LAGNA_LORDS))
|
||||
def test_lagna_lord_role_follows_profile(sign: str) -> None:
|
||||
result = derive_functional_benefic_malefic(sign)
|
||||
assert result["yogakarakas"] == YOGAKARAKAS[sign]
|
||||
for planet in result["yogakarakas"]:
|
||||
houses = set(result["owned_houses"][planet])
|
||||
assert houses & {4, 7, 10} and houses & {5, 9}
|
||||
assert planet in result["functional_benefics"]
|
||||
lord = LAGNA_LORDS[sign]
|
||||
expected = ROLE_OVERRIDES.get(sign, {}).get(lord, "benefic")
|
||||
assert lord in result[f"functional_{expected}s"], (sign, lord, expected)
|
||||
assert result["profile"] == "bphs_ch34_general_with_sign_exceptions_v2"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("sign", sorted(LAGNA_LORD_BENEFIC))
|
||||
def test_lagna_lord_stays_benefic(sign: str) -> None:
|
||||
assert LAGNA_LORD_BENEFIC[sign] in derive_functional_benefic_malefic(sign)["functional_benefics"]
|
||||
@pytest.mark.parametrize("sign", SIGNS)
|
||||
def test_sign_overrides_win(sign: str) -> None:
|
||||
result = derive_functional_benefic_malefic(sign)
|
||||
for planet, role in ROLE_OVERRIDES.get(sign, {}).items():
|
||||
assert planet in result[f"functional_{role}s"], (sign, planet, role)
|
||||
|
||||
|
||||
def test_sole_twelfth_lord_is_not_automatically_malefic() -> None:
|
||||
# Virgo: the Sun owns only the 12th; Leo: the Moon owns only the 12th.
|
||||
assert "Sun" not in derive_functional_benefic_malefic("Virgo")["functional_malefics"]
|
||||
assert "Moon" not in derive_functional_benefic_malefic("Leo")["functional_malefics"]
|
||||
|
||||
Reference in New Issue
Block a user