fix: restore upstream sync consultation contracts
Independent Staging Quality Gate / validate (push) Successful in 9m48s
Independent Staging Quality Gate / publish (push) Successful in 2m1s

This commit is contained in:
Jesse_Chen
2026-09-04 11:03:59 +08:00
parent 779717f48c
commit 4ee79210ef
10 changed files with 241 additions and 62 deletions
+22 -2
View File
@@ -22,7 +22,7 @@ def _handler() -> JyotishAPIHandler:
return JyotishAPIHandler.__new__(JyotishAPIHandler)
def _stub_consultation_runtime(monkeypatch, handler: JyotishAPIHandler) -> None:
def _stub_consultation_runtime(monkeypatch, handler: JyotishAPIHandler, *, include_strict_contracts: bool = True) -> None:
chart = {
"success": True,
"birth_info": {"date": "1997-08-08", "time": "05:00", "tz": 8},
@@ -34,7 +34,7 @@ def _stub_consultation_runtime(monkeypatch, handler: JyotishAPIHandler) -> None:
"strict_workflow_contracts": {
domain: {"status": "available", "domain": domain}
for domain in CANONICAL_DOMAINS
}
} if include_strict_contracts else {}
}
},
}
@@ -109,6 +109,26 @@ def test_complete_consultation_workflow_handles_every_canonical_domain(
assert "No general-theme fallback" in domain_report["boundary"]
@pytest.mark.parametrize("domain", ["education", "migration", "family", "annual", "timing", "general"])
def test_non_native_domains_reuse_server_route_contract_without_engine_snapshot(
monkeypatch,
domain: str,
) -> None:
handler = _handler()
_stub_consultation_runtime(monkeypatch, handler, include_strict_contracts=False)
result = handler._compute_consultation_workflow({
"entry_mode": "direct_chart", "question": domain, "theme": [domain],
"year": 2000, "month": 1, "day": 1, "hour": 12, "minute": 0,
"lat": 0.0, "lon": 0.0, "tz": 0.0, "western_mode": False,
"defer_optional_external_evidence": True,
})
report = result["thematic_report"]["themes"][domain]
assert report["status"] == "degraded"
assert report["thematic_adapter"]["upstream_contract_available"] is True
@pytest.mark.parametrize("domain", CANONICAL_DOMAINS)
def test_versioned_plan_domains_execute_their_declared_route_not_the_question_text_route(
monkeypatch,
+22 -40
View File
@@ -1105,20 +1105,21 @@ def test_derive_yogi_wealth_support_detects_strong_native_hook() -> None:
}
support = _derive_yogi_wealth_support(modules)
assert support is not None
assert support["level"] == "strong"
assert support["level"] == "weak"
assert support["source"] == "yogi_asc_tight_orb_wealth"
assert support["yogi_planet"] == "Venus"
assert support["duplicate_yogi"] == "Mars"
assert support["avayogi"] == "Saturn"
assert support["yogi_point_house"] == 1
assert support["tight_orb_hits"] == ["lagna_yogi_tight_orb"]
assert support["wealth_lord_links"] == ["yogi_planet_is_2l"]
assert support["formula_profile"] == "pyjhora_yogi_sphuta_v1"
assert support["yogi_planet"] == "Mercury"
assert support["duplicate_yogi"] == "Moon"
assert support["avayogi"] == "Mars"
assert support["yogi_point_longitude"] == 113.3333
assert support["avayogi_point_longitude"] == 300.0
assert support["yogi_point_nakshatra"] == "Ashlesha"
assert support["yogi_point_house"] == 4
assert support["lagna_yogi_distance_deg"] == 93.3333
assert support["tight_orb_hits"] == []
assert support["wealth_lord_links"] == []
assert support["risk_flags"] == []
assert support["signals"] == [
"yogi_planet_in_wealth_house",
"yogi_planet_is_2l",
"lagna_yogi_tight_orb",
]
assert support["signals"] == []
def test_wealth_folding_dhana_keeps_yogi_quiet_when_native_support_is_weak() -> None:
@@ -1165,11 +1166,10 @@ def test_wealth_folding_adds_native_yogi_support_only_when_base_promise_exists()
}
res = _derive_wealth_promise_strength(modules)
assert res["level"] == "moderate"
assert res["primary_source"] == "dhana_yogi_hooks"
assert res["source_diversity"] == 2
assert res["supporting_sources"] == ["dhana", "yogi"]
assert res["yogi_support"]["level"] == "strong"
assert res["yogi_support"]["wealth_lord_links"] == ["yogi_planet_is_2l"]
assert res["primary_source"] == "dhana_yogas"
assert res["source_diversity"] == 1
assert res["supporting_sources"] == ["dhana"]
assert res["yogi_support"] is None
def test_wealth_folding_yogi_only_is_blocked_without_base_promise() -> None:
@@ -1227,31 +1227,13 @@ def test_collect_strict_evidence_finance_adds_native_yogi_hook_without_external_
strict = _collect_strict_evidence("finance", result)
assert strict["present_evidence"]["wealth_promise_strength"] == {
"level": "moderate",
"primary_source": "dhana_yogi_hooks",
"primary_source": "dhana_yogas",
"count": 1,
"source_diversity": 2,
"supporting_sources": ["dhana", "yogi"],
"yogi_support": {
"avayogi": "Saturn",
"duplicate_yogi": "Mars",
"lagna_yogi_distance_deg": 0.0,
"level": "strong",
"risk_flags": [],
"signals": [
"yogi_planet_in_wealth_house",
"yogi_planet_is_2l",
"lagna_yogi_tight_orb",
],
"source": "yogi_asc_tight_orb_wealth",
"tight_orb_hits": ["lagna_yogi_tight_orb"],
"wealth_lord_links": ["yogi_planet_is_2l"],
"yogi_planet": "Venus",
"yogi_point_house": 1,
"yogi_point_longitude": 20.0,
"yogi_point_nakshatra": "Bharani",
},
"source_diversity": 1,
"supporting_sources": ["dhana"],
"yogi_support": None,
}
assert "yogi_active" in strict["event_judgement"]["secondary_context"]
assert "yogi_active" not in strict["event_judgement"]["secondary_context"]
def test_collect_strict_evidence_finance_keeps_native_yogi_quiet_when_support_is_weak() -> None: