fix(yogas): lunar and solar yogas count only the five true planets; retire duplicate rules (upstream 2dd6062a)

bvr_002..004 (Sunaphaa/Anaphaa/Duradhara) and bvr_016..018 (Vesi/Vosi/
Ubhayachara) take upstream yinduzhanxing 2dd6062a's logic (Mars..Saturn
only). kemadruma_yoga also ignores the nodes (product decision: classical
definition; upstream still counts them). The six lunar/solar duplicates of
upstream's RETIRED_RULE_IDS are retired; upstream's four other retirements
are out of scope. TASK-upstream-sync4-20261002 T5.

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:
Jesse_Chen
2026-10-02 13:53:02 +08:00
co-authored by Claude Opus 5.5
parent 42d1582f4c
commit f3ed950982
4 changed files with 180 additions and 38 deletions
+11 -1
View File
@@ -694,6 +694,15 @@ def _run_custom_expr(expr, exec_globals):
# ============================================================================
# YogaEngine: 规则加载与检测
# ============================================================================
# Lunar / solar duplicates of the BVR precise rules (bvr_002..004, bvr_016..018),
# retired so a chart is not judged twice by two definitions (sync4 T5; same
# six ids as upstream yinduzhanxing 2dd6062a RETIRED_RULE_IDS; upstream's other
# four retirements are outside this task's scope and not taken).
RETIRED_RULE_IDS = frozenset({
'voshi_yoga', 'veshi_yoga', 'ubhayachari_yoga', 'anapha_yoga',
'sunapha_yoga', 'durudhura_yoga',
})
class YogaEngine:
"""Yoga 检测引擎。从 JSON 加载规则,对星盘执行条件匹配。"""
@@ -701,7 +710,8 @@ class YogaEngine:
with open(rules_path, 'r', encoding='utf-8') as f:
data = json.load(f)
self.schema_version = data.get("schema_version", "1.0")
self.rules = [r for r in data.get("rules", []) if r.get("enabled", True)]
self.rules = [r for r in data.get("rules", []) if r.get("enabled", True)
and r.get("id") not in RETIRED_RULE_IDS]
def detect(self, planets: Dict[str, Dict], ascendant: str, context: Optional[Dict] = None) -> List[Dict]:
"""