fix: feed current dasha into web marriage path and keep chart fences on failure (BUG-609, BUG-610, BUG-611)

Consultation was passing the birth mahadasha into event-class splits, so marriage hits stayed empty and timing still said 缔结. Read live MD/AD from dasha_sub_periods, derive activation copy from the split, and isolate fence failures so one bad varga cannot 500 the whole report.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-09 16:58:46 +08:00
co-authored by Cursor
parent ee6173e887
commit 7d3bb0c5ed
15 changed files with 573 additions and 25 deletions
+24 -2
View File
@@ -241,6 +241,7 @@ class BirthChartData:
dasha_timeline: List[Dict[str, Any]] = field(default_factory=list)
yogas: List[Dict[str, Any]] = field(default_factory=list)
ashtakavarga: Dict[str, Any] = field(default_factory=dict)
event_class_split: Dict[str, Any] = field(default_factory=dict)
# ═══════════════════════════════════════════════════════════════
@@ -685,9 +686,15 @@ class TimingAnchorBuilder:
# 根据主题生成激活描述
activation = self._activation_text(theme, current)
md = str(current.get("mahadasha") or "").strip()
ad = str(current.get("antardasha") or "").strip()
if ad and ad != "Unknown":
dasha_period = f"{md}-{ad}" if md else ad
else:
dasha_period = md or "Unknown"
return TimingAnchor(
dasha_period=current.get("mahadasha", "Unknown") + "-" + current.get("antardasha", "Unknown"),
dasha_period=dasha_period,
start_year=current.get("start", now),
end_year=current.get("end", now + 3),
activation_description=activation,
@@ -695,10 +702,11 @@ class TimingAnchorBuilder:
)
def _activation_text(self, theme: ThemeName, period: Dict[str, Any]) -> str:
if theme == ThemeName.MARRIAGE:
return self._marriage_activation_text()
md = period.get("mahadasha", "")
ad = period.get("antardasha", "")
theme_desc = {
ThemeName.MARRIAGE: "婚姻相关宫位与 karaka 将被激活,是缔结或调整伴侣关系的关键期",
ThemeName.CAREER: "事业宫位能量被引动,可能出现职位变动、项目突破或行业转换的契机",
ThemeName.WEALTH: "财富宫位与 Dhana Yoga 被触发,收入结构可能发生变化",
ThemeName.HEALTH: "健康宫位能量显现,是关注身体信号、调整作息的重要时期",
@@ -706,6 +714,20 @@ class TimingAnchorBuilder:
}
return f"{md} 主运配合 {ad} 副运,{theme_desc.get(theme, '相关能量将被激活')}"
def _marriage_activation_text(self) -> str:
split = self.chart.event_class_split if isinstance(getattr(self.chart, "event_class_split", None), dict) else {}
legal = split.get("legal_marriage") if isinstance(split.get("legal_marriage"), dict) else {}
romantic = split.get("romantic_activation") if isinstance(split.get("romantic_activation"), dict) else {}
formation = split.get("relationship_formation") if isinstance(split.get("relationship_formation"), dict) else {}
legal_hits = legal.get("hits") if isinstance(legal.get("hits"), list) else []
romantic_hits = romantic.get("hits") if isinstance(romantic.get("hits"), list) else []
formation_hits = formation.get("hits") if isinstance(formation.get("hits"), list) else []
if legal_hits:
return "婚姻相关宫位与 karaka 将被激活,是缔结或调整伴侣关系的关键期"
if romantic_hits or formation_hits:
return "感情被激活的观察期,不等于领证"
return "本期无婚恋事件类命中"
# ═══════════════════════════════════════════════════════════════
# 主题化解盘编排器(主控类)