fix(rectification): honor persisted probe focus
Independent Staging Quality Gate / validate (push) Successful in 14m51s
Independent Staging Quality Gate / publish (push) Successful in 17m0s

This commit is contained in:
Jesse_Chen
2026-08-26 22:17:15 +08:00
parent 60cbe8a75e
commit 7d6b88c886
7 changed files with 122 additions and 32 deletions
+39
View File
@@ -410,6 +410,45 @@ class EventProbesTest(unittest.TestCase):
self.assertEqual(row["source"], "dasha_boundary")
self.assertGreater(row["information_gain"], 0)
def test_relationship_boundary_starts_at_adult_age_band(self) -> None:
from unittest.mock import patch
from scripts.rectification import event_probes as probes_mod
built = {
"static_contexts": [
_context("05:13", d4_asc=1, sun_house=4, sun_varga_sign=3, d9_asc=1, moon=100.0),
_context("05:40", d4_asc=1, sun_house=4, sun_varga_sign=3, d9_asc=2, moon=101.0),
]
}
def fake_vim(_birth_date: str, moon: float, _lo: int, _hi: int) -> list[int]:
return [2003, 2019] if moon <= 100.0 else [2002, 2018]
def fake_narayana(_asc: int, planets: dict, _birth_date: str, _lo: int, _hi: int) -> list[int]:
moon = float(planets.get("Moon") or 0)
return [2003, 2019] if moon <= 100.0 else [2002, 2018]
def fake_score(context: dict, *, birth_date: str, domain: str, year: int) -> dict:
del birth_date, domain, year
return {
"rule_ids": ["vim_md_domain_house"]
if probes_mod._context_time(context) == "05:13"
else ["no_domain_activation"]
}
with (
patch.object(probes_mod, "_vim_start_years", side_effect=fake_vim),
patch.object(probes_mod, "_narayana_start_years", side_effect=fake_narayana),
patch.object(probes_mod, "_score_year", side_effect=fake_score),
):
probes = _probes(_request(), built, ["05:13", "05:40"], "05:13")
relationship = [item for item in probes if item["domain"] == "relationship"]
self.assertTrue(relationship)
self.assertTrue(all(item["year"] >= 2018 for item in relationship))
self.assertFalse(any(item["year"] in {2002, 2003} for item in relationship))
if __name__ == "__main__":
unittest.main()