Compare commits

..
1 Commits
Author SHA1 Message Date
ClaudeandClaude Opus 5.5 c9d92d4a4b fix(report): the English audit note no longer says "parity", so the English edition passes the site's leak check again (BUG-2324)
Independent Staging Quality Gate / validate-frontend (push) Successful in 6m1s
Independent Staging Quality Gate / validate-python (push) Successful in 7m45s
Independent Staging Quality Gate / publish (push) Successful in 3m18s
BUG-2294 added English notes for the engine's audit rows; the Narayana/Patyayini/Tajika
row said "while external parity is open". acceptEnglishEdition runs ordinaryOutputLeaks
on the English markdown and `parity` is a backstage word there, so every personal report
since that change was stored with englishUnavailable=public_leak and export offered
Chinese only. The new test reads the English leak patterns from report-public-projection.ts
and checks every English audit note and a public chart's whole English edition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-24 18:43:57 +08:00
3 changed files with 111 additions and 1 deletions
+15
View File
@@ -31443,3 +31443,18 @@
- 防复发:手机上输入框聚焦时的位置只由 `chatKeyboardFrame` 决定;任何改窗口滚动的代码在文字输入框有焦点时都不得动(BUG-2277)。
- 关联记录:BUG-2277、BUG-920、BUG-2259(报告提问用同样的可见区域办法)、BUG-2282、BUG-2309、BUG-1899。
- 修复版本:分支 `claude/home-composer-keyboard-2323`(待推 staging)。
## BUG-2324 | 个人报告英文版没生成成功(public_leak),导出只能选中文:英文审计说明里写了 parity
- 状态:fixed-pending-verify(待 staging 重新生成一份个人报告确认英文版可导出)。
- 首次发现 / 最近更新:2026-11-24 / 2026-11-24。
- 现象:负责人在测试站生成的新个人报告,导出只能选中文,提示「这份报告的英文版没有生成成功,只能导出中文版。」。读取接口返回 `englishEdition: unavailable`、`englishUnavailableReason: public_leak`。同一账号 11-22 的报告英文版正常。
- 触发条件:今天起生成的每一份个人报告(含 BUG-2294 的引擎)。
- 根因:BUG-2294(eb706f5d0,信息密度第 1 批)给审计表行加了英文说明,其中「Narayana / Patyayini / Tajika」一行写成 "...while external parity is open they do not decide..."。站点收英文版时 `acceptEnglishEdition` 用 `ordinaryOutputLeaks(markdown, "en")` 检查后台词,`parity` 在禁用表里,于是整份英文版被丢弃。本机用公开 AA 盘(奥巴马)和虚构北京盘重算,英文版只命中 `\bparity\b` 这一处,汉字检查通过。属于 BUG-2185 / BUG-2204 同一类(引擎新增的英文文字没有过站点的英文检查)。
- 修复:`scripts/report_render/audit_chapters.py` 的这句改成 "...while the outside cross-checks are still open...",意思不变。改后两张盘的英文版用站点同一个检查(TypeScript `ordinaryOutputLeaks`、`containsHan`)全部通过。
- 验证:新增 `tests/test_report_english_public_leak_2324.py`:直接从 `report-public-projection.ts` 读英文禁用词表;每条英文审计说明都要通过;公开盘整份英文版(去掉状态栏,与站点一致)都要通过。改回旧句时两条测试都失败。
- 防复发:以后引擎新加英文文字,只要踩到站点的英文禁用词,这条测试在后端门禁就会失败,不会再静默丢掉英文版。
- 尚未处理:已经生成、英文版被丢弃的报告不会自动补回英文版——英文版和中文版同一次计算生成、快照只写一次,补生成需要原来的计算输入(当天日期等),现在没有单独重试入口(BUG-2185 已记)。这类报告要英文版只能重新生成。
- 影响范围:生产 1.0(d6f41c9e9)没有 BUG-2294,不受影响;1.1(e29b7e3a7)包含 BUG-2294,**上线后生成的个人报告都会没有英文版**,直到本修复发到生产。
- 关联记录:BUG-2294、BUG-2185、BUG-2204、BUG-2109。
- 修复版本:`claude/report-english-2324`。
+3 -1
View File
@@ -124,7 +124,9 @@ EN_AUDIT_NOTES = {
"Relationship Synastry Taxonomy": "Synastry terms belong to a pair reading; this natal report does not use them.",
"Exact Cusp Oracle": "There is no reproducible exact-cusp reference and no independent day-level holdout, so no day-level events or exact dates are given.",
"Prashna": "No separate question time, question text or place was given; a natal or annual chart does not stand in for a question chart.",
"Narayana / Patyayini / Tajika Parity": "These are kept as cross-check windows and annual structure; while external parity is open they do not decide the order, strength or exact timing of events.",
# BUG-2324 原值 "...; while external parity is open they do not decide..." / 新值 "...; while the outside
# cross-checks are still open they do not decide..." / 原因:英文版的公开泄漏检查把 parity 当后台词,整份英文版被丢弃。
"Narayana / Patyayini / Tajika Parity": "These are kept as cross-check windows and annual structure; while the outside cross-checks are still open they do not decide the order, strength or exact timing of events.",
"MEVG / Global Web Evidence": "External web evidence was not collected for this report.",
"Real Case Calibration": "No real-case calibration was run for this report.",
}
@@ -0,0 +1,93 @@
"""BUG-2324: the English edition was dropped as public_leak.
BUG-2294 added English notes for the engine's audit rows; one of them said
"while external parity is open". The site's English acceptance check
(`acceptEnglishEdition` → `ordinaryOutputLeaks(markdown, "en")`) treats
`parity` as backstage vocabulary, so every new personal report shipped
Chinese only and export offered no English.
These tests read the English leak patterns straight from the TypeScript
source, so a new leak word or a new English sentence cannot drift apart again.
"""
from __future__ import annotations
import copy
import re
from pathlib import Path
import pytest
from scripts.report_render.audit_chapters import EN_AUDIT_NOTES
ROOT = Path(__file__).resolve().parents[1]
PROJECTION = ROOT / "frontend" / "src" / "lib" / "report-public-projection.ts"
def _array_patterns(source: str, name: str) -> list[str]:
start = source.index(f"const {name}: readonly RegExp[] = [")
end = source.index("\n];", start)
return [line.strip().rstrip(",") for line in source[start:end].splitlines()[1:]
if line.strip().startswith("/") and not line.strip().startswith("//")]
def _to_python(js: str) -> re.Pattern[str]:
body, _, flags = js.rpartition("/")
return re.compile(body[1:], re.IGNORECASE if "i" in flags else 0)
def english_leak_patterns() -> list[re.Pattern[str]]:
source = PROJECTION.read_text(encoding="utf-8")
shared = _array_patterns(source, "SHARED_OUTPUT_LEAK_PATTERNS")
ordinary = [p for p in _array_patterns(source, "ORDINARY_OUTPUT_LEAK_PATTERNS") if not p.startswith("...")]
# ENGLISH_OUTPUT_LEAK_PATTERNS = ORDINARY minus its last rule (twelve English words in a row), plus the raw code.
assert "ORDINARY_OUTPUT_LEAK_PATTERNS.slice(0, -1)" in source
return [_to_python(p) for p in shared + ordinary[:-1]] + [re.compile(r"\bparameter_sensitive\b", re.IGNORECASE)]
def _without_status_cells(markdown: str) -> str:
"""Like `withoutPublicStatusCells`: a table's Status column is a public status label, not prose."""
out: list[str] = []
status_col: int | None = None
for line in markdown.splitlines():
if not line.startswith("|"):
status_col = None
out.append(line)
continue
cells = line.split("|")
if status_col is None and any(cell.strip() == "Status" for cell in cells):
status_col = next(i for i, cell in enumerate(cells) if cell.strip() == "Status")
if status_col is not None and status_col < len(cells):
cells[status_col] = " "
out.append("|".join(cells))
return "\n".join(out)
def _leaks(text: str) -> list[str]:
return [p.pattern for p in english_leak_patterns() if p.search(text)]
def test_the_patterns_are_read() -> None:
patterns = [p.pattern for p in english_leak_patterns()]
assert r"\bparity\b" in patterns and r"\bblocked\b" in patterns and r"\btechnique_truth\b" in patterns
def test_every_english_audit_note_passes_the_site_leak_check() -> None:
for title, note in EN_AUDIT_NOTES.items():
assert _leaks(note) == [], title
@pytest.mark.slow
def test_a_public_chart_english_edition_passes_the_site_leak_check() -> None:
from scripts.pl9_reader_export import _pl9_export_markdown_for_edition
from tests.test_report_english_edition import _packet
from tests.test_report_english_place_2204 import CASES
packet = _packet(CASES["obama_public"])
english = copy.deepcopy(packet)
english["report_language"] = "en"
markdown = _pl9_export_markdown_for_edition(english, "full_data")
checked = _without_status_cells(markdown)
found = {p: [line[:160] for line in checked.splitlines() if re.search(p, line, re.IGNORECASE)][:3]
for p in _leaks(checked)}
assert found == {}