Files
Jyotisha/tests/test_finance_delivery_integrity.py
ClaudeandClaude Opus 5.5 c9953c05f2 sync(upstream): port astrologer branch d09feab7 (public-sync-20261107) calculation changes
Product 2026-11-07: sync the astrologer's working branch (ea2a9d65..d09feab7).

- 0266b6ad: year lord picks by the native five-fold Panchavargiya only; a
  PyJHora score (research switch) is attached per candidate as
  external_oracle_comparison (observation_only_not_selection_input) and
  never selects. panchavargiya_selection_policy on the result; candidate_list
  and the reader-report candidate table carry the five components and raw total.
  The legacy Sun/Mars/Saturn table relabel is not applicable: calc_sodhita_av
  was already removed here (BUG-1209).
- 8c4bff8a + a5b75886: Sodhita no longer votes in finance adjudication; the
  bridge keeps raw 2/11 scores with prediction_scoring_allowed false.
- ba8e36ec: finance delivery inventory (raw, no vote), wrapped producer status
  counts as blocked in machine-evidence sections, transit section, report gate
  evidence_claims bindings, finance support review readiness.
- 5962368d: dispositor chain dispositor_sign is the dispositor's own sign.
- 8813c851: BCP observed at the reading date (bcp_reference, PL9 row).
- d09feab7: nakshatra_advanced.calculate_stellar_jeeva_sareera and the
  nadi-stellar-roles CLI; specialized-jyotish SKILL.md, usage packs, ontology
  and gap scanner mirrored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-07 20:03:44 +08:00

79 lines
3.9 KiB
Python

from copy import deepcopy
import pytest
from scripts.finance_astrology_support_review import (
build_finance_astrology_support_review, build_finance_delivery_inventory,
)
from scripts.full_report_quality_gate import evaluate_evidence_claims, evaluate_full_report
from scripts.unified_consultation_orchestrator import UnifiedConsultationOrchestrator
@pytest.mark.parametrize("status", ["blocked", "missing", "error", "failed",
"not_executed", "not_applicable", "not_available_yet"])
def test_unavailable_narayana_cannot_become_available_by_wrapping(status):
packet = UnifiedConsultationOrchestrator().machine_evidence_packet(
chart={"modules": {"narayana_dasha": {"status": status, "reason": "fixture"}}},
route_packet={"question_type": "finance"})
review = build_finance_astrology_support_review(
route_packet={"question_type": "finance"}, machine_evidence_packet=packet,
runtime_evidence_log={})
assert review["coverage"]["narayana"] == "blocked"
assert "narayana_dasha" in packet["missing_sections"]
def test_actual_native_sections_reach_finance_review():
chart = {"modules": {
"varga_full": {"D11_Rudramsa": {"fixture": True}, "D4_Turyamsa": {"fixture": True}},
"narayana_dasha": {"periods": [{"sign": "Leo"}]},
"transit_multi_reference": {"status": "blocked"},
}}
packet = UnifiedConsultationOrchestrator().machine_evidence_packet(
chart=chart, route_packet={"question_type": "finance"})
assert packet["sections"]["D11"]["status"] == "used"
assert packet["sections"]["D4"]["status"] == "used"
review = build_finance_astrology_support_review(
route_packet={"question_type": "finance"}, machine_evidence_packet=packet,
runtime_evidence_log={})
assert review["coverage"]["narayana"] == "present"
assert review["coverage"]["transit"] == "blocked"
assert review["readiness"] == "incomplete"
def test_arbitration_is_not_a_narayana_execution_receipt():
review = build_finance_astrology_support_review(
route_packet={"question_type": "finance"}, machine_evidence_packet={},
runtime_evidence_log={"cross_system_arbitration": {"status": "used"}})
assert review["coverage"]["narayana"] == "missing"
assert review["audit_rows"][0]["effect_on_confidence"] == "incomplete"
def test_delivery_preserves_raw_without_promoting_or_mutating():
modules = {"argala": {"status": "blocked", "candidate": [1]},
"dispositor_chains": {"chain": ["Mercury", "Jupiter"]}}
original = deepcopy(modules)
inventory = build_finance_delivery_inventory(modules)
rows = {r["technique"]: r for r in inventory["rows"]}
assert rows["argala"]["delivery_status"] == "producer_status_blocked"
assert rows["sudasa"]["delivery_status"] == "not_delivered"
assert rows["dispositor_chains"]["execution_status"] == "not_verified_by_inventory"
rows["argala"]["raw"]["candidate"].append(2)
assert modules == original
def test_conflicting_claim_binding_blocks_gate():
packet = {"points": {"A11": "Leo"}, "evidence_claims": [
{"path": ["points", "A11"], "value": "Taurus"}]}
assert evaluate_evidence_claims(packet)["errors"] == ["claim_0:value_mismatch"]
assert "evidence_claim_bindings_invalid" in evaluate_full_report(packet)["blocking_reasons"]
packet["evidence_claims"][0]["value"] = "Leo"
assert evaluate_evidence_claims(packet)["status"] == "bindings_match"
def test_missing_and_empty_bindings_never_claim_verification():
assert evaluate_evidence_claims({"evidence_claims": []})["status"] == "not_supplied"
assert evaluate_evidence_claims({})["status"] == "not_supplied"
for path, value in [(["absent"], 0), (["evidence_claims"], []), (["zero"], False)]:
packet = {"zero": 0, "evidence_claims": [{"path": path, "value": value}]}
assert evaluate_evidence_claims(packet)["status"] == "blocked"