merge codex/sync-latest-1107 into upstream-full integration
This commit is contained in:
@@ -6,6 +6,8 @@ description: "印度占星(Jyotish)专业解盘与推运系统。核心能
|
||||
|
||||
# 印度占星专业解盘与推运系统
|
||||
|
||||
九星大运主星三段说明:使用 `references/mahadasha_editorial_bilingual.json`,先读 `references/mahadasha_editorial_policy.md`。这是通用双语编辑参考,原典印刷版核定待补,不得按星名直接生成本盘吉凶或死亡/诊断断语。
|
||||
|
||||
> **版本**:v6.9.15 | **详细变更**:`CHANGELOG.md`
|
||||
> **对标状态**:中文用户端与技法覆盖领先;D1/D9/AV/Chara 等有守门,Dasha/Shadbala/Tajika 已进入分层证据治理阶段:部分 target-set / packet / source-bounded 链路已闭合,但 formal case admission、same-chart parity、production tuning 与 global oracle closure 仍不得过度宣称。
|
||||
>
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"generated_at": "2026-11-07T06:15:35Z",
|
||||
"mirror_files": [
|
||||
{
|
||||
"license": "MIT",
|
||||
"source": "SKILL.md",
|
||||
"source_sha256": "12deb0d59eb820a482c6b709c34658178529c82823ae2a54d0ca8bc12f8b7a5c",
|
||||
"status": "applied",
|
||||
"target": "references/upstream/yinduzhanxing/SKILL.md",
|
||||
"target_sha256_after": "12deb0d59eb820a482c6b709c34658178529c82823ae2a54d0ca8bc12f8b7a5c",
|
||||
"target_sha256_before": "5c1c0738fbe6f586fad36cfa13f602934dcea8f8d54c536655f6cb2091773d8d"
|
||||
}
|
||||
],
|
||||
"operator_review_required": true,
|
||||
"policy_version": 2,
|
||||
"privacy_scan": {
|
||||
"rejections": [],
|
||||
"scanned_files": 1,
|
||||
"status": "pass"
|
||||
},
|
||||
"protected_rejections": [],
|
||||
"schema_version": 1,
|
||||
"semantic_merge_files": [
|
||||
{
|
||||
"diff_summary": "manual semantic merge required: +3/-1 lines",
|
||||
"path": "SKILL.md",
|
||||
"source_sha256": "12deb0d59eb820a482c6b709c34658178529c82823ae2a54d0ca8bc12f8b7a5c",
|
||||
"status": "review_required",
|
||||
"target_sha256": "0d2fee541530552ea74bbbe35609c2102af7cb3949654524b0a4e2e4f7e590d6"
|
||||
},
|
||||
{
|
||||
"diff_summary": "manual semantic merge required: +236/-175 lines",
|
||||
"path": "AGENTS.md",
|
||||
"source_sha256": "416de759e0eeb6626c7d9225346fd9f56d534ddbfe3933a1f72011286c865481",
|
||||
"status": "review_required",
|
||||
"target_sha256": "521292fa13037bc06f08c7cc002f506c3f0651eb4c9f2da55290969a8c615594"
|
||||
},
|
||||
{
|
||||
"diff_summary": "manual semantic merge required: +0/-0 lines",
|
||||
"path": "references/strict-workflow-router.md",
|
||||
"source_sha256": "a0bb91ba04bfb1218fa494ec07011c271e073fa9cac4e6f16fe05157554e9a96",
|
||||
"status": "unchanged",
|
||||
"target_sha256": "a0bb91ba04bfb1218fa494ec07011c271e073fa9cac4e6f16fe05157554e9a96"
|
||||
},
|
||||
{
|
||||
"diff_summary": "manual semantic merge required: +700/-385 lines",
|
||||
"path": "scripts/unified_consultation_orchestrator.py",
|
||||
"source_sha256": "2c836861bc0132dee035050ecb4ae14ab9215140d2559086f0d3728c80e546fe",
|
||||
"status": "review_required",
|
||||
"target_sha256": "d249528a9f281917c6b895d198053cc81fb0c7d06666302658b11ef79495e7c3"
|
||||
},
|
||||
{
|
||||
"diff_summary": "manual semantic merge required: +83/-141 lines",
|
||||
"path": "scripts/report_orchestrator.py",
|
||||
"source_sha256": "27956a632793735ec660da312b66be967a35c0345edab90b8efe4a65663e4262",
|
||||
"status": "review_required",
|
||||
"target_sha256": "0fb80002561a6718088eceed0b20df2a8faa0adbc222756fadf8cd158a6957a6"
|
||||
},
|
||||
{
|
||||
"diff_summary": "manual semantic merge required: +10085/-3562 lines",
|
||||
"path": "scripts/jyotish_api_server.py",
|
||||
"source_sha256": "654c4f7813aa7406587bb3aab1975865697b80b5f2deeb8edddbfe62cecdafc7",
|
||||
"status": "review_required",
|
||||
"target_sha256": "aa96c2e823ae0fe2204d0fccd18ab3a81161c0592d47ef32fb7cc7455e8f3098"
|
||||
}
|
||||
],
|
||||
"source_commit": "ea2a9d657451cd04615a3a7108dc92666dc8340c",
|
||||
"source_mode": "git",
|
||||
"source_repository": "732642856/yinduzhanxing",
|
||||
"source_repository_url": "https://github.com/732642856/yinduzhanxing",
|
||||
"source_skill_sha256": "12deb0d59eb820a482c6b709c34658178529c82823ae2a54d0ca8bc12f8b7a5c",
|
||||
"source_tree_hash": "392de36df201cc3bae1a2f85522ca4b5d82738593578a7f9c8b5aa1543da1f64",
|
||||
"target_base_commit": "54f4dce09da0c5366c52b22f275d73426bdf3d7d",
|
||||
"target_repository": "root/Jyotisha",
|
||||
"tests_run": []
|
||||
}
|
||||
@@ -6,6 +6,8 @@ description: 印度占星(Jyotish)专业解盘与推运系统。核心能力
|
||||
|
||||
# 印度占星专业解盘与推运系统
|
||||
|
||||
九星大运主星三段说明:使用 `references/mahadasha_editorial_bilingual.json`,先读 `references/mahadasha_editorial_policy.md`。这是通用双语编辑参考,原典印刷版核定待补,不得按星名直接生成本盘吉凶或死亡/诊断断语。
|
||||
|
||||
> **版本**:v6.9.15 | **详细变更**:`CHANGELOG.md`
|
||||
> **对标状态**:中文用户端与技法覆盖领先;D1/D9/AV/Chara 等有守门,Dasha/Shadbala/Tajika 已进入分层证据治理阶段:部分 target-set / packet / source-bounded 链路已闭合,但 formal case admission、same-chart parity、production tuning 与 global oracle closure 仍不得过度宣称。
|
||||
>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"schema_version": 1,
|
||||
"source_repository": "732642856/yinduzhanxing",
|
||||
"source_repository_url": "https://github.com/732642856/yinduzhanxing",
|
||||
"source_commit": "5fb8379c4f3e649cb4804065c9a3059e4bf633fe",
|
||||
"source_tree_sha256": "ee8bd9865cf11a6eb7f90705a262db8b2d145ae0cee6ee6eda32b311548f5aa2",
|
||||
"boundary": "Tenth sync: git-mode snapshot 5fb8379c, upstream main HEAD on 2026-11-04. The nine plan sources below still exist at that commit. The importer still mirrors only the pinned upstream root SKILL.md under references/upstream; none of these research scripts is copied into the commercial runtime. Semantic-merge destinations remain review-only except for files this commercial round copies by hand.",
|
||||
"source_commit": "ea2a9d657451cd04615a3a7108dc92666dc8340c",
|
||||
"source_tree_sha256": "392de36df201cc3bae1a2f85522ca4b5d82738593578a7f9c8b5aa1543da1f64",
|
||||
"boundary": "Eleventh sync: git-mode snapshot ea2a9d65, upstream main HEAD on 2026-11-07. The nine plan sources below still exist at that commit. The importer still mirrors only the pinned upstream root SKILL.md under references/upstream; none of these research scripts is copied into the commercial runtime. Semantic-merge destinations remain review-only except for files this commercial round copies by hand.",
|
||||
"entries": [
|
||||
{
|
||||
"source": "scripts/evidence_maturity.py",
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"boundary": "Git source 5fb8379c4f3e649cb4804065c9a3059e4bf633fe is upstream main HEAD on 2026-11-04 (no upstream commits after it). Tenth sync on 2026-11-04 re-mirrors only root SKILL.md into this directory with scripts/import_yinduzhanxing.py --apply from a clean clone; commercial and rectification Skills remain protected. skill_sha256 is retained as a legacy alias of source_skill_sha256. Semantic-merge paths were reviewed by the importer and not overwritten. The previous mirror b9a0ef8f (rewritten upstream; commit time matches dc3b8fef) keeps its import record under references/cross_project_contract/imports as history. Engine content between dc3b8fef and 5fb8379c was ported semantically in syncs 8, 9 and 9b and is not implied by this mirror.",
|
||||
"boundary": "Git source ea2a9d657451cd04615a3a7108dc92666dc8340c is upstream main HEAD on 2026-11-07. Eleventh sync on 2026-11-07 re-mirrors only root SKILL.md into this directory with scripts/import_yinduzhanxing.py --apply from a clean clone; commercial and rectification Skills remain protected. skill_sha256 is retained as a legacy alias of source_skill_sha256. Semantic-merge paths were reviewed by the importer and not overwritten. The previous mirror 5fb8379c keeps its import record under references/cross_project_contract/imports as history. Engine content between 5fb8379c and ea2a9d65 was ported semantically in the 2026-11-07 sync and is not implied by this mirror.",
|
||||
"import_policy_version": 2,
|
||||
"imported_at": "2026-11-04T04:00:00Z",
|
||||
"imported_at": "2026-11-07T08:00:00Z",
|
||||
"license": "MIT",
|
||||
"schema_version": 1,
|
||||
"skill_sha256": "5c1c0738fbe6f586fad36cfa13f602934dcea8f8d54c536655f6cb2091773d8d",
|
||||
"source_commit": "5fb8379c4f3e649cb4804065c9a3059e4bf633fe",
|
||||
"source_committed_at": "2026-10-21T15:49:21Z",
|
||||
"source_git_tree": "6cd6160804ea7419d609ccd639cc537a8a81c3c9",
|
||||
"skill_sha256": "12deb0d59eb820a482c6b709c34658178529c82823ae2a54d0ca8bc12f8b7a5c",
|
||||
"source_commit": "ea2a9d657451cd04615a3a7108dc92666dc8340c",
|
||||
"source_committed_at": "2026-11-07T06:15:35Z",
|
||||
"source_git_tree": "74dc6abef1d6cc1c62c3b0269714772539cf5f00",
|
||||
"source_mode": "git",
|
||||
"source_repository": "732642856/yinduzhanxing",
|
||||
"source_repository_url": "https://github.com/732642856/yinduzhanxing",
|
||||
"source_skill_sha256": "5c1c0738fbe6f586fad36cfa13f602934dcea8f8d54c536655f6cb2091773d8d",
|
||||
"source_tree_sha256": "ee8bd9865cf11a6eb7f90705a262db8b2d145ae0cee6ee6eda32b311548f5aa2"
|
||||
"source_skill_sha256": "12deb0d59eb820a482c6b709c34658178529c82823ae2a54d0ca8bc12f8b7a5c",
|
||||
"source_tree_sha256": "392de36df201cc3bae1a2f85522ca4b5d82738593578a7f9c8b5aa1543da1f64"
|
||||
}
|
||||
|
||||
@@ -182,7 +182,8 @@ def _question_contract(question_id: str, sensitivity: list[str]) -> dict[str, An
|
||||
"primary_varga": primary_varga,
|
||||
"event_categories": event_categories,
|
||||
"dasha_tracks": dasha_tracks,
|
||||
"reason": str(base.get("reason") or ""),
|
||||
"reason": "主题与待核验技法的关联,不代表技法已执行或该回答能排除出生时间。",
|
||||
"execution_status": "not_executed_by_template",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -423,6 +424,8 @@ def build_questionnaire(
|
||||
"sensitivity": sensitivity,
|
||||
"window": window,
|
||||
"prompt": prompt,
|
||||
"question_basis": "generic_interview_template",
|
||||
"timing_claim_status": "not_individually_calculated",
|
||||
"options": OPTIONS,
|
||||
"positive_cluster": yes_bias,
|
||||
"negative_cluster": no_bias,
|
||||
@@ -437,6 +440,16 @@ def build_questionnaire(
|
||||
"fine_timing": 0.45,
|
||||
}.get(domain, 0.75),
|
||||
**contract,
|
||||
"why_this_question": [
|
||||
"为什么问:先确认这类经历是否存在、是否容易回忆,供后续实际候选盘与事件核验使用。",
|
||||
"模板年龄段不是个人应期;回答本身不提高、排除或确认任何出生时间。",
|
||||
],
|
||||
"answer_impact": {
|
||||
"A": "记录经历并进一步核实日期,暂不缩小出生时间范围。",
|
||||
"B": "记录实际时间与描述,不把时间不吻合算作命中。",
|
||||
"C": "记录未发生,不凭模板排除候选。",
|
||||
"D": "保留未知状态,换一个更容易回答的问题。",
|
||||
},
|
||||
"scoring_map": {
|
||||
"A": {"effect": "support", "cluster": yes_bias, "points": 2},
|
||||
"B": {"effect": "weak_support", "cluster": yes_bias, "points": 1},
|
||||
@@ -461,6 +474,7 @@ def build_questionnaire(
|
||||
selection = select_next_questions(selector_payload, {}, limit=1)
|
||||
return {
|
||||
"scope": "active_birth_time_rectification_questionnaire",
|
||||
"calculation_profile": {"ayanamsa": ayanamsa, "node_mode": node_mode},
|
||||
"schema_version": 1,
|
||||
"candidate_scan": candidate_scan,
|
||||
"calculation": {"ayanamsa": ayanamsa, "node_mode": node_mode}, # LOCAL
|
||||
@@ -595,7 +609,8 @@ def score_answers(
|
||||
),
|
||||
"claim_status": "candidate",
|
||||
"truth_status": "not_birth_time_truth",
|
||||
"confidence_cap": "low" if downgrade_reasons else "medium",
|
||||
"confidence_cap": "low",
|
||||
"score_purpose": "interview_topic_priority_not_birth_time_likelihood",
|
||||
"conflict_policy": (
|
||||
"downgrade_without_replacement"
|
||||
if downgrade_reasons
|
||||
@@ -618,20 +633,17 @@ def score_answers(
|
||||
candidate_scan = questionnaire.get("candidate_scan") if isinstance(questionnaire.get("candidate_scan"), dict) else {}
|
||||
minute_scan = candidate_scan.get("minute_scan") if isinstance(candidate_scan, dict) and isinstance(candidate_scan.get("minute_scan"), dict) else None
|
||||
if isinstance(minute_scan, dict) and isinstance(minute_scan.get("rows"), list):
|
||||
regression_hint = candidate_scan.get("regression_hint") if isinstance(candidate_scan, dict) else None
|
||||
target_minute = str((regression_hint or {}).get("target_minute") or "")
|
||||
for row in minute_scan["rows"]:
|
||||
if not isinstance(row, dict):
|
||||
continue
|
||||
score = float(row.get("sensitivity_count") or 0)
|
||||
if target_minute and str(row.get("time") or "").endswith(target_minute):
|
||||
score += 5.0
|
||||
minute_rankings.append(
|
||||
{
|
||||
"time": row.get("time"),
|
||||
"score": round(score, 3),
|
||||
"sensitivity_count": row.get("sensitivity_count"),
|
||||
"sensitive_layers": row.get("sensitive_layers"),
|
||||
"purpose": "question_selection_only_not_birth_time_likelihood",
|
||||
}
|
||||
)
|
||||
minute_rankings.sort(key=lambda item: (-float(item["score"]), str(item["time"])))
|
||||
@@ -651,6 +663,7 @@ def score_answers(
|
||||
"answered_count": len(applied),
|
||||
"workflow_status": workflow_status,
|
||||
"can_apply": False,
|
||||
"can_narrow_from_template_scores": False,
|
||||
"required_next_evidence": (
|
||||
None
|
||||
if next_questions
|
||||
@@ -664,11 +677,13 @@ def score_answers(
|
||||
"technique_audit_table": [
|
||||
{
|
||||
"technique": "Vimshottari Rectification",
|
||||
"status": "used",
|
||||
"role": "primary_candidate_cluster_scoring",
|
||||
"status": "blocked",
|
||||
"role": "requires_executed_candidate_event_timing",
|
||||
"boundary": "Template answer points do not execute Vimshottari or establish candidate birth-time likelihood.",
|
||||
},
|
||||
{
|
||||
"technique": "Narayana Dasha Rectification",
|
||||
"execution_status": "external_scores_supplied_unverified" if narayana_cross_scores else "blocked",
|
||||
"status": "partial",
|
||||
"role": "cross_check_downgrade_only",
|
||||
"conflict_policy": "downgrade_without_replacement",
|
||||
@@ -676,6 +691,7 @@ def score_answers(
|
||||
},
|
||||
{
|
||||
"technique": "Jaimini Karaka Rectification",
|
||||
"execution_status": "external_scores_supplied_unverified" if jaimini_karaka_cross_scores else "blocked",
|
||||
"status": "partial",
|
||||
"role": "cross_check_downgrade_only",
|
||||
"conflict_policy": "downgrade_without_replacement",
|
||||
@@ -683,6 +699,7 @@ def score_answers(
|
||||
},
|
||||
{
|
||||
"technique": "Vimsopaka Avastha Rectification",
|
||||
"execution_status": "external_scores_supplied_unverified" if vimsopaka_avastha_cross_scores else "blocked",
|
||||
"status": "partial",
|
||||
"role": "cross_check_downgrade_only",
|
||||
"conflict_policy": "downgrade_without_replacement",
|
||||
@@ -690,6 +707,7 @@ def score_answers(
|
||||
},
|
||||
{
|
||||
"technique": "Shadbala Ashtakavarga Rectification",
|
||||
"execution_status": "external_scores_supplied_unverified" if shadbala_av_observation_scores else "blocked",
|
||||
"status": "partial_observation",
|
||||
"role": "observation_downgrade_only",
|
||||
"weight_policy": "low_weight_only",
|
||||
@@ -698,6 +716,7 @@ def score_answers(
|
||||
},
|
||||
{
|
||||
"technique": "Gochara Transit Rectification",
|
||||
"execution_status": "external_scores_supplied_unverified" if gochara_transit_observation_scores else "blocked",
|
||||
"status": "blocked_from_verified_timing",
|
||||
"role": "observation_downgrade_only",
|
||||
"holdout_gate": "negative_holdout_required",
|
||||
@@ -713,7 +732,7 @@ def score_answers(
|
||||
"applied_scoring": applied,
|
||||
"unknown_question_ids": unknown_ids,
|
||||
"invalid_answers": invalid_answers,
|
||||
"boundary": "This narrows candidate clusters only; Narayana is a downgrade-only cross-check and does not convert candidates into birth-time truth.",
|
||||
"boundary": "Template scoring prioritizes interview topics only, does not narrow the birth-time interval, and does not convert candidates into birth-time truth.",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -225,7 +225,10 @@ def select_next_questions(questionnaire: dict[str, Any], answers: dict[str, str]
|
||||
question = question_by_id.get(str(question_id))
|
||||
if not question:
|
||||
continue
|
||||
answered[str(question_id)] = str(choice or "").strip().upper()
|
||||
normalized_choice = str(choice or "").strip().upper()
|
||||
if normalized_choice not in {"A", "B", "C", "D"}:
|
||||
continue
|
||||
answered[str(question_id)] = normalized_choice
|
||||
domain = str(question.get("domain") or "")
|
||||
prior_domain_counts[domain] = prior_domain_counts.get(domain, 0) + 1
|
||||
|
||||
@@ -290,6 +293,8 @@ def select_next_questions(questionnaire: dict[str, Any], answers: dict[str, str]
|
||||
"id": question["id"],
|
||||
"domain": domain,
|
||||
"prompt": question.get("prompt"),
|
||||
"question_basis": question.get("question_basis", "unspecified"),
|
||||
"timing_claim_status": question.get("timing_claim_status", "not_verified"),
|
||||
"why_asked": list(question.get("why_this_question") or []),
|
||||
"candidate_ids_distinguished": [str(question.get("positive_cluster") or ""), str(question.get("negative_cluster") or "")],
|
||||
"technique_routes": list(question.get("sensitivity") or []),
|
||||
|
||||
@@ -16,6 +16,26 @@ KARAKA_POINTS = (60, 45, 30, 22.5, 15, 7.5, 3.75)
|
||||
MALEFICS = ('Sun', 'Mars', 'Saturn', 'Rahu', 'Ketu')
|
||||
|
||||
|
||||
def goel_evidence_fields(planet_longitudes, ascendant_longitude):
|
||||
"""Shared CLI/API field mapping; invalid positions never produce selectors."""
|
||||
try:
|
||||
evidence = build_goel_chart_evidence(planet_longitudes, ascendant_longitude)
|
||||
result = {
|
||||
'goel_full_strength': evidence['strength'],
|
||||
'goel_special_points': evidence['special_points'],
|
||||
}
|
||||
for key in ('lagna_seventh_strength', 'niryaana_shoola_strength'):
|
||||
if key in evidence:
|
||||
result[key] = evidence[key]
|
||||
return result
|
||||
except (KeyError, TypeError, ValueError) as exc:
|
||||
blocked = dict(status='blocked', reason=str(exc), profile_id=PROFILE)
|
||||
return {
|
||||
'goel_full_strength': dict(blocked),
|
||||
'goel_special_points': {name: dict(blocked) for name in ('Brahma', 'Maheshwara', 'Rudra')},
|
||||
}
|
||||
|
||||
|
||||
def calculate_goel_strength(planet_longitudes, *, node_occupancy_policy='include_nodes_text'):
|
||||
if node_occupancy_policy not in {'include_nodes_text', 'exclude_nodes_worked_example'}:
|
||||
raise ValueError('explicit Goel node occupancy policy required')
|
||||
|
||||
@@ -7347,6 +7347,14 @@ class JyotishComputeService(VedastroEvidenceMixin, SynastryMixin):
|
||||
result['rangacharya_diff'] = rangacharya.diff_current_vs_rangacharya(current_arudha, rangacharya_result)
|
||||
if mode in ('all', 'special'):
|
||||
result['special_lagnas'] = jaimini.calc_special_lagnas(asc_sign_idx, hour, minute + second / 60.0)
|
||||
# Upstream bb26dc2d: same Goel producer and fields as the engine CLI.
|
||||
# Goel uses the sign only, but a missing Ascendant is not Aries.
|
||||
asc_input = body.get('ascendant') or {}
|
||||
has_ascendant = body.get('asc_lon') is not None or (isinstance(asc_input, dict) and any(
|
||||
asc_input.get(key) is not None for key in ('lon', 'degree_raw', 'sign', 'sign_idx')
|
||||
))
|
||||
result.update(_load_local_module('goel_jaimini_strength').goel_evidence_fields(
|
||||
planet_lons, float(asc_sign_idx * 30) if has_ascendant else None))
|
||||
return {
|
||||
'success': True,
|
||||
'endpoint': 'jaimini',
|
||||
@@ -7903,6 +7911,9 @@ class JyotishComputeService(VedastroEvidenceMixin, SynastryMixin):
|
||||
raise BadRequest('step_minutes must be between 1 and 30')
|
||||
lat = lon = tz = None
|
||||
if any(key in body for key in ('lat', 'lon', 'tz')):
|
||||
# Upstream 7b43eaf2: a partial location must not fall back to 0.
|
||||
if any(body.get(key) is None for key in ('lat', 'lon', 'tz')):
|
||||
raise BadRequest('lat, lon, and tz must be supplied together')
|
||||
lat = self._get_float(body, 'lat', 0, -90, 90)
|
||||
lon = self._get_float(body, 'lon', 0, -180, 180)
|
||||
tz = self._get_float(body, 'tz', 0, -14, 14)
|
||||
@@ -7977,6 +7988,9 @@ class JyotishComputeService(VedastroEvidenceMixin, SynastryMixin):
|
||||
datetime.strptime(end_time, '%H:%M')
|
||||
except ValueError as exc:
|
||||
raise BadRequest('birth date or candidate time has invalid format') from exc
|
||||
# Upstream 7b43eaf2: never score events at a default (0, 0, UTC) place.
|
||||
if any(body.get(key) is None for key in ('lat', 'lon', 'tz')):
|
||||
raise BadRequest('lat, lon, and tz are required for event rectification')
|
||||
lat = self._get_float(body, 'lat', 0, -90, 90)
|
||||
lon = self._get_float(body, 'lon', 0, -180, 180)
|
||||
tz = self._get_float(body, 'tz', 0, -14, 14)
|
||||
|
||||
@@ -115,11 +115,20 @@ def _component_totals(planet: dict[str, Any]) -> dict[str, float]:
|
||||
}
|
||||
|
||||
|
||||
def _local_shadbala_planets(result: dict[str, Any]) -> dict[str, Any]:
|
||||
view = (result.get('engine_views') or {}).get('local_legacy') or {}
|
||||
planets = view.get('planets') if view else result.get('planets')
|
||||
if not planets or any(not isinstance(row.get('sthana_bala'), dict) for row in planets.values()):
|
||||
raise ValueError('Local Shadbala component details unavailable; cannot audit canonical sidecar as native')
|
||||
return planets
|
||||
|
||||
|
||||
def _audit_shadbala_case(case: dict[str, Any]) -> dict[str, Any]:
|
||||
args = _namespace_from_birth(case["birth"])
|
||||
result = engine.cmd_shadbala(args)
|
||||
if "error" in result:
|
||||
raise RuntimeError(result["error"])
|
||||
local_planets = _local_shadbala_planets(result)
|
||||
|
||||
target = case.get("target", {})
|
||||
component_targets = target.get("component_targets")
|
||||
@@ -135,7 +144,7 @@ def _audit_shadbala_case(case: dict[str, Any]) -> dict[str, Any]:
|
||||
|
||||
totals: dict[str, Any] = {}
|
||||
for name in SHADBALA_PLANETS:
|
||||
planet = result.get("planets", {}).get(name, {})
|
||||
planet = local_planets.get(name, {})
|
||||
if not planet:
|
||||
continue
|
||||
totals[name] = {
|
||||
@@ -295,12 +304,16 @@ def _template_shadbala_comparison(case: dict[str, Any]) -> dict[str, Any]:
|
||||
result = engine.cmd_shadbala(_namespace_from_template(case))
|
||||
if "error" in result:
|
||||
return {"status": "engine_error", "error": result["error"], "planets": {}}
|
||||
try:
|
||||
local_planets = _local_shadbala_planets(result)
|
||||
except ValueError as exc:
|
||||
return {'status': 'local_view_unavailable', 'error': str(exc), 'planets': {}}
|
||||
|
||||
rows: dict[str, Any] = {}
|
||||
scale_ratios: list[float] = []
|
||||
for planet in SHADBALA_PLANETS:
|
||||
external_row = target_components.get(planet, {})
|
||||
engine_row = result.get("planets", {}).get(planet, {})
|
||||
engine_row = local_planets.get(planet, {})
|
||||
engine_components = _component_totals(engine_row) if engine_row else {}
|
||||
external_total = external_row.get("total_rupa") if isinstance(external_row, dict) else None
|
||||
engine_total = round(float(engine_row.get("total_rupas", 0.0)), 4) if engine_row else None
|
||||
@@ -308,6 +321,8 @@ def _template_shadbala_comparison(case: dict[str, Any]) -> dict[str, Any]:
|
||||
if isinstance(external_row, dict):
|
||||
for external_name, engine_name in SHADBALA_COMPONENT_FIELD_MAP.items():
|
||||
engine_value = engine_components.get(engine_name)
|
||||
if isinstance(engine_value, (int, float)):
|
||||
engine_value = round(engine_value / 60.0, 4)
|
||||
external_value = external_row.get(external_name)
|
||||
tolerance = SHADBALA_COMPONENT_TOLERANCES_RUPA[external_name]
|
||||
delta = (
|
||||
@@ -331,6 +346,8 @@ def _template_shadbala_comparison(case: dict[str, Any]) -> dict[str, Any]:
|
||||
else None
|
||||
)
|
||||
rows[planet] = {
|
||||
'component_unit': 'rupa',
|
||||
'engine_components_unit': 'virupa',
|
||||
"engine_total_rupa": engine_total,
|
||||
"external_total_rupa": external_total,
|
||||
"total_rupa_delta": total_delta,
|
||||
@@ -346,6 +363,7 @@ def _template_shadbala_comparison(case: dict[str, Any]) -> dict[str, Any]:
|
||||
ratio_spread = round(max(scale_ratios) - min(scale_ratios), 6) if len(scale_ratios) >= 2 else None
|
||||
return {
|
||||
"status": "compared",
|
||||
"comparison_engine": "native_local",
|
||||
"unit": "rupa",
|
||||
"component_tolerances": SHADBALA_COMPONENT_TOLERANCES_RUPA,
|
||||
"total_tolerance_rupa": SHADBALA_TOTAL_TOLERANCE_RUPA,
|
||||
|
||||
@@ -127,6 +127,8 @@ CORE_PYTEST_TARGETS = [
|
||||
"tests/test_science_of_light_dasha.py",
|
||||
# Techniques ported from the astrologer's upstream skill (yinduzhanxing 5fb8379c).
|
||||
"tests/test_upstream_technique_layers.py",
|
||||
# 产品 2026-11-07 同步占星师上游 ea2a9d65 (Arudha lord profile, Drik readings, rectification guards).
|
||||
"tests/test_upstream_sync_ea2a9d65.py",
|
||||
"tests/test_naisargika_dasha.py",
|
||||
"tests/test_karaka_dasha.py",
|
||||
"tests/test_kaala_native.py",
|
||||
@@ -166,6 +168,7 @@ CORE_PYTEST_TARGETS = [
|
||||
"tests/test_run_quality_gate_output.py",
|
||||
"tests/test_upstream_git_import_b9a0ef8f.py",
|
||||
"tests/test_upstream_git_import_5fb8379c.py",
|
||||
"tests/test_upstream_git_import_ea2a9d65.py",
|
||||
"tests/test_interpretation_template_registry.py",
|
||||
"tests/test_vedastro_external_technique_evidence.py",
|
||||
# Self-hosted heading font slices: 6500-character coverage, no overlap, 120 KB cap.
|
||||
|
||||
@@ -17,7 +17,7 @@ if str(SCRIPT_DIR) not in sys.path:
|
||||
|
||||
import jyotish_engine # type: ignore
|
||||
from divisional_charts_extended import DivisionalChartsCalculator # type: ignore
|
||||
from oracle_boundary_audit import _load_oracle, _namespace_from_template # type: ignore
|
||||
from oracle_boundary_audit import _load_oracle, _namespace_from_template, _local_shadbala_planets # type: ignore
|
||||
from shadbala_sapta_dignity_whitelist import build_report as build_whitelist_report # type: ignore
|
||||
from varga import calc_varga # type: ignore
|
||||
|
||||
@@ -73,8 +73,10 @@ def build_report(oracle_file: str) -> dict[str, Any]:
|
||||
"sign": calc.SIGNS[int(d3_extended_abs // 30) % 12],
|
||||
}
|
||||
|
||||
sthana = ((result.get("planets") or {}).get(planet) or {}).get("sthana_bala") or {}
|
||||
engine_d3_score = float(sthana.get("sapta_d3", 0.0))
|
||||
sthana = _local_shadbala_planets(result)[planet]['sthana_bala']
|
||||
if 'sapta_d3' not in sthana:
|
||||
raise ValueError(f'Local D3 dignity detail missing: {planet}')
|
||||
engine_d3_score = float(sthana['sapta_d3'])
|
||||
dignity_bucket = _normalize_dignity_bucket(engine_d3_score)
|
||||
mapping_matches = d3_simple.get("sign") == d3_extended["sign"]
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ def _normalize_planet_rows(rows: dict[str, Any]) -> dict[str, Any]:
|
||||
component_rows = {}
|
||||
for component, component_row in (row.get("component_deltas") or {}).items():
|
||||
local_rupa = component_row.get("engine_rupa")
|
||||
if isinstance(local_rupa, (int, float)):
|
||||
if isinstance(local_rupa, (int, float)) and row.get('component_unit') != 'rupa':
|
||||
local_rupa = round(float(local_rupa) / VIRUPAS_PER_RUPA, 4)
|
||||
oracle_rupa = component_row.get("external_rupa")
|
||||
diff_rupa = (
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""Opt-in Shadbala reference calculations kept out of the frozen scoring files (ERR-110)."""
|
||||
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Drik Bala weighting readings of BPHS 27.19 (upstream yinduzhanxing a4b4b267).
|
||||
|
||||
Her a4b4b267 adds ``weighting_profile`` to ``calc_drik_bala_precise`` and a
|
||||
``compare_drik_profiles`` diagnostic. ``scripts/shadbala.py`` is in the
|
||||
rectification frozen identity (ERR-110), so the readings live here and call
|
||||
the frozen geometry and classification unchanged.
|
||||
|
||||
Defaults stay as recorded: geometry = BPHS 26.9-12 piecewise (BUG-1586),
|
||||
weighting = the quarter for every aspect (DRIK_MERCURY_JUPITER_CONVENTION,
|
||||
BUG-1623, astrologer has not ruled). The other two readings are explicit,
|
||||
diagnostic-only variants; they never enter totals or rankings.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
from decimal import ROUND_HALF_UP, Decimal
|
||||
from typing import Dict
|
||||
|
||||
# scripts/ on sys.path for the sibling shadbala module (as scripts/arudha_reference).
|
||||
_scripts_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if _scripts_dir not in sys.path:
|
||||
sys.path.insert(0, _scripts_dir)
|
||||
|
||||
import shadbala as _sb # noqa: E402 (read-only use; shadbala.py stays the default path)
|
||||
|
||||
DRIK_WEIGHTING_PROFILES = ("quarter_v1", "mercury_jupiter_full_replacement_v1",
|
||||
"santhanam27_literal_addition_v1")
|
||||
DRIK_GEOMETRY_PROFILES = ("bphs", "raman_gbb")
|
||||
|
||||
|
||||
def drik_aspect_contribution(strength: float, aspector: str, benefic: bool, *,
|
||||
weighting_profile: str = "quarter_v1") -> float:
|
||||
"""One aspect's signed share. Literal Santhanam 27.19 adds a positive full
|
||||
Mercury / Jupiter aspect after the signed quarter, so a malefic Mercury
|
||||
gives +0.75 of the aspect, not -1.25 (the sign stays disputed)."""
|
||||
if weighting_profile not in DRIK_WEIGHTING_PROFILES:
|
||||
raise ValueError(f"unknown Drik weighting profile: {weighting_profile}")
|
||||
if not math.isfinite(float(strength)) or strength < 0:
|
||||
raise ValueError("aspect strength must be finite and nonnegative")
|
||||
signed = strength if benefic else -strength
|
||||
if aspector in {"Mercury", "Jupiter"}:
|
||||
if weighting_profile == "mercury_jupiter_full_replacement_v1":
|
||||
return signed
|
||||
if weighting_profile == "santhanam27_literal_addition_v1":
|
||||
return signed / 4 + strength
|
||||
return signed / 4
|
||||
|
||||
|
||||
def calc_drik_bala_profiled(pname: str, all_planets: Dict, variant: str = "bphs", *,
|
||||
weighting_profile: str = "quarter_v1") -> float:
|
||||
"""Drik under an explicit weighting; ``quarter_v1`` is the frozen default."""
|
||||
if weighting_profile not in DRIK_WEIGHTING_PROFILES:
|
||||
raise ValueError(f"unknown Drik weighting profile: {weighting_profile}")
|
||||
if weighting_profile == "quarter_v1":
|
||||
return _sb.calc_drik_bala_precise(pname, all_planets, variant)
|
||||
if pname not in all_planets:
|
||||
return 0.0
|
||||
benefics, malefics = _sb.classify_drik_planets(all_planets, variant)
|
||||
target_lon = _sb._planet_longitude(pname, all_planets)
|
||||
total = Decimal(0)
|
||||
for other_name in sorted(benefics | malefics): # fixed order (BUG-1576)
|
||||
if other_name == pname:
|
||||
continue
|
||||
strength = _sb._sphuta_drishti_virupas(
|
||||
target_lon - _sb._planet_longitude(other_name, all_planets), other_name, variant)
|
||||
total += Decimal(str(drik_aspect_contribution(
|
||||
strength, other_name, other_name in benefics, weighting_profile=weighting_profile)))
|
||||
return float(total.quantize(Decimal("0.01"), rounding=ROUND_HALF_UP))
|
||||
|
||||
|
||||
def compare_drik_profiles(all_planets: Dict) -> Dict:
|
||||
"""Replay the disputed readings without changing production totals."""
|
||||
names = [n for n in ('Sun', 'Moon', 'Mars', 'Mercury', 'Jupiter', 'Venus', 'Saturn') if n in all_planets]
|
||||
baseline = {n: _sb.calc_drik_bala_precise(n, all_planets) for n in names}
|
||||
variants = []
|
||||
for geometry in DRIK_GEOMETRY_PROFILES:
|
||||
for weighting in DRIK_WEIGHTING_PROFILES:
|
||||
values = {n: calc_drik_bala_profiled(n, all_planets, geometry, weighting_profile=weighting)
|
||||
for n in names}
|
||||
variants.append({'aspect_profile': geometry, 'weighting_profile': weighting,
|
||||
'virupas': values,
|
||||
'delta_from_default': {n: round(values[n] - baseline[n], 2) for n in names}})
|
||||
return {'admission_state': 'diagnostic_only',
|
||||
'natural_classification': 'existing_classify_drik_planets_unchanged',
|
||||
'default': {'aspect_profile': 'bphs', 'weighting_profile': 'quarter_v1'},
|
||||
'variants': variants}
|
||||
@@ -621,6 +621,27 @@ def solar_return_full_report(
|
||||
result['tajika_yogas'] = {'error': str(e)}
|
||||
|
||||
# 5. Sahams(需完整星盘,降级模式跳过)
|
||||
# The annual API returns this report directly, unlike the enriched annual
|
||||
# pack. Expose existing structural evidence separately from the base
|
||||
# kernel's deliberately narrower support list. No event verdict is added.
|
||||
if degraded:
|
||||
result['tajika_named_yoga_structures'] = {
|
||||
'status': 'blocked', 'reason': 'annual_motion_inputs_unavailable',
|
||||
'rows': [], 'claim_boundary': 'no_event_verdict',
|
||||
}
|
||||
else:
|
||||
try:
|
||||
try:
|
||||
from tajika_named_yoga_authority import build_tajika_named_yoga_authority
|
||||
except ImportError:
|
||||
from scripts.tajika_named_yoga_authority import build_tajika_named_yoga_authority
|
||||
result['tajika_named_yoga_structures'] = build_tajika_named_yoga_authority(tajika_planets)
|
||||
except Exception as exc:
|
||||
result['tajika_named_yoga_structures'] = {
|
||||
'status': 'blocked', 'reason': str(exc), 'rows': [],
|
||||
'claim_boundary': 'no_event_verdict',
|
||||
}
|
||||
|
||||
if degraded:
|
||||
result['sahams'] = {'error': 'swisseph未安装,无法计算Sahams(需完整星盘)'}
|
||||
else:
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -74,7 +75,20 @@ def _variant(component: str, planet: str) -> str:
|
||||
|
||||
|
||||
def build_report() -> dict:
|
||||
actual = _native_output()["planets"]
|
||||
packet = _native_output()
|
||||
views = packet.get('engine_views') or {}
|
||||
local_view = views.get('local_legacy') or {}
|
||||
if local_view.get('planets'):
|
||||
actual = local_view['planets']
|
||||
selected_view = 'engine_views.local_legacy'
|
||||
else:
|
||||
actual = packet.get('planets') or {}
|
||||
external_default = (views.get('default') == 'pyjhora_jhora' or
|
||||
(packet.get('canonical_output') or {}).get('status') == 'canonical_ready' or
|
||||
any('pyjhora' in str(row.get('source', '')).lower() for row in actual.values()))
|
||||
if external_default or not actual:
|
||||
raise ValueError('local Shadbala view unavailable; external canonical output is not a native benchmark')
|
||||
selected_view = 'planets_local_fallback'
|
||||
rows = []
|
||||
for component, expected_values in EXPECTED.items():
|
||||
for planet, expected in zip(PLANETS, expected_values):
|
||||
@@ -94,6 +108,8 @@ def build_report() -> dict:
|
||||
})
|
||||
matched = sum(row["status"] == "within_tolerance" for row in rows)
|
||||
return {
|
||||
'comparison_engine': {'engine': 'native_local', 'selected_view': selected_view,
|
||||
'cli_default_view': views.get('default', 'local')},
|
||||
"case": {
|
||||
"name": "VP Jain-attributed Shadbala fixture",
|
||||
"birth": "1981-09-13T01:30:00+05:30",
|
||||
@@ -120,7 +136,18 @@ def build_report() -> dict:
|
||||
}
|
||||
|
||||
|
||||
def main(argv=None) -> None:
|
||||
# Upstream a4b4b267: read-only JSON on stdout unless an output path is given.
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output', type=Path, help='Explicit output path; default is read-only JSON on stdout')
|
||||
args = parser.parse_args(argv)
|
||||
payload = json.dumps(build_report(), ensure_ascii=False, indent=2) + '\n'
|
||||
if args.output:
|
||||
args.output.write_text(payload, encoding='utf-8', newline='\n')
|
||||
print(args.output)
|
||||
else:
|
||||
print(payload, end='')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
output = ROOT / "references" / "oracle" / "vp_jain_shadbala_component_benchmark_2026_07_17.json"
|
||||
output.write_text(json.dumps(build_report(), ensure_ascii=False, indent=2) + "\n")
|
||||
print(output)
|
||||
main()
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
"""Git-mode import record for upstream main 5fb8379c (tenth sync, 2026-11-04). Does not replace the 5db72537 archive pin test."""
|
||||
"""Git-mode import record for upstream 5fb8379c, kept as history.
|
||||
|
||||
原值: 本文件要求 source-manifest.json 与 SKILL.md 快照仍停在 5fb8379c
|
||||
新值: 只核对这份历史记录自身完整,且已不是当前镜像
|
||||
原因: 产品 2026-11-07 同步占星师上游 ea2a9d65(tests/test_upstream_git_import_ea2a9d65.py)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
@@ -12,12 +16,12 @@ from jsonschema import Draft202012Validator, FormatChecker
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
RECORD = ROOT / "references/cross_project_contract/imports/commit-5fb8379c4f3e649cb4804065c9a3059e4bf633fe.json"
|
||||
SOURCE_MANIFEST = ROOT / "references/upstream/yinduzhanxing/source-manifest.json"
|
||||
SKILL_SNAPSHOT = ROOT / "references/upstream/yinduzhanxing/SKILL.md"
|
||||
SCHEMA = ROOT / "references/cross_project_contract/import_manifest.schema.json"
|
||||
COMMIT = "5fb8379c4f3e649cb4804065c9a3059e4bf633fe"
|
||||
HISTORICAL_SKILL_SHA256 = "5c1c0738fbe6f586fad36cfa13f602934dcea8f8d54c536655f6cb2091773d8d"
|
||||
|
||||
|
||||
def test_git_import_record_matches_mirrored_skill_and_manifest() -> None:
|
||||
def test_historical_git_import_record_stays_valid_and_is_not_the_current_mirror() -> None:
|
||||
record = json.loads(RECORD.read_text(encoding="utf-8"))
|
||||
manifest = json.loads(SOURCE_MANIFEST.read_text(encoding="utf-8"))
|
||||
schema = json.loads(SCHEMA.read_text(encoding="utf-8"))
|
||||
@@ -25,13 +29,9 @@ def test_git_import_record_matches_mirrored_skill_and_manifest() -> None:
|
||||
|
||||
assert record["source_mode"] == "git"
|
||||
assert record["source_commit"] == COMMIT
|
||||
assert re.fullmatch(r"[0-9a-f]{40}", record["source_commit"])
|
||||
assert re.fullmatch(r"[0-9a-f]{64}", record["source_tree_hash"])
|
||||
assert record["source_tree_hash"] == manifest["source_tree_sha256"]
|
||||
assert record["source_skill_sha256"] == manifest["source_skill_sha256"]
|
||||
snapshot_hash = hashlib.sha256(SKILL_SNAPSHOT.read_bytes()).hexdigest()
|
||||
assert snapshot_hash == record["source_skill_sha256"] == record["mirror_files"][0]["target_sha256_after"]
|
||||
assert record["source_skill_sha256"] == HISTORICAL_SKILL_SHA256
|
||||
assert record["mirror_files"][0]["target_sha256_after"] == HISTORICAL_SKILL_SHA256
|
||||
assert record["mirror_files"][0]["status"] == "applied"
|
||||
assert manifest["source_mode"] == "git"
|
||||
assert manifest["source_commit"] == COMMIT
|
||||
assert all(row["status"] == "review_required" for row in record["semantic_merge_files"])
|
||||
assert manifest["source_commit"] != COMMIT
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
原值: 本文件要求 source-manifest.json 与 SKILL.md 快照仍停在 b9a0ef8f
|
||||
新值: 只核对这份历史记录自身完整,且已不是当前镜像
|
||||
原因: 2026-11-04 第十轮同步把镜像移到 5fb8379c(tests/test_upstream_git_import_5fb8379c.py)
|
||||
原因: 2026-11-04 第十轮同步把镜像移到 5fb8379c;2026-11-07 再移到 ea2a9d65(tests/test_upstream_git_import_ea2a9d65.py)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
"""Git-mode import record for upstream main ea2a9d65 (eleventh sync, 2026-11-07). Does not replace the 5db72537 archive pin test."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from jsonschema import Draft202012Validator, FormatChecker
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
RECORD = ROOT / "references/cross_project_contract/imports/commit-ea2a9d657451cd04615a3a7108dc92666dc8340c.json"
|
||||
SOURCE_MANIFEST = ROOT / "references/upstream/yinduzhanxing/source-manifest.json"
|
||||
SKILL_SNAPSHOT = ROOT / "references/upstream/yinduzhanxing/SKILL.md"
|
||||
SCHEMA = ROOT / "references/cross_project_contract/import_manifest.schema.json"
|
||||
COMMIT = "ea2a9d657451cd04615a3a7108dc92666dc8340c"
|
||||
|
||||
|
||||
def test_git_import_record_matches_mirrored_skill_and_manifest() -> None:
|
||||
record = json.loads(RECORD.read_text(encoding="utf-8"))
|
||||
manifest = json.loads(SOURCE_MANIFEST.read_text(encoding="utf-8"))
|
||||
schema = json.loads(SCHEMA.read_text(encoding="utf-8"))
|
||||
Draft202012Validator(schema, format_checker=FormatChecker()).validate(record)
|
||||
|
||||
assert record["source_mode"] == "git"
|
||||
assert record["source_commit"] == COMMIT
|
||||
assert re.fullmatch(r"[0-9a-f]{40}", record["source_commit"])
|
||||
assert re.fullmatch(r"[0-9a-f]{64}", record["source_tree_hash"])
|
||||
assert record["source_tree_hash"] == manifest["source_tree_sha256"]
|
||||
assert record["source_skill_sha256"] == manifest["source_skill_sha256"]
|
||||
snapshot_hash = hashlib.sha256(SKILL_SNAPSHOT.read_bytes()).hexdigest()
|
||||
assert snapshot_hash == record["source_skill_sha256"] == record["mirror_files"][0]["target_sha256_after"]
|
||||
assert record["mirror_files"][0]["status"] == "applied"
|
||||
assert manifest["source_mode"] == "git"
|
||||
assert manifest["source_commit"] == COMMIT
|
||||
# 原值: 全部 review_required。新值: 另允许 unchanged。原因: 产品 2026-11-07 同步占星师上游 ea2a9d65,strict-workflow-router.md 两边已一致
|
||||
assert all(row["status"] in {"review_required", "unchanged"} for row in record["semantic_merge_files"])
|
||||
@@ -41,20 +41,20 @@ EXPECTED_REJECTIONS = {
|
||||
"weaken_stability_gate",
|
||||
"remove_commercial_routes",
|
||||
}
|
||||
# 原值: b9a0ef8f(树 9ae737b0…、git 树 864cab47…、SKILL 6bed459b…、提交时间 2026-09-08T17:36:09Z)
|
||||
# 新值: 5fb8379c(上游 main 2026-11-04 的 HEAD)
|
||||
# 原因: 第十轮同步用导入器重新镜像 SKILL.md;旧记录留作历史,见 test_upstream_git_import_b9a0ef8f.py
|
||||
# 原值: 5fb8379c(树 ee8bd986…、git 树 6cd61608…、SKILL 5c1c0738…、提交时间 2026-10-21T15:49:21Z)
|
||||
# 新值: ea2a9d65(上游 main 2026-11-07 的 HEAD)
|
||||
# 原因: 产品 2026-11-07 同步占星师上游 ea2a9d65;旧记录留作历史,见 test_upstream_git_import_5fb8379c.py
|
||||
EXPECTED_UPSTREAM_IDENTITY = {
|
||||
"source_repository": "732642856/yinduzhanxing",
|
||||
"source_repository_url": "https://github.com/732642856/yinduzhanxing",
|
||||
"source_commit": "5fb8379c4f3e649cb4804065c9a3059e4bf633fe",
|
||||
"source_tree_sha256": "ee8bd9865cf11a6eb7f90705a262db8b2d145ae0cee6ee6eda32b311548f5aa2",
|
||||
"source_commit": "ea2a9d657451cd04615a3a7108dc92666dc8340c",
|
||||
"source_tree_sha256": "392de36df201cc3bae1a2f85522ca4b5d82738593578a7f9c8b5aa1543da1f64",
|
||||
}
|
||||
EXPECTED_SOURCE_GIT_TREE = "6cd6160804ea7419d609ccd639cc537a8a81c3c9"
|
||||
EXPECTED_SOURCE_SKILL_SHA256 = "5c1c0738fbe6f586fad36cfa13f602934dcea8f8d54c536655f6cb2091773d8d"
|
||||
EXPECTED_SOURCE_COMMITTED_AT = "2026-10-21T15:49:21Z"
|
||||
EXPECTED_SOURCE_GIT_TREE = "74dc6abef1d6cc1c62c3b0269714772539cf5f00"
|
||||
EXPECTED_SOURCE_SKILL_SHA256 = "12deb0d59eb820a482c6b709c34658178529c82823ae2a54d0ca8bc12f8b7a5c"
|
||||
EXPECTED_SOURCE_COMMITTED_AT = "2026-11-07T06:15:35Z"
|
||||
LEGACY_ARCHIVE_COMMIT = "5db72537741fcedaa7b5498502d4a31b0f9fc147"
|
||||
CURRENT_IMPORT_RECORD = ROOT / "references/cross_project_contract/imports/commit-5fb8379c4f3e649cb4804065c9a3059e4bf633fe.json"
|
||||
CURRENT_IMPORT_RECORD = ROOT / "references/cross_project_contract/imports/commit-ea2a9d657451cd04615a3a7108dc92666dc8340c.json"
|
||||
|
||||
|
||||
def _load(path: Path) -> dict:
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
"""产品 2026-11-07 同步占星师上游 ea2a9d65(yinduzhanxing 5fb8379c..ea2a9d65)。
|
||||
|
||||
Her tests for the ported calculation code, adapted where this repository keeps
|
||||
a variant in a sidecar because the module is in the rectification frozen
|
||||
identity (ERR-110): ``shadbala_reference.drik_profiles`` (her
|
||||
``shadbala.drik_aspect_contribution`` / ``compare_drik_profiles``, a4b4b267).
|
||||
Defaults the astrologer's rulings fixed are asserted unchanged.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts import functional_benefics, jaimini, shadbala
|
||||
from scripts.shadbala_reference import drik_profiles as drik
|
||||
from scripts.active_rectification_questions import build_questionnaire, score_answers
|
||||
from scripts.active_rectification_selector import select_next_questions
|
||||
from scripts.jyotish_api_server import BadRequest, JyotishComputeService
|
||||
|
||||
SYNTHETIC = dict(Sun=29., Moon=58., Mars=87., Mercury=116.,
|
||||
Jupiter=145., Venus=174., Saturn=203., Rahu=245., Ketu=65.)
|
||||
|
||||
|
||||
def _handler() -> JyotishComputeService:
|
||||
return JyotishComputeService()
|
||||
|
||||
|
||||
def positions():
|
||||
return dict(Saturn=85., Rahu=151., Sun=1., Moon=2., Mars=3.,
|
||||
Mercury=4., Jupiter=5., Venus=6., Ketu=7.)
|
||||
|
||||
|
||||
# --- 7b43eaf2: Arudha lord profile ---
|
||||
# Already present here as the BUG-1626 reference module (astrologer #166 Q28:
|
||||
# opt-in, not the default): scripts/arudha_reference/pvr_dual_lord.py, covered
|
||||
# by tests/test_arudha_lord_selection_pvr.py. Her sample chart gives the same pick.
|
||||
|
||||
def test_her_pvr_sample_matches_existing_reference_module():
|
||||
from scripts.arudha_reference import pvr_dual_lord
|
||||
pick = pvr_dual_lord.select_pvr_arudha_lord(10, positions())
|
||||
assert pick['winner'] == 'Rahu' and pick['deciding_level'] == 6 # degree rule, as hers
|
||||
|
||||
|
||||
# --- 7b43eaf2: rectification input guards (her test_active_rectification_*) ---
|
||||
|
||||
@pytest.mark.parametrize('location', [{'lat': 0}, {'lat': 0, 'lon': 0}, {'lat': 0, 'lon': 0, 'tz': None}])
|
||||
def test_question_api_rejects_incomplete_location(location) -> None:
|
||||
with pytest.raises(BadRequest, match='supplied together'):
|
||||
_handler()._compute_active_rectification_questions({
|
||||
'birth_time': '2000-01-01 12:00', 'ayanamsa': 'lahiri', 'node_mode': 'mean', **location,
|
||||
})
|
||||
|
||||
|
||||
def test_question_api_preserves_explicit_node_profile() -> None:
|
||||
result = _handler()._compute_active_rectification_questions({
|
||||
'birth_time': '2000-01-01 12:00', 'ayanamsa': 'lahiri', 'node_mode': 'true',
|
||||
})
|
||||
assert result['calculation_profile'] == {'ayanamsa': 'lahiri', 'node_mode': 'true'}
|
||||
|
||||
|
||||
def test_event_api_does_not_default_missing_location_to_zero() -> None:
|
||||
with pytest.raises(BadRequest, match='required for event'):
|
||||
_handler()._compute_active_rectification_events({
|
||||
'birth_date': '2000-01-01', 'start_time': '12:00', 'end_time': '12:01',
|
||||
'ayanamsa': 'lahiri', 'node_mode': 'mean', 'events': [],
|
||||
})
|
||||
|
||||
|
||||
def test_target_hint_cannot_bias_minute_priorities_or_claim_dasha_execution() -> None:
|
||||
questionnaire = {
|
||||
"question_bank": [],
|
||||
"candidate_scan": {"minute_scan": {"rows": [
|
||||
{"time": "2000-01-01 12:00", "sensitivity_count": 1},
|
||||
{"time": "2000-01-01 12:01", "sensitivity_count": 2},
|
||||
]}},
|
||||
}
|
||||
baseline = score_answers(questionnaire, {})
|
||||
questionnaire["candidate_scan"]["regression_hint"] = {"target_minute": "12:00"}
|
||||
hinted = score_answers(questionnaire, {})
|
||||
assert hinted["minute_rankings"] == baseline["minute_rankings"]
|
||||
assert hinted["minute_rankings"][0]["time"].endswith("12:01")
|
||||
assert hinted["can_narrow_from_template_scores"] is False
|
||||
vimshottari = next(row for row in hinted["technique_audit_table"] if row["technique"] == "Vimshottari Rectification")
|
||||
assert vimshottari["status"] == "blocked"
|
||||
|
||||
|
||||
def test_selected_template_retains_nonpersonal_timing_label() -> None:
|
||||
report = build_questionnaire("2000-01-01 12:00", uncertainty_minutes=30)
|
||||
assert report["questions"][0]["question_basis"] == "generic_interview_template"
|
||||
assert report["questions"][0]["timing_claim_status"] == "not_individually_calculated"
|
||||
assert "不提高、排除或确认" in report["questions"][0]["why_asked"][1]
|
||||
assert "暂不缩小" in report["questions"][0]["answer_impact"]["A"]
|
||||
|
||||
|
||||
def test_missing_cross_calculations_do_not_imply_executed_or_medium_confidence() -> None:
|
||||
report = build_questionnaire("2000-01-01 12:00", uncertainty_minutes=30)
|
||||
scored = score_answers(report, {report["questions"][0]["id"]: "A"})
|
||||
assert all(row["confidence_cap"] == "low" for row in scored["candidate_cluster_rankings"])
|
||||
assert all(row.get("execution_status", row["status"]) == "blocked" for row in scored["technique_audit_table"])
|
||||
|
||||
|
||||
def test_invalid_answer_does_not_skip_a_question_or_penalize_its_domain() -> None:
|
||||
questionnaire = build_questionnaire("2000-01-01 12:00", uncertainty_minutes=30)
|
||||
first = questionnaire["questions"][0]["id"]
|
||||
baseline = select_next_questions(questionnaire, {})
|
||||
for invalid in ("", "E", "not an answer", None):
|
||||
assert select_next_questions(questionnaire, {first: invalid}) == baseline
|
||||
|
||||
|
||||
# --- 7b43eaf2 item 3: functional roles (her functional_benefics.py:34) ---
|
||||
|
||||
@pytest.mark.parametrize('lagna', ['Aries', 'Scorpio'])
|
||||
def test_venus_is_a_functional_malefic_for_aries_and_scorpio(lagna):
|
||||
assert 'Venus' in functional_benefics.derive_functional_benefic_malefic(lagna)['functional_malefics']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('lagna', ['Gemini', 'Virgo'])
|
||||
def test_saturn_mixed_ruling_kept_over_upstream_table(lagna):
|
||||
# Her table still makes Saturn a pure benefic here; the astrologer's #166 Q4
|
||||
# ruling (BUG-1590) keeps it mixed in this product. Not regressed by the sync.
|
||||
roles = functional_benefics.derive_functional_benefic_malefic(lagna)
|
||||
assert 'Saturn' in roles['functional_neutrals']
|
||||
assert 'Saturn' not in roles['functional_benefics']
|
||||
|
||||
|
||||
# --- a4b4b267: Drik weighting readings (her test_shadbala_bphs_aspect_profiles.py) ---
|
||||
|
||||
@pytest.mark.parametrize('profile,want', [
|
||||
('quarter_v1', 10), ('mercury_jupiter_full_replacement_v1', 40),
|
||||
('santhanam27_literal_addition_v1', 50),
|
||||
])
|
||||
def test_weighting_40_virupas_is_applied_once(profile, want):
|
||||
assert drik.drik_aspect_contribution(40, 'Jupiter', True, weighting_profile=profile) == want
|
||||
|
||||
|
||||
def test_malefic_mercury_literal_addition_is_not_signed_125_percent():
|
||||
assert drik.drik_aspect_contribution(40, 'Mercury', False,
|
||||
weighting_profile='santhanam27_literal_addition_v1') == 30
|
||||
assert drik.drik_aspect_contribution(40, 'Mercury', False,
|
||||
weighting_profile='mercury_jupiter_full_replacement_v1') == -40
|
||||
|
||||
|
||||
def test_directed_aspect_and_weighting_reach_drik_total():
|
||||
# Her test names the geometry ``bphs26_piecewise_v1``; here it is the default
|
||||
# ``bphs`` (BUG-1586). Jupiter 140 deg -> 60 - 20 = 40; literal addition = 50.
|
||||
planets = {'Jupiter': {'degree': 0, 'sign': 'Aries'},
|
||||
'Venus': {'degree': 140, 'sign': 'Leo'}}
|
||||
assert drik.calc_drik_bala_profiled('Venus', planets,
|
||||
weighting_profile='santhanam27_literal_addition_v1') == 50
|
||||
assert drik.calc_drik_bala_profiled('Venus', planets) == shadbala.calc_drik_bala_precise('Venus', planets) == 10
|
||||
|
||||
|
||||
def test_comparison_keeps_default_and_candidate_separate():
|
||||
planets = {'Jupiter': {'degree': 0, 'sign': 'Aries'},
|
||||
'Venus': {'degree': 140, 'sign': 'Leo'}}
|
||||
report = drik.compare_drik_profiles(planets)
|
||||
assert report['admission_state'] == 'diagnostic_only'
|
||||
assert report['default'] == {'aspect_profile': 'bphs', 'weighting_profile': 'quarter_v1'}
|
||||
assert len(report['variants']) == 6
|
||||
baseline = shadbala.calc_drik_bala_precise('Venus', planets)
|
||||
for variant in report['variants']:
|
||||
assert variant['delta_from_default']['Venus'] == pytest.approx(
|
||||
variant['virupas']['Venus'] - baseline)
|
||||
assert report['variants'][2]['virupas']['Venus'] == 50
|
||||
|
||||
|
||||
def test_unknown_weighting_profile_is_rejected():
|
||||
with pytest.raises(ValueError, match='weighting'):
|
||||
drik.calc_drik_bala_profiled('Venus', {'Venus': {'degree': 1, 'sign': 'Aries'}}, weighting_profile='guess')
|
||||
|
||||
|
||||
# --- bb26dc2d: Goel evidence on the Jaimini special endpoint ---
|
||||
|
||||
def test_api_special_matches_native_entry():
|
||||
from scripts.jyotish_engine import _goel_jaimini_evidence
|
||||
result = _handler()._compute_jaimini({
|
||||
'mode': 'special', 'ascendant': {'lon': 0.},
|
||||
'planets': {p: {'lon': v} for p, v in SYNTHETIC.items()},
|
||||
})['result']
|
||||
native = _goel_jaimini_evidence(SYNTHETIC, 0.)
|
||||
for field in native:
|
||||
assert result[field] == native[field]
|
||||
|
||||
|
||||
def test_api_does_not_invent_aries_ascendant_for_goel():
|
||||
result = _handler()._compute_jaimini({
|
||||
'mode': 'special', 'planets': {p: {'lon': v} for p, v in SYNTHETIC.items()},
|
||||
})['result']
|
||||
assert result['goel_full_strength']['status'] == 'blocked'
|
||||
assert 'ascendant' in result['goel_full_strength']['reason']
|
||||
Reference in New Issue
Block a user