fix(rectification): use candidate dates for cross-midnight dasha scoring

Add date-isolated caches and regression coverage, align scoring identity, and freeze full research reruns while preserving historical artifacts. Record unresolved cache/receipt identity and end-to-end acceptance gaps for branch review only.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
jesse-ux
2026-09-20 13:56:11 +08:00
co-authored by Claude Code
parent 03cba4780a
commit aa46da1016
49 changed files with 62080 additions and 109 deletions
@@ -8,7 +8,7 @@ bounded auxiliary signal, never larger than one day-level event body.
from __future__ import annotations
from collections.abc import Callable, Sequence
from datetime import date
from datetime import date, datetime
from typing import Any
from scripts.rectification.event_probes import _narayana_start_dates, _vim_start_dates
@@ -152,11 +152,15 @@ def merge_transition_proximity(
moon = (context.get("planet_longitudes") or {}).get("Moon")
if not isinstance(moon, (int, float)):
continue
vim_key = (birth_date, round(float(moon), 6), lo, hi)
# Native contexts retain the local date even when the window crosses midnight.
# Legacy time-only contexts still use the request's date.
candidate_at = context.get("candidate_at")
candidate_date = candidate_at.date().isoformat() if isinstance(candidate_at, datetime) else birth_date
vim_key = (candidate_date, round(float(moon), 6), lo, hi)
if vim_key not in vim_cache:
vim_cache[vim_key] = _vim_start_dates(birth_date, float(moon), lo, hi)
vim_cache[vim_key] = _vim_start_dates(candidate_date, float(moon), lo, hi)
pd_cache[vim_key] = _vim_start_dates(
birth_date,
candidate_date,
float(moon),
lo,
hi,
@@ -165,7 +169,7 @@ def merge_transition_proximity(
planets = context.get("planet_longitudes") or {}
asc = context.get("ascendant_index")
narayana_key = (
birth_date,
candidate_date,
int(asc) if isinstance(asc, int) else None,
lo,
hi,
@@ -173,7 +177,7 @@ def merge_transition_proximity(
)
if narayana_key not in narayana_cache:
narayana_cache[narayana_key] = (
_narayana_start_dates(int(asc), planets, birth_date, lo, hi)
_narayana_start_dates(int(asc), planets, candidate_date, lo, hi)
if isinstance(asc, int) and isinstance(planets, dict)
else None
)