diff --git a/scripts/yoga_engine.py b/scripts/yoga_engine.py index 939e015a..7fe6e2fd 100644 --- a/scripts/yoga_engine.py +++ b/scripts/yoga_engine.py @@ -744,6 +744,21 @@ class YogaEngine: "effects_en": list(rule.get("effects_en") or rule.get("effects", [])), "strength_en": rule.get("strength_en") if strength == rule.get("strength") and rule.get("strength_en") else STRENGTH_EN.get(str(strength), str(strength)), } + # Budha-Aditya is a conjunction witness, but a combust + # Mercury must not be presented as an unqualified full yoga + # (upstream yinduzhanxing 994638f0; sync5 U7). + if rule.get('id') == 'budhaditya_yoga': + mercury = ctx.planets.get('Mercury') or {} + if mercury.get('combust') is True: + entry['condition_status'] = 'combustion_requires_review' + entry['traditional_effects'] = entry['effects'] + entry['effects'] = [] + entry['strength'] = 'conditional' + entry['combustion_witness'] = { + 'planet': 'Mercury', + 'combust': True, + 'claim_boundary': 'Do not treat Budha-Aditya as an unqualified benefic result while Mercury is combust.' + } dedup_key = rule.get("dedup_key") or rule["name"] dedup_val = f"{dedup_key}:{m.get('combination', '')}" if dedup_val in seen_dedup: diff --git a/tests/test_budhaditya_combustion_gate.py b/tests/test_budhaditya_combustion_gate.py new file mode 100644 index 00000000..edf943c8 --- /dev/null +++ b/tests/test_budhaditya_combustion_gate.py @@ -0,0 +1,29 @@ +from scripts.yoga_engine import YogaEngine + + +def test_budhaditya_with_combust_mercury_is_conditional(): + engine = YogaEngine('references/yoga_rules.json') + planets = { + 'Sun': {'sign': 'Aries', 'house': 1}, + 'Mercury': {'sign': 'Aries', 'house': 1, 'combust': True}, + } + rows = [row for row in engine.detect(planets, 'Aries') if row['rule_id'] == 'budhaditya_yoga'] + assert len(rows) == 1 + row = rows[0] + assert row['condition_status'] == 'combustion_requires_review' + assert row['effects'] == [] + assert row['traditional_effects'] + assert row['strength'] == 'conditional' + assert row['combustion_witness']['planet'] == 'Mercury' + + +def test_budhaditya_without_combustion_keeps_traditional_effects(): + engine = YogaEngine('references/yoga_rules.json') + planets = { + 'Sun': {'sign': 'Aries', 'house': 1}, + 'Mercury': {'sign': 'Aries', 'house': 1, 'combust': False}, + } + rows = [row for row in engine.detect(planets, 'Aries') if row['rule_id'] == 'budhaditya_yoga'] + assert len(rows) == 1 + assert rows[0]['effects'] + assert 'combustion_witness' not in rows[0]