fix(narayana): show the source-aware seed beside the historical sequence (BUG-1264, upstream 1918ffaf)

This commit is contained in:
jesse-ux
2026-10-07 17:42:13 +08:00
parent edeec41309
commit 5eb11e7cd1
5 changed files with 271 additions and 6 deletions
+61
View File
@@ -0,0 +1,61 @@
"""Narayana display keeps the historical sequence and names the selected seed (BUG-1264)."""
from __future__ import annotations
from scripts.narayana_dasha import (
calc_narayana_mahadasha,
narayana_dasha_full_report,
narayana_report_with_variants,
)
LONGS = {
"Sun": 10.0,
"Moon": 40.0,
"Mars": 70.0,
"Mercury": 100.0,
"Jupiter": 130.0,
"Venus": 160.0,
"Saturn": 15.0,
"Rahu": 250.0,
"Ketu": 70.0,
}
def test_default_calc_matches_the_explicit_legacy_profiles() -> None:
plain = calc_narayana_mahadasha(0, LONGS)
explicit = calc_narayana_mahadasha(
0,
LONGS,
0.0,
duration_profile="legacy_forward_v0",
sequence_profile="legacy_zodiacal_v0",
seed_profile="legacy_lagna_v0",
dual_lord_profile="legacy_primary_lord_v0",
)
assert plain == explicit
report = narayana_dasha_full_report(0, LONGS, current_age=30, birth_year=1990)
assert [row["sign"] for row in report["mahadasha_sequence"]] == [row["sign"] for row in plain]
assert report["interpretation"][1].startswith("起运星座: Aries(所选起运规则 legacy_lagna_v0)")
assert "(Lagna)" not in report["interpretation"][1]
def test_source_aware_comparison_does_not_replace_the_historical_sequence() -> None:
compared = narayana_report_with_variants(0, LONGS, current_age=30, birth_year=1990)
historical = narayana_dasha_full_report(0, LONGS, current_age=30, birth_year=1990)
assert [row["years"] for row in compared["mahadasha_sequence"]] == [row["years"] for row in historical["mahadasha_sequence"]]
source = compared["method_comparison"]["source_aware"]
assert source["seed_selection"]["profile"] == "jaimini_lagna_seventh_strength_v1"
assert "jaimini_lagna_seventh_strength_v1" in source["interpretation"][1]
assert compared["comparison_required"] is True
def test_ketu_in_the_seed_is_blocked_without_table_12() -> None:
longs = dict(LONGS)
longs["Saturn"] = 200.0
longs["Ketu"] = 5.0
compared = narayana_report_with_variants(0, longs, current_age=10, birth_year=1990)
source = compared["method_comparison"]["source_aware"]
assert source["status"] == "blocked"
assert "rath_ketu_table12_v1" in source["reason"]
assert compared["mahadasha_sequence"][0]["sign"] == "Aries"