The full note pushed steve_jobs/marriage to 12,028 characters (budget 12,000), and cutting it in the card broke the 'nothing rewritten' contract. The engine now also writes algorithm_label 旧算法(从上升起、一律顺行), the card copies it verbatim, and Narayana AD/PD rows drop years (end_age - start_age). Largest card 11,979 (baseline 11,983). Goldens re-captured; the biography golden now keeps the Narayana label keys too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
64 lines
3.1 KiB
Python
64 lines
3.1 KiB
Python
"""The product Narayana Dasha is labelled as the legacy algorithm (BUG-1215, T4).
|
|
|
|
Round-4 ruling Q4: until the Sanjay Rath profile replaces it (product decision
|
|
after the trial), every user-visible Narayana says it is the old algorithm
|
|
(from the Lagna, always zodiacal) and the data carry
|
|
`profile: legacy_reference_only`. K.N. Rao is a Chara Dasha name only.
|
|
Fictional chart.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import copy
|
|
import json
|
|
import re
|
|
from pathlib import Path
|
|
|
|
from scripts.narayana_legacy_label import LEGACY_NOTE_EN, LEGACY_NOTE_ZH, LEGACY_PROFILE
|
|
from scripts.pl9_reader_export import _pl9_export_markdown_for_edition
|
|
from tests.test_report_english_edition import CASES, _packet
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_report_module_and_reference_edition_carry_the_label() -> None:
|
|
packet = _packet(CASES["day"])
|
|
zh = _pl9_export_markdown_for_edition(copy.deepcopy(packet), "reference")
|
|
assert f"- 算法:{LEGACY_NOTE_ZH}" in zh
|
|
from scripts.jyotish_engine import cmd_full_reading
|
|
|
|
reading = cmd_full_reading(type("Args", (), dict(CASES["day"]))())
|
|
module = reading["modules"]["narayana_dasha"]
|
|
assert (module["profile"], module["algorithm_note"], module["algorithm_note_en"]) == (LEGACY_PROFILE, LEGACY_NOTE_ZH, LEGACY_NOTE_EN)
|
|
|
|
|
|
def test_english_reader_translates_the_label() -> None:
|
|
from scripts.pl9_reader_english_terms import PHRASES_EN
|
|
|
|
text = f"- 算法:{LEGACY_NOTE_ZH}"
|
|
for source, target in PHRASES_EN:
|
|
text = text.replace(source, target)
|
|
assert text == f"- Algorithm: {LEGACY_NOTE_EN}"
|
|
|
|
|
|
def test_consultation_modules_carry_the_label() -> None:
|
|
golden = json.loads((ROOT / "frontend/tests/fixtures/consult-evidence-card-golden.json").read_text(encoding="utf-8"))
|
|
for chart in golden["charts"]:
|
|
for route in ("workflow", "annual_workflow", "timing_workflow"):
|
|
module = chart[route]["chart"]["modules"]["narayana_dasha"]
|
|
assert (module["profile"], module["algorithm_note"], module["algorithm_label"]) == (LEGACY_PROFILE, LEGACY_NOTE_ZH, "旧算法(从上升起、一律顺行)")
|
|
card = (ROOT / "frontend/src/lib/consultation-evidence-card.ts").read_text(encoding="utf-8")
|
|
assert "narayana.algorithm = algorithmLabel" in card and "NARAYANA_SUB_PERIOD_KEYS" in card
|
|
workflow = (ROOT / "frontend/src/mastra/consultation-workflow.ts").read_text(encoding="utf-8")
|
|
assert '"algorithmlabel"' in workflow
|
|
|
|
|
|
def test_kn_rao_never_names_narayana_on_user_visible_surfaces() -> None:
|
|
pattern = re.compile(r"(K\.?\s?N\.?\s?Rao|kn_rao)[^\n]{0,40}Narayana|Narayana[^\n]{0,40}(K\.?\s?N\.?\s?Rao|kn_rao)", re.IGNORECASE)
|
|
surfaces = [*(ROOT / "frontend/src").rglob("*.ts"), *(ROOT / "frontend/src").rglob("*.tsx"),
|
|
ROOT / "scripts/pl9_reader_export.py", ROOT / "scripts/pl9_reader_english_terms.py",
|
|
ROOT / "scripts/consultation_native_layers.py", ROOT / "scripts/jyotish_engine.py",
|
|
ROOT / "scripts/narayana_dasha.py", ROOT / "scripts/cmd_narayana_dasha.py"]
|
|
hits = [path.name for path in surfaces if pattern.search(path.read_text(encoding="utf-8"))]
|
|
assert hits == []
|