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
+40 -3
View File
@@ -500,6 +500,11 @@ def _existing_interpretation_source_pack() -> Dict[str, Any]:
promote_batch2_paths = PROMOTE_BATCH2_TOPIC_SOURCE_REFS
reference_only_paths = REFERENCE_ONLY_CONFLICT_SOURCE_REFS
blocked_non_runtime_paths = BLOCKED_NON_RUNTIME_SOURCE_REFS
frontend_interpretation_paths = [
"frontend/src/lib/report-interpretation-packs/general.ts",
"frontend/src/lib/report-interpretation-packs/themes.ts",
]
planet_house_paths = ["frontend/src/lib/personal-report-generation.ts"]
yoga_rule_paths = [
core_yogas_path,
"references/yoga_rules.json",
@@ -533,6 +538,8 @@ def _existing_interpretation_source_pack() -> Dict[str, Any]:
*REAL_CASE_STUDIES_BATCH1_SOURCE_REFS,
*RISHI_AI_MCP_BATCH1_SOURCE_REFS,
*VEDIC_ASTRO_SKILLS_BATCH1_SOURCE_REFS,
*frontend_interpretation_paths,
*planet_house_paths,
qa_rules_path,
reader_chart_rules_path,
reader_validation_rules_path,
@@ -564,6 +571,7 @@ def _existing_interpretation_source_pack() -> Dict[str, Any]:
"reference_only_conflict_sources",
"qa_governance_rules",
"reader_validation_rules",
"frontend_interpretation_layer",
"yoga_rule_layer",
"saham_rule_layer",
],
@@ -655,6 +663,18 @@ def _existing_interpretation_source_pack() -> Dict[str, Any]:
"next_batches": REMAINING_PRIORITY1_BATCH_QUEUE,
"boundary": "Future batches remain audit-only until classified and tested.",
},
"frontend_interpretation_layer": {
"status": "available" if all(_repo_relative_exists(path) for path in frontend_interpretation_paths) else "partial",
"source_refs": frontend_interpretation_paths,
"promotion_status": "reference_layer",
},
"frontend_planet_house_details": {
"status": "available" if all(_repo_relative_exists(path) for path in planet_house_paths) else "partial",
"coverage": "9_planets_x_12_houses",
"planet_count": 9,
"house_count": 12,
"source_refs": planet_house_paths,
},
"qa_governance_layer": {
"status": "available" if _repo_relative_exists(qa_rules_path) else "partial",
"source_refs": [qa_rules_path],
@@ -3930,7 +3950,7 @@ def _collect_strict_evidence(route: str, result: Dict[str, Any]) -> Dict[str, An
present["functional_benefic_malefic"] = _derive_functional_benefic_malefic(modules)
present["interpretation_source_pack"] = _existing_interpretation_source_pack()
missing = [key for key, value in present.items() if key not in {
"chart", "external_activation", "external_technique_evidence", "vedastro_official_snapshot", "source_priority", "dignity_guardrail", "gains_convergence", "career_convergence", "avayogi_risk", "ashtakavarga_finance_support", "shadbala_component_audit", "asc_sign", "pav_finance_support", "sodhita_finance_support", "kakshya_finance_support", "functional_benefic_malefic", "interpretation_source_pack", "d4_turyamsa", "d16_shodasamsa", "d24_siddhamsa", "bhava_bala", "hora_lagna", "indu_lagna", "sree_lagna", "dhan_saham", "artha_saham", "labha_saham"
"chart", "external_activation", "external_technique_evidence", "vedastro_official_snapshot", "source_priority", "dignity_guardrail", "gains_convergence", "career_convergence", "avayogi_risk", "ashtakavarga_finance_support", "shadbala_component_audit", "asc_sign", "pav_finance_support", "sodhita_finance_support", "kakshya_finance_support", "functional_benefic_malefic", "interpretation_source_pack", "d4_turyamsa", "d11_rudramsa", "d16_shodasamsa", "d24_siddhamsa", "bhava_bala", "hora_lagna", "indu_lagna", "sree_lagna", "dhan_saham", "artha_saham", "labha_saham"
} and value in (None, {}, [], "")]
convergence_hits: List[Dict[str, Any]] = [
item for item in [
@@ -4632,6 +4652,17 @@ def strict_workflow(
JSON with routed analysis and confidence level
"""
route_packet = _UNIFIED_CONSULTATION_ORCHESTRATOR.resolve_route(question, None)
mcp_declared_route = None
question_text = (question or "").lower()
if route_packet["question_type"] in {"annual", "timing"} and any(
alias in question_text
for alias, domain in _UNIFIED_CONSULTATION_ORCHESTRATOR._THEME_ALIASES.items()
if domain == "wealth"
):
mcp_declared_route = "wealth"
route_packet = _UNIFIED_CONSULTATION_ORCHESTRATOR.resolve_route(
question, None, declared_route=mcp_declared_route
)
normalized_themes = _UNIFIED_CONSULTATION_ORCHESTRATOR.normalize_themes(route_packet["primary_theme"])
result = _execute_mcp_consultation_workflow(
@@ -4653,12 +4684,18 @@ def strict_workflow(
western_oracle_payload=western_oracle_payload,
)
chart = result.get("chart") if isinstance(result, dict) else {}
route = _safe_get(result, "routing", "question_type") or route_packet["question_type"] or "general"
route = mcp_declared_route or _safe_get(result, "routing", "question_type") or route_packet["question_type"] or "general"
route_surface = _UNIFIED_CONSULTATION_ORCHESTRATOR.route_surface_contract(route)
route = "finance" if route_surface["runtime_route"] == "wealth" else route
if isinstance(result, dict):
routing = result.get("routing") if isinstance(result.get("routing"), dict) else {}
result["routing"] = {**route_packet, **routing, **route_surface}
result["routing"] = {**route_packet, **routing, **route_surface, "question_type": route}
result["route_normalization"] = route_surface
for key in ("unified_orchestrator", "runtime_planner"):
metadata = result.get(key)
if isinstance(metadata, dict):
metadata_route = metadata.get("route") if isinstance(metadata.get("route"), dict) else {}
result[key] = {**metadata, "route": {**metadata_route, "question_type": route}}
planner = result.get("runtime_planner") if isinstance(result.get("runtime_planner"), dict) else {}
result["execution_receipt"] = _build_execution_receipt(chart, planner)
if isinstance(chart, dict) and "error" not in chart: