fix: integrate people archive, report reader and western chart corrections
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:
@@ -236,10 +236,10 @@ def _annual_comparable_value(key: str, value: Any) -> Any:
|
||||
"muntha_lord": value.get("muntha_lord"),
|
||||
}
|
||||
if key == "year_lord":
|
||||
return {
|
||||
"year_lord": value.get("year_lord") or value.get("lord"),
|
||||
"year_lord_sign": value.get("year_lord_sign") or value.get("sign"),
|
||||
}
|
||||
# Local divergence from upstream 23b9609e (BUG-1028): Tajika returns
|
||||
# muntha_sign, not year_lord_sign. Compare the actual selected planet;
|
||||
# an absent metadata field is not an annual-method disagreement.
|
||||
return {"year_lord": value.get("year_lord") or value.get("lord")}
|
||||
return {
|
||||
"sign": value.get("sign") or value.get("muntha_sign") or value.get("year_lord_sign"),
|
||||
"lord": value.get("lord") or value.get("muntha_lord") or value.get("year_lord"),
|
||||
@@ -336,7 +336,9 @@ def _report_sections(
|
||||
sahams_brief = _field_brief("Sahams", sahams)
|
||||
quick_takeaways = [item for item in (muntha_brief, year_lord_brief) if item]
|
||||
narrative_preview = [
|
||||
"年度层已经有可读壳层,但仍需要带着冲突标签阅读。",
|
||||
("年度层存在不同计算结果,需分别核对。" if conflict_fields else
|
||||
"年度层仍有缺失字段,暂不补全。" if blocked_fields else
|
||||
"年度结构可读,仍需外部核对。"),
|
||||
muntha_brief,
|
||||
year_lord_brief,
|
||||
]
|
||||
@@ -368,7 +370,9 @@ def _report_sections(
|
||||
"reason": thematic_reason,
|
||||
"highlights": [
|
||||
"Solar Return / Tajika annual shell is available.",
|
||||
"Muntha and Year Lord are visible, but Year Lord remains producer-disagree sensitive.",
|
||||
("Muntha 或 Year Lord 存在不同计算结果,需分别核对。" if conflict_fields else
|
||||
"Muntha 或 Year Lord 仍有缺失字段,暂不补全。" if blocked_fields else
|
||||
"Muntha 与 Year Lord 已列出;本地结果不代表外部验证已经完成。"),
|
||||
"The report should read annual structure first, then the evidence appendix.",
|
||||
],
|
||||
},
|
||||
|
||||
@@ -2787,7 +2787,7 @@ def _annual_series_surface(annual_pack: dict) -> dict:
|
||||
annual_pack = annual_pack if isinstance(annual_pack, dict) else {}
|
||||
keep_keys = (
|
||||
'schema', 'status', 'reason', 'profile', 'audit', 'report_sections',
|
||||
'annual_chart', 'year_lord', 'external_engine_comparison',
|
||||
'solar_return', 'annual_chart', 'year_lord', 'external_engine_comparison',
|
||||
'patyayini_dasha', 'sahams', 'tajika_yogas', 'muntha',
|
||||
)
|
||||
surface = {
|
||||
|
||||
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user