fix(report): drop the remaining 「来源」 lines and print birth-data source codes as reader words (BUG-2115 follow-up)
Annual clock captions no longer end with "this report's native calculation"; the general dasha reference drops its per-lord study-notes citation; the birth data section translates user_reported / family_exact and the other stored codes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
This commit is contained in:
+6
-1
@@ -28568,8 +28568,13 @@
|
||||
- `scripts/research_timing/render.py`:对照句改成「与参照算法不一致:差在 …」/「Differs from the reference algorithm: …」。
|
||||
- `scripts/report_render/parity_chapters.py`:「Swiss Ephemeris 宫头」→「Bhava Chalit 宫头」。
|
||||
- `scripts/report_render/sade_sati_intervals.py`:星历说明写「高精度星历文件」或「内置近似星历(未找到星历文件,换座时刻可能差一两分钟)」。
|
||||
- 验证与防复发:读者泄漏检查不再切掉年度方法一章,也不再放过对照句,全文出现 PyJHora 即失败(`tests/test_report_reader_main.py`、`tests/test_report_english_edition.py`);`tests/test_pyjhora_annual_method_reference.py`、`tests/test_annual_mudda_interval_2077.py`、`tests/test_research_timing.py`、`tests/test_report_step2_reader_2089.py` 按原值 / 新值 / 原因改断言。
|
||||
- 验证与防复发:`tests/test_report_no_source_lines_2115.py`(大运传统参考无来源行、出生资料代码都换成读者用词);读者泄漏检查不再切掉年度方法一章,也不再放过对照句,全文出现 PyJHora 即失败(`tests/test_report_reader_main.py`、`tests/test_report_english_edition.py`);`tests/test_pyjhora_annual_method_reference.py`、`tests/test_annual_mudda_interval_2077.py`、`tests/test_research_timing.py`、`tests/test_report_step2_reader_2089.py` 按原值 / 新值 / 原因改断言。
|
||||
- 未处理:法律文件里的境外服务说明(VedAstro)是隐私披露,不在报告正文里,不改。
|
||||
- 补充(2026-11-21,第 24 轮真实报告复查):证据包窗口在 50fd5710a 生成的个人报告里确认库名为零,又列出其余「来源」行。
|
||||
- 年度计时表的时钟说明末尾「来源:本报告的原生计算。」/「Source: this report's native calculation.」删掉(`scripts/pl9_reader_export.py`)。
|
||||
- 「大运传统参考」九颗主星下的「来源:《BPHS 读书笔记》第 44 节,PDF 页 …(二手资料;原典印刷版待核)」删掉;页码仍留在数据文件里(`scripts/report_render/dasha_reference.py`)。
|
||||
- 出生资料一节的「坐标来源:user reported」「出生时间来源:family exact」是存储代码原样印出;补上读者用词(用户填写、家人记得的确切时间、医院记录等,`upstream_sync_chapters.WORDS`)。
|
||||
- 不改:Argala 一节「Argala 来源」是术语(哪些宫形成 Argala),不是出处;正式出版书目的「出处:V. P. Goel《…》」等引文不是库名,保留,待负责人决定。
|
||||
- 关联记录:issue #92、#93,BUG-2024(候选瑜伽表去库名),BUG-2077,BUG-2089,BUG-2110。
|
||||
- 修复版本:`claude/rect-reference-line`。
|
||||
|
||||
|
||||
@@ -844,7 +844,7 @@ def _annual_clock_caption(annual: dict, language: str, table: str = "mudda", row
|
||||
parts.append(f"下一次真实太阳回归在 {next_return}。")
|
||||
elif projected:
|
||||
parts.append(f"下一次真实太阳回归时刻没有取得,年度终点暂用按年长推算的 {projected}。")
|
||||
parts.append("来源:本报告的原生计算。")
|
||||
# BUG-2115 (负责人 2026-11-21): no 「来源」 line in front of the reader.
|
||||
return ["".join(parts), ""]
|
||||
parts = [f"Clock: the year starts at the actual solar return, {anchor} (local time{', ' + offset if offset else ''})."]
|
||||
if table == "patyayini":
|
||||
@@ -868,7 +868,6 @@ def _annual_clock_caption(annual: dict, language: str, table: str = "mudda", row
|
||||
parts.append(f"The next actual solar return is {next_return}.")
|
||||
elif projected:
|
||||
parts.append(f"The next actual solar return was not obtained; the year end uses the projected {projected} for now.")
|
||||
parts.append("Source: this report's native calculation.")
|
||||
return [" ".join(parts), ""]
|
||||
|
||||
|
||||
|
||||
@@ -33,13 +33,6 @@ def load_reference() -> dict:
|
||||
return json.load(handle)
|
||||
|
||||
|
||||
def _source_line(pages: list[int], language: str) -> str:
|
||||
pages_text = "、".join(str(page) for page in pages) if language == "zh" else ", ".join(str(page) for page in pages)
|
||||
if language == "zh":
|
||||
return f"来源:《BPHS 读书笔记》第 44 节,PDF 页 {pages_text}(二手资料;原典印刷版待核)。"
|
||||
return f"Source: BPHS Study Notes, section 44, PDF page {pages_text} (secondary source; original edition pending verification)."
|
||||
|
||||
|
||||
def render_dasha_reference(language: str) -> str:
|
||||
data = load_reference()
|
||||
zh = language == "zh"
|
||||
@@ -66,18 +59,13 @@ def render_dasha_reference(language: str) -> str:
|
||||
if not name or not all(kind in paragraphs for kind, _zh, _en in _KINDS):
|
||||
continue
|
||||
lines.extend([f"### {name}", ""])
|
||||
pages: list[int] = []
|
||||
for kind, label_zh, label_en in _KINDS:
|
||||
item = paragraphs[kind]
|
||||
text = str(item.get("zh" if zh else "en") or "").strip()
|
||||
if not text or (not zh and _HAN.search(text)):
|
||||
continue
|
||||
lines.extend([f"**{label_zh if zh else label_en}**:{text}" if zh else f"**{label_en}**: {text}", ""])
|
||||
page = item.get("pdf_page")
|
||||
if isinstance(page, int) and page not in pages:
|
||||
pages.append(page)
|
||||
if pages:
|
||||
lines.extend([_source_line(pages, language), ""])
|
||||
# BUG-2115 (负责人 2026-11-21): no 「来源:《BPHS 读书笔记》…」 line under each lord; the pages stay in the data file.
|
||||
return "\n".join(lines).rstrip() + "\n"
|
||||
|
||||
|
||||
|
||||
@@ -92,6 +92,19 @@ WORDS = {
|
||||
# birth provenance
|
||||
"not_recorded": ("未记录", "not recorded"),
|
||||
"unverified_user_coordinates": ("用户提供坐标,未核验", "user coordinates, unverified"),
|
||||
# BUG-2115: the stored source codes are words for the reader, not printed raw ("user reported", "family exact").
|
||||
"user_reported": ("用户填写", "entered by the user"),
|
||||
"geocoded": ("按地名查得", "looked up from the place name"),
|
||||
"hospital_record": ("医院记录", "hospital record"),
|
||||
"id_document": ("证件记录", "identity document"),
|
||||
"family_exact": ("家人记得的确切时间", "an exact time remembered by family"),
|
||||
"family_clear": ("家人记得清楚", "clearly remembered by family"),
|
||||
"family_vague": ("家人记得模糊", "vaguely remembered by family"),
|
||||
"approximate": ("大概时间", "approximate"),
|
||||
"period_only": ("只知道时段", "time of day only"),
|
||||
"unknown": ("不知道", "unknown"),
|
||||
"legacy_import": ("旧资料导入", "imported from earlier records"),
|
||||
"caller_supplied": ("用户填写", "entered by the user"),
|
||||
# timing precision claims
|
||||
"exact_day_event": ("确定事件日期", "a certain event date"),
|
||||
"exact_clock_event": ("确定事件钟点", "a certain event clock time"),
|
||||
|
||||
@@ -107,9 +107,12 @@ def test_native_caption_names_anchor_zone_balance_year_length_both_year_ends_and
|
||||
assert "365.25" in text
|
||||
assert NEXT_RETURN.isoformat(timespec="seconds") in text and projected in text
|
||||
assert "真实太阳回归时刻" in chinese and "出生时月亮" in chinese and "不是同一时刻" in chinese
|
||||
assert chinese.endswith("来源:本报告的原生计算。")
|
||||
# 原值:assert chinese.endswith("来源:本报告的原生计算。")
|
||||
# 新值:不写「来源」
|
||||
# 原因:BUG-2115 负责人 2026-11-21:报告里不给读者出现「来源」行
|
||||
assert "来源" not in chinese
|
||||
assert "actual solar return" in english and "Moon at birth" in english and "different moments" in english
|
||||
assert english.endswith("Source: this report's native calculation.")
|
||||
assert "Source:" not in english
|
||||
assert in_year_clock_caption(annual, "zh")[0].startswith("下表日期是 Mudda 各段的年内区间。")
|
||||
assert in_year_clock_caption(annual, "en")[0].startswith("Dates below are in-year intervals")
|
||||
|
||||
|
||||
@@ -37,7 +37,10 @@ def test_chinese_chapter_lists_all_three_paragraphs_and_labels_the_source() -> N
|
||||
assert text.count("\n### ") == 9
|
||||
for label in ("**一般背景**:", "**传统有利条件下**:", "**传统压力条件下**:"):
|
||||
assert text.count(label) == 9
|
||||
assert text.count("(二手资料;原典印刷版待核)") == 9
|
||||
# 原值:每颗主星下一行「来源:《BPHS 读书笔记》…(二手资料;原典印刷版待核)」,共 9 行
|
||||
# 新值:不写来源行
|
||||
# 原因:BUG-2115 负责人 2026-11-21:报告里不给读者出现「来源」行;页码仍在数据文件里
|
||||
assert "来源:" not in text and "原典印刷版待核" not in text
|
||||
assert "不替这张盘做判断" in text and "不拼接小运" in text
|
||||
for word in FORBIDDEN_ZH:
|
||||
assert word not in text, word
|
||||
@@ -48,7 +51,10 @@ def test_english_chapter_is_english_only() -> None:
|
||||
assert text.startswith("## Traditional Dasha Reference (general)")
|
||||
assert text.count("\n### ") == 9
|
||||
assert not re.search(r"[一-鿿]", text)
|
||||
assert text.count("(secondary source; original edition pending verification)") == 9
|
||||
# 原值:9 行 Source: BPHS Study Notes …
|
||||
# 新值:不写来源行
|
||||
# 原因:BUG-2115 负责人 2026-11-21:报告里不给读者出现「来源」行;页码仍在数据文件里
|
||||
assert "Source:" not in text and "pending verification" not in text
|
||||
lowered = text.lower()
|
||||
for word in FORBIDDEN_EN:
|
||||
assert word not in lowered, word
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
"""BUG-2115: the reader's report carries no library names and no 「来源」 lines (owner, 2026-11-21)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from scripts.report_render.dasha_reference import render_dasha_reference
|
||||
from scripts.report_render.upstream_sync_chapters import _word
|
||||
|
||||
|
||||
def test_dasha_reference_has_no_source_line() -> None:
|
||||
zh = render_dasha_reference("zh")
|
||||
en = render_dasha_reference("en")
|
||||
assert "### " in zh and "### " in en
|
||||
assert "来源:" not in zh and "读书笔记" not in zh and "PDF 页" not in zh
|
||||
assert "Source:" not in en and "PDF page" not in en
|
||||
|
||||
|
||||
def test_birth_provenance_codes_are_reader_words() -> None:
|
||||
for code in ("user_reported", "family_exact", "family_clear", "family_vague", "hospital_record",
|
||||
"id_document", "approximate", "period_only", "unknown", "legacy_import", "caller_supplied"):
|
||||
zh = _word(code, "zh")
|
||||
en = _word(code, "en")
|
||||
assert "_" not in zh and not any("a" <= char <= "z" for char in zh), (code, zh)
|
||||
assert "_" not in en and en != "—", (code, en)
|
||||
assert _word("user_reported", "zh") == "用户填写"
|
||||
assert _word("family_exact", "zh") == "家人记得的确切时间"
|
||||
Reference in New Issue
Block a user