fix(yoga): astrologer 11-25 review items 4–8 — Raja structure formed with modifiers, exchange recall by houses, actual vs illustrated diagrams (BUG-2392)
Owner approved the yoga_engine.py change for items 4, 5, 6 and 8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
+40
-2
@@ -349,7 +349,28 @@ def parivartana_class(house_a: int, house_b: int) -> Optional[str]:
|
||||
return 'maha'
|
||||
|
||||
|
||||
# BUG-2392 (占星师 2026-11-25 复核第五项; owner approved this frozen-file change): a kendra–trikona lord
|
||||
# Raja yoga whose structure is satisfied on the chart is formed (「成立」). Was: no reviewed contract,
|
||||
# so every hit stayed `candidate` (`source_definition_not_reviewed`). A lord that also rules the
|
||||
# 6th, 8th or 12th is a modifier written beside it (`formation_modifiers`), not a reason to withhold it.
|
||||
RAJA_STRUCTURAL_RULES = frozenset({
|
||||
'raja_yoga', 'raja_yoga_parivartana', 'dharma_karmadhipati', 'dharma_karmadhipati_parivartana',
|
||||
'raja_yoga_1_4', 'raja_yoga_5_9', 'raja_yoga_4_9', 'raja_yoga_mutual_aspect', 'raja_yoga_1_10',
|
||||
'raja_yoga_7_9', 'raja_yoga_5_10_lord',
|
||||
})
|
||||
RAJA_STRUCTURAL_PROFILE = 'kendra_trikona_lord_structure'
|
||||
|
||||
|
||||
def _product_formation_contract(rule_id: str) -> Optional[dict[str, Any]]:
|
||||
if rule_id in RAJA_STRUCTURAL_RULES:
|
||||
return {
|
||||
'profile': RAJA_STRUCTURAL_PROFILE, 'name': None,
|
||||
'source': {'title': 'BPHS', 'section': 'Raja yoga (kendra and trikona lords)'},
|
||||
# The rule's own executed definition is the definition (no second detector).
|
||||
'definition': None,
|
||||
'required': ['d1_scope', 'consistent_geometry', 'lord_structure'],
|
||||
'variant_boundary': '角宫主与三方宫主按本条规则结合;兼管第 6、8、12 宫的宫主写在修正里。',
|
||||
}
|
||||
for kind in PARIVARTANA_CLASSES:
|
||||
if rule_id == f'{kind}_parivartana_yoga':
|
||||
return {
|
||||
@@ -379,7 +400,8 @@ def _assess_product_contract(row: dict[str, Any], contract: dict[str, Any]) -> d
|
||||
missing = [key for key in required if key not in satisfied and key not in failed]
|
||||
issues = []
|
||||
if (row.get('formation_source_profile') != contract['profile'] or
|
||||
evidence.get('definition') != contract['definition']):
|
||||
(evidence.get('definition') != contract['definition'] if contract['definition'] is not None
|
||||
else not evidence.get('definition'))):
|
||||
issues.append('source_definition_mismatch')
|
||||
if len(by_id) != len(checks):
|
||||
issues.append('duplicate_condition_evidence')
|
||||
@@ -393,7 +415,7 @@ def _assess_product_contract(row: dict[str, Any], contract: dict[str, Any]) -> d
|
||||
formed = not issues and not missing and not failed
|
||||
return {
|
||||
'status': 'formed_under_source' if formed else 'conditions_not_met' if failed else 'candidate',
|
||||
'name': contract['name'], 'source_profile': contract['profile'], 'source': dict(contract['source']),
|
||||
'name': contract['name'] or row.get('name'), 'source_profile': contract['profile'], 'source': dict(contract['source']),
|
||||
'required_conditions': list(required), 'satisfied_conditions': satisfied,
|
||||
'missing_conditions': missing, 'failed_conditions': failed,
|
||||
'review_issues': issues, 'checks': checks, 'variant_boundary': contract['variant_boundary'],
|
||||
@@ -1892,6 +1914,22 @@ class YogaEngine:
|
||||
ctx.is_own_sign('Jupiter') or ctx.is_exalted('Jupiter') or
|
||||
SIGN_LORDS.get(sign) in FRIENDLY_PLANETS['Jupiter'],
|
||||
{'planet': 'Jupiter', 'sign': sign, 'friendship': 'natural'})
|
||||
elif contract.get('profile') == RAJA_STRUCTURAL_PROFILE:
|
||||
# BUG-2392: the bound lords and the houses each rules; any 6/8/12 lordship is a modifier.
|
||||
lordships = {p: [h for h in range(1, 13) if ctx.lord_of_house(h) == p] for p in planets_bound}
|
||||
royal = {p: [h for h in houses if h in (1, 4, 5, 7, 9, 10)] for p, houses in lordships.items()}
|
||||
check('lord_structure', None if len(planets_bound) < 2 else
|
||||
len(set(planets_bound)) >= 2 and all(royal.values()),
|
||||
{'lordships': lordships} if len(planets_bound) >= 2 else None)
|
||||
modifiers = [{'planet': p, 'houses': [h for h in houses if h in (6, 8, 12)]}
|
||||
for p, houses in lordships.items() if any(h in (6, 8, 12) for h in houses)]
|
||||
if modifiers:
|
||||
entry['formation_modifiers'] = modifiers
|
||||
entry['formation_note_zh'] = '实际作用有利有弊:' + ','.join(
|
||||
f"{PLANET_ZH.get(m['planet'], m['planet'])}同时管第 {'、'.join(map(str, m['houses']))} 宫"
|
||||
for m in modifiers) + '。'
|
||||
entry['formation_note_en'] = 'Mixed in effect: ' + '; '.join(
|
||||
f"{m['planet']} also rules house {', '.join(map(str, m['houses']))}" for m in modifiers) + '.'
|
||||
elif contract.get('profile') == 'phaladeepika_6_parivartana_houses':
|
||||
# BUG-2388: the two lords sit in each other's signs, and the two houses decide the kind.
|
||||
pair = [p for p in planets_bound if p in SIGN_LORDS.values()][:2]
|
||||
|
||||
Reference in New Issue
Block a user