fix: integrate people archive, report reader and western chart corrections
Independent Staging Quality Gate / validate (push) Successful in 16m28s
Independent Staging Quality Gate / publish (push) Successful in 3m33s

Validate on Linux Node 22 and PostgreSQL 17: 3894 frontend tests and 64 database tests pass, with no removed test names or new failures. Preserve static Home, bounded gzip, assertion-change records and manual acceptance gaps.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
jesse-ux
2026-09-25 20:41:16 +08:00
co-authored by Claude Code
parent 48fe4daf51
commit 4d801e53c3
78 changed files with 34844 additions and 441 deletions
+51 -11
View File
@@ -12,6 +12,13 @@ Upstream ``_pl9_export_markdown_for_edition`` also serves ``pl9_ai_density``. Th
``_render_pl9_ai_density_raw_data_markdown_en`` and the English density sanitizers, which are
outside the ``reader_main`` closure and are not ported. ``reader_main`` and the reference
default match the upstream branches.
BUG-1028 / 2026-09-25 local reader binding correction: annual lord, Muntha and
annual ascendant are read from their own authoritative pack fields. Upstream
Panchadhikari selection is not imported: its closure loads PyJHora in-process
and falls back to a Panchavargiya proxy blocked in this repository. No annual
algorithm is replaced. Missing names and Panchanga scalar labels are cleaned
for the public reader rather than exposing empty or machine-key rows.
"""
from __future__ import annotations
@@ -522,6 +529,35 @@ def render_pl9_parity_markdown(packet: dict) -> str:
raw = str(value or '').strip()
return label_map.get(raw) or sign_map.get(raw) or raw or '-'
def _annual_field_text(field, *keys) -> str:
field = _dict(field)
if field.get('status') in {'blocked', 'not_applicable'}:
return '-'
if field.get('status') == 'conflict':
labels = {'solar_return': '太阳返照', 'tajika': 'Tajika'}
values = []
for item in _list(field.get('values')):
item = _dict(item)
data = _dict(item.get('value'))
value = next((data.get(key) for key in keys if data.get(key)), None)
if value is not None:
values.append(f"{labels.get(item.get('producer'), '另一口径')}:{_token(value)}")
return ';'.join(values) + '(两者不同)' if values else '-'
data = _dict(field.get('data') or field)
return _token(next((data.get(key) for key in keys if data.get(key)), None))
def _annual_selection_basis(year_lord, muntha) -> str:
year_lord = _dict(year_lord)
if year_lord.get('status') == 'conflict':
return '两种计算口径给出的年主不同,暂不合并'
data = _dict(year_lord.get('data') or year_lord)
muntha_data = _dict(_dict(muntha).get('data'))
if data.get('selection_basis'):
return _cell(data['selection_basis'])
if data.get('year_lord') and data['year_lord'] == muntha_data.get('muntha_lord'):
return 'Muntha 所在星座的守护星(当前本地口径)'
return '-'
def _degree(value) -> str:
try:
return f"{float(value):.2f}°"
@@ -636,7 +672,7 @@ def render_pl9_parity_markdown(packet: dict) -> str:
'',
'## 出生资料与图盘(PL9 p1-p17)',
'',
f"- 姓名:{birth.get('name') or birth.get('user_name') or '-'}",
*([f"- 姓名:{birth.get('name') or birth.get('user_name')}"] if birth.get('name') or birth.get('user_name') else []),
f"- 出生:{birth.get('date') or '-'} {birth.get('time') or ''}",
f"- 计算口径:{birth.get('ayanamsa_name') or birth.get('ayanamsa') or '-'} / {birth.get('node_mode') or '-'}",
'',
@@ -686,10 +722,14 @@ def render_pl9_parity_markdown(packet: dict) -> str:
'| Panchanga | Value |',
'|-----------|-------|',
])
for key, value in panchanga.items():
if isinstance(value, (dict, list, tuple)) or value in (None, ''):
continue
lines.append(f"| {_cell(key)} | {_cell(value)} |")
for key, label in (
('overall_quality', '综合性质'),
('auspicious_count', '吉性要素数量'),
('total_elements', '要素总数'),
):
value = panchanga.get(key)
if value not in (None, ''):
lines.append(f"| {_cell(label)} | {_cell(value)} |")
lines.append('')
source_visible = packet.get('pl9_source_visible_tables') if isinstance(packet.get('pl9_source_visible_tables'), dict) else {}
birth_extra = _list(source_visible.get('birth_particulars_extra'))
@@ -1800,10 +1840,10 @@ def render_pl9_parity_markdown(packet: dict) -> str:
'',
'| Field | Value |',
'|-------|-------|',
f"| Varshesha | {_cell(_token(year_lord_data.get('year_lord') or year_lord_data.get('lord')))} |",
f"| Selection basis | {_cell(year_lord_data.get('selection_basis'))} |",
f"| Annual ascendant sign | {_cell(_token(year_lord_data.get('annual_asc_sign')))} |",
f"| Muntha sign | {_cell(_token(year_lord_data.get('muntha_sign')))} |",
f"| Varshesha | {_cell(_annual_field_text(year_lord, 'year_lord', 'lord'))} |",
f"| Selection basis | {_cell(_annual_selection_basis(year_lord, annual.get('muntha')))} |",
f"| Annual ascendant sign | {_cell(_token(annual_chart_data.get('asc_sign')))} |",
f"| Muntha sign | {_cell(_annual_field_text(annual.get('muntha'), 'muntha_sign'))} |",
])
if candidates:
lines.append(f"| Candidate count | {_cell(len(candidates))} |")
@@ -2165,8 +2205,8 @@ def render_pl9_parity_markdown(packet: dict) -> str:
year_lord_data = _dict(year_lord.get('data') or year_lord)
if year_lord_data:
lines.extend([
f"| Varshesha | {_cell(_token(year_lord_data.get('year_lord') or year_lord_data.get('lord')))} |",
f"| Muntha sign | {_cell(_token(year_lord_data.get('muntha_sign')))} |",
f"| Varshesha | {_cell(_annual_field_text(year_lord, 'year_lord', 'lord'))} |",
f"| Muntha sign | {_cell(_annual_field_text(annual_pack.get('muntha'), 'muntha_sign'))} |",
])
lines.append('')
planet_longitudes = _dict(annual_chart_data.get('planet_longitudes'))