fix(nakshatra): keep the first mahadasha's antardashas on the full clock

Upstream 8643bc9a. The nakshatra breakdown was restarting the nine antardashas from the birth remainder, so mid-Ashwini reported Ketu instead of Rahu. Reuse cmd_dasha and clip to birth. BUG-1380.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jesse-ux
2026-10-18 16:08:31 +08:00
co-authored by Grok (agent loop) Cursor
parent e7bf60c1f2
commit 68762ccec5
3 changed files with 75 additions and 96 deletions
@@ -0,0 +1,17 @@
"""The interpretation helper must consume the real, unclipped MD/AD clock."""
from scripts.nakshatra_dasha import calc_nakshatra_dasha_breakdown
def test_first_remaining_md_is_not_repartitioned_into_new_ads():
# Mid-Ashwini: half of Ketu's seven years elapsed. The active AD is Rahu,
# not Ketu; the helper must not restart the first parent's child clock.
result = calc_nakshatra_dasha_breakdown(
20 / 3, {'Ketu': 1., 'Rahu': 181.},
'2000-01-01T12:34:56', 0.)
assert result['mahadasha']['lord'] == 'Ketu'
assert result['antardasha']['lord'] == 'Rahu'
assert result['antardasha']['start_datetime'] == '2000-01-01T12:34:56'
assert result['reference_datetime'] == '2000-01-01T12:34:56'
assert result['antardasha']['progress'] > 0
# Missing natal positions are never silently fabricated as 0 degrees.
assert {row['period'] for row in result['pada_windows']} <= {'AD Ketu', 'AD Rahu'}