fix(report): one canonical Mars marriage screen; short debilitation cells by verified state; natal Saham steps shown; PD by declared range, full dispositor chains, topic varga routes (BUG-2154, BUG-2155, BUG-2156, BUG-2157)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
This commit is contained in:
2026-11-22 12:03:46 +08:00
co-authored by Claude Opus 5.5
parent 9206f23c3e
commit c1957e3164
26 changed files with 1807 additions and 191 deletions
+22 -8
View File
@@ -35,13 +35,13 @@ try: # scripts/ on sys.path
from report_render.english_gaps import english_effects, first_clean_english
from report_render.karaka_domains import KARAKA_DOMAIN_EN
from report_render.reader_keys import aspect_type_en, reader_key, reader_point_name, yoga_category_name
from report_render.neecha_witness import neecha_bhanga_dignity_cell
from report_render.neecha_witness import neecha_bhanga_dignity_cell, neecha_states, neecha_table_notes
except ImportError: # pragma: no cover - package import
from scripts.report_render.audit_chapters import STATUS
from scripts.report_render.english_gaps import english_effects, first_clean_english
from scripts.report_render.karaka_domains import KARAKA_DOMAIN_EN
from scripts.report_render.reader_keys import aspect_type_en, reader_key, reader_point_name, yoga_category_name
from scripts.report_render.neecha_witness import neecha_bhanga_dignity_cell
from scripts.report_render.neecha_witness import neecha_bhanga_dignity_cell, neecha_states, neecha_table_notes
import re
from datetime import datetime
@@ -118,7 +118,7 @@ def _pl9_english_report_title(packet: dict) -> str:
return f"{name}'s Vedic Astrology Chart Report" if name else "Vedic Astrology Chart Report"
def _dignity_label(value, language: str = 'zh') -> str:
def _dignity_label(value, language: str = 'zh', planet=None, states=None, footnote=True) -> str:
"""Engine dignity labels are bilingual (``入旺(Exalted)``); the reader shows one name.
The glossary pass would otherwise translate the English half too and print
@@ -127,7 +127,9 @@ def _dignity_label(value, language: str = 'zh') -> str:
"""
text = str(value or '').strip()
# BUG-2105: the Neecha Bhanga status keeps the original dignity, with the cancellation as a clause.
if (cancelled := neecha_bhanga_dignity_cell(text, language)) is not None:
# BUG-2155: the clause is the short state (落陷;另有缓解条件¹ / 落陷;缓解条件待核); with `planet`
# and `states` a plain 落陷 that is a candidate says so too. The table prints neecha_table_notes.
if (cancelled := neecha_bhanga_dignity_cell(text, language, planet, states, footnote=footnote)) is not None:
return cancelled
match = re.fullmatch(r'([^()()]+?)\s*[((]([A-Za-z][A-Za-z \-]*)[))]', text)
if not match:
@@ -1593,15 +1595,21 @@ def render_pl9_parity_markdown(packet: dict) -> str:
f"| {_cell(asc_label)} | {_cell(_token(info['sign_lord']))} | {_cell(_token(info['nakshatra_lord']))} | "
f"{asc_not_applicable} | - | {_cell('/')} | {asc_not_applicable} |"
)
_neecha = neecha_states(packet)
_status_seen = {}
for planet in ('Sun', 'Moon', 'Mars', 'Mercury', 'Jupiter', 'Venus', 'Saturn', 'Rahu', 'Ketu'):
row = _dict(planets.get(planet))
if not row:
continue
_status_seen[planet] = row.get('status')
lines.append(
f"| {_cell(_token(planet))} | {_cell(_token(row.get('rasi_lord')))} | "
f"{_cell(_token(row.get('nakshatra_lord')))} | {_cell(_token(row.get('sub_lord')))} | "
f"{_cell(_token(row.get('sub_sub_lord')))} | {_cell(_dignity_label(row.get('status'), _lang))} | {_cell(_num(row.get('sb'), 2))} |"
f"{_cell(_token(row.get('sub_sub_lord')))} | {_cell(_dignity_label(row.get('status'), _lang, planet, _neecha))} | {_cell(_num(row.get('sb'), 2))} |"
)
_notes = neecha_table_notes(list(_status_seen), _status_seen, _neecha, _lang)
if _notes:
lines.extend(['', *_notes])
lines.extend([
'',
*(
@@ -3902,6 +3910,8 @@ def render_pl9_parity_markdown(packet: dict) -> str:
for pd in _list(ad.get('pratyantar_dasha_timeline')):
if isinstance(pd, dict) and pd.get('is_current') and pd.get('lord'):
active_lords.add(str(pd.get('lord')))
_neecha = neecha_states(packet)
_lord_status = {}
for index in range(1, 13):
house = _dict(d1_houses.get(f'house_{index}') or d1_houses.get(str(index)))
lord = house.get('lord')
@@ -3909,10 +3919,14 @@ def render_pl9_parity_markdown(packet: dict) -> str:
placement = '-'
if lord_row:
placement = f"{_token(lord_row.get('sign'))} H{lord_row.get('house') or '-'} {_degree(lord_row.get('degree_in_sign'))}"
_lord_status.setdefault(str(lord), lord_row.get('status') or lord_row.get('dignity'))
lines.append(
f"| {index} | {_cell(_token(house.get('cusp_sign') or house.get('sign')))} | {_cell(_token(lord))} | "
f"{_cell(placement)} | {_cell(_dignity_label(lord_row.get('status') or lord_row.get('dignity'), _lang))} | {_cell(lord_dasha_cell(str(lord) in active_lords, bool(active_lords), _lang))} |"
f"{_cell(placement)} | {_cell(_dignity_label(lord_row.get('status') or lord_row.get('dignity'), _lang, str(lord), _neecha))} | {_cell(lord_dasha_cell(str(lord) in active_lords, bool(active_lords), _lang))} |"
)
_notes = neecha_table_notes(list(_lord_status), _lord_status, _neecha, _lang)
if _notes:
lines.extend(['', *_notes])
lines.append('')
# BUG-2121 (占星师 2026-11-20 问题 1): five separate paths between each house and the current
# period lords, next to the house-lord table; an index, not an activation verdict.
@@ -3985,7 +3999,7 @@ def render_pl9_parity_markdown(packet: dict) -> str:
if not title:
continue
lines.extend([f'#### {title}', ''])
for key in ('detected', 'consideration', 'facts', 'result', 'cancellation'):
for key in ('detected', 'consideration', 'facts', 'result', 'cancellation', 'same_fact'):
value = str(sections.get(key) or '').strip()
if value:
lines.extend([_public_report_text(value), ''])
@@ -4152,7 +4166,7 @@ def render_pl9_parity_markdown(packet: dict) -> str:
if not name:
continue
lines.extend([f'#### {name}', ''])
for key in _list(row.get('section_order')) or ('detected', 'roles', 'theme', 'result', 'activation'):
for key in _list(row.get('section_order')) or ('detected', 'roles', 'theme', 'result', 'same_fact', 'activation'):
value = str(sections.get(key) or '').strip()
if value:
lines.extend([_public_report_text(value), ''])