- Functional default = PVR Table 30 (functional_profile=pvr_table_30); the former product table is bphs_exception_profile, scored only when named (rectification names it, scores unchanged). profile_divergence shows both roles side by side; movable-lagna Moon by the table's paksha note; dual-lordship note; prior rulings BUG-1570/1590/#166 Q4 checked against Table 30. - Shadbala: six open items labelled parameter_sensitive; every option combination computed; only planets whose pass/fail flips get minimum_check=parameter_sensitive. - Vimshottari AD/PD rows carry parent_period_start / visible_period_start; the consult card cuts the balance MD from its full parent and clips at birth. - KP DBA: full first parent, clipped at birth (no balance rescale). - Mudda: balance fields + balance_method (angle default, time comparison apart), nominal_year_days, her crossing wording; Harsha combined blocked reason lists items. - D30 _meta describes the unequal parts (as her r40). - Golden recaptured with TTL=0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
98 lines
5.1 KiB
Python
98 lines
5.1 KiB
Python
"""BUG-1722: Mudda raw timeline / nominal year / report coverage kept apart (占星师 r40 第 4 条, her Q2).
|
||
|
||
Numbers from /workspace/eval-upstream-1107/parity6/B8_annual_boundaries.json, 公开名人盘 (row jobs 2026):
|
||
annual start 2026-02-25T08:21:04Z, next actual return 2027-02-25T14:29:06Z, local offset -8 h;
|
||
nominal end minus next return = -482 s; raw last segment end minus next return = 223177 s.
|
||
"""
|
||
import sys
|
||
from datetime import datetime, timedelta, timezone
|
||
from pathlib import Path
|
||
|
||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
||
|
||
import tajika_mudda # noqa: E402
|
||
|
||
START = datetime(2026, 2, 25, 0, 21, 4) # local (-8 h)
|
||
NEXT_RETURN = datetime(2027, 2, 25, 6, 29, 6) # local (-8 h)
|
||
KW = dict(annual_start=START, completed_years=71, natal_moon_longitude=345.95793509035576)
|
||
|
||
|
||
def _p(value):
|
||
return datetime.fromisoformat(str(value))
|
||
|
||
|
||
def test_raw_timeline_is_whole_and_runs_past_the_next_return():
|
||
out = tajika_mudda.annual_mudda_dasha(**KW, coverage_end=NEXT_RETURN)
|
||
raw = out["raw_periods"]
|
||
assert len(raw) == 10 and raw == out["periods_full"]
|
||
assert all(row["duration_days"] == row["full_duration_days"] for row in raw[1:])
|
||
overshoot = (_p(raw[-1]["end"]) - NEXT_RETURN).total_seconds()
|
||
assert abs(overshoot - 223177) < 1.0
|
||
assert out["raw_antardasha_periods"] and _p(out["raw_antardasha_periods"][-1]["end"]) == _p(raw[-1]["end"])
|
||
|
||
|
||
def test_nominal_year_and_coverage_interval_are_separate():
|
||
out = tajika_mudda.annual_mudda_dasha(**KW, coverage_end=NEXT_RETURN)
|
||
assert out["nominal_year"]["days"] == 365.25
|
||
assert _p(out["nominal_year"]["end"]) == START + timedelta(days=365.25)
|
||
cov = out["coverage_interval"]
|
||
assert cov["basis"] == "actual_solar_return_to_next_actual_solar_return"
|
||
assert _p(cov["start"]) == START and _p(cov["end"]) == NEXT_RETURN
|
||
assert cov["nominal_end_minus_coverage_end_seconds"] == -482.0
|
||
|
||
|
||
def test_view_is_clipped_to_coverage_without_a_gap_and_labelled():
|
||
out = tajika_mudda.annual_mudda_dasha(**KW, coverage_end=NEXT_RETURN)
|
||
rows = out["periods"]
|
||
# 原值:末段裁在 annual_end(START + 365.25 d),比下一次真实返照早 482 s;新值:裁在下一次真实返照。
|
||
assert _p(rows[0]["start"]) == START and _p(rows[-1]["end"]) == NEXT_RETURN
|
||
assert all(a["end"] == b["start"] for a, b in zip(rows, rows[1:]))
|
||
assert out["periods_view"]["clipped_to"] == "coverage_interval"
|
||
assert "raw_periods" in out["periods_view"]["label"]
|
||
assert _p(out["antardasha_periods"][-1]["end"]) == NEXT_RETURN
|
||
|
||
|
||
def test_unknown_next_return_falls_back_to_the_nominal_year_and_says_so():
|
||
out = tajika_mudda.annual_mudda_dasha(**KW)
|
||
assert out["coverage_interval"]["basis"] == tajika_mudda.COVERAGE_FALLBACK
|
||
assert _p(out["periods"][-1]["end"]) == START + timedelta(days=365.25)
|
||
assert "365.25" in out["periods_view"]["label"]
|
||
|
||
|
||
def test_profiles_share_the_coverage_view_and_keep_raw_rows():
|
||
out = tajika_mudda.annual_mudda_profiles(**KW, annual_moon_longitude=100.0, varsha_lord="Venus",
|
||
coverage_end=NEXT_RETURN)
|
||
for key in ("moon_at_birth_time", "moon_in_varshaphala"):
|
||
profile = out["profiles"][key]
|
||
assert _p(profile["periods"][-1]["end"]) == NEXT_RETURN
|
||
assert len(profile["raw_periods"]) == 10
|
||
|
||
|
||
def test_package_crossing_segment_uses_her_wording():
|
||
from annual_service.package import _crossing_segment
|
||
|
||
zone = timezone(timedelta(hours=-8))
|
||
data = tajika_mudda.annual_mudda_dasha(**KW, coverage_end=NEXT_RETURN)
|
||
out = _crossing_segment(data, lambda value: _p(value).replace(tzinfo=zone), zone)
|
||
assert out["lord"] == data["raw_periods"][-1]["lord"]
|
||
# 原值:startswith("按上一年盘所用算法,该周期原始计算延伸至2027-02-27")
|
||
# 新值:她的原话,原始延伸终点放括号里。原因:占星师 2026-11-08 第五轮裁定 2
|
||
assert out["text"] == "该周期按原算法继续延伸,后续部分归入下一年盘解释(原始计算延伸至2027-02-27)"
|
||
# 原值:assert "本年盘报告只解释至下一次太阳回归" in out["text"];新值:删除(旧句已换成她的原话)
|
||
# 原因:占星师 2026-11-08 第五轮裁定 2
|
||
assert "后续部分归入下一年盘解释" in out["text"]
|
||
|
||
|
||
def test_calendar_year_spans_two_tajika_years_split_at_the_return():
|
||
from consultation_native_layers import _calendar_year_span
|
||
|
||
birth = {"year": 1955, "month": 2, "day": 24, "hour": 19, "minute": 15, "second": 0, "tz": -8, "ayanamsa": "raman"}
|
||
solar = {"data": {"sun_lon": 313.95873200737475}}
|
||
start, end = datetime(2026, 2, 25, 0, 21, 4), datetime(2027, 2, 25, 6, 29, 6)
|
||
out = _calendar_year_span(birth, solar, datetime(2026, 6, 1), start, end, 2026, -8.0)
|
||
assert out["year"] == 2026 and out["split_at_return"] == "2026-02-25"
|
||
previous, attached = out["tajika_years"]
|
||
assert previous["target_year"] == 2025 and previous["coverage"] == {"start": "2025-02-24", "end": "2026-02-25"}
|
||
assert previous["role"] == "annual_chart_not_in_this_card"
|
||
assert attached["calendar_part"] == {"start": "2026-02-25", "end": "2027-01-01"}
|