fix(report): make density facts readable and printable
Independent Staging Quality Gate / validate (push) Failing after 11m4s
Independent Staging Quality Gate / publish (push) Skipped

Unify reader cleanup rules, lock writer table guards, and register the exact fictional timestamp collision. Preserve existing ordinary-report safety contracts and source-data gaps.

Validation: report Node 165/165, final safety 29/29, Python 101/101, Chrome 28/28; both PDFs retain all 130 rows. Full Node 3704 tests with the same 91 baseline failures. Privacy test: 62 passed, 1 failed due to 17 protected-file READ_ERRORs; not a green gate. Build, DB, manual checklist and controlled-login gaps remain documented. User explicitly authorized staging push with these gaps disclosed.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
jesse-ux
2026-09-23 15:26:25 +08:00
co-authored by Claude Code
parent 0d37bec15a
commit a12f2c0d26
27 changed files with 1220 additions and 210 deletions
@@ -0,0 +1,52 @@
"""Shared vocabulary regressions; no generated engine facts in these unit inputs."""
from pathlib import Path
import pytest
from scripts.reader_appendix_language import clean_reader_appendix_markdown
from scripts import skill_release_package
ROOT = Path(__file__).resolve().parents[1]
RULE_PATH = "scripts/reader_appendix_language.rules.json"
@pytest.mark.parametrize("source,expected", [
("PL9 第 42 页", "外部参照资料"),
("PL9第42页", "外部参照资料"),
("PL9.pdf 第 42 页", "外部参照资料"),
("PL9.pdf第42页后文", "外部参照资料后文"),
("参见PL9第43–44页中的字段", "参见外部参照资料中的字段"),
("PL9 第 40 / 48 页", "外部参照资料"),
("PL9 pages 99-100", "外部参照资料"),
])
def test_chinese_page_boundary(source, expected):
assert clean_reader_appendix_markdown(source) == expected
@pytest.mark.parametrize("edition", ["basic_git", "premium_cloud_drive"])
def test_shared_rules_are_included_by_skill_package_selection(monkeypatch, edition):
# Simulate the tracked file inventory without mutating this worktree's index.
# Exercise the real release selector: scripts assets must not become .py-only.
inventory = ["scripts/reader_appendix_language.py", RULE_PATH]
# Release manifest references are relative to the repository, not the caller.
monkeypatch.chdir(ROOT)
monkeypatch.setattr(skill_release_package, "_git_files", lambda: inventory)
selected = skill_release_package._edition_files(edition)
assert all(path in selected for path in inventory)
assert (ROOT / RULE_PATH).is_file()
@pytest.mark.parametrize("dockerfile", ["railway-api.Dockerfile", "railway-web.Dockerfile"])
def test_shared_rules_live_inside_existing_image_copy_boundary(dockerfile):
source = (ROOT / "deploy" / dockerfile).read_text(encoding="utf-8")
assert any(line.startswith("COPY scripts ") for line in source.splitlines())
def test_crlf_chart_fence_is_byte_preserved():
fence = ' ```jyotish-chart\r\n{"title":"PL9第42页 parameter_sensitive","id":"D1"}\r\n ```\r\n'
source = "PL9第42页\r\n" + fence + "| parameter_sensitive |\r\n"
assert clean_reader_appendix_markdown(source).encode("utf-8") == (
"外部参照资料\r\n" + fence + "| 参数敏感 |\r\n"
).encode("utf-8")