fix(marriage): counting method reports a neutral geometry index only; real Parivartana no longer crashes (BUG-1183/1184)

TASK-upstream-sync4-20261002 T1 (upstream yinduzhanxing 0afa2780 for the
idea; wording is ours, in Chinese, per decision 2). _interpret_marriage_count
and _marriage_recommendations no longer state relationship counts, order,
quality or loyalty; the Marriage-counting evidence is always neutral and
carries only geometric_index (the dead D9-quality line in the adjudication is
removed). The count is computed before the Parivartana override (the old order
raised UnboundLocalError) and the exchange check now tests a real exchange
instead of a conjunction with the dispositor.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
Jesse_Chen
2026-10-02 14:01:13 +08:00
co-authored by Claude Opus 5.5
parent bc9b9f89bb
commit ba97fd5980
4 changed files with 128 additions and 84 deletions
+20
View File
@@ -1815,6 +1815,26 @@ def test_thematic_report_derives_evidence_from_birth_payload() -> None:
assert any(item['details'].get('derived') for item in result['themes']['career']['evidence'])
def test_marriage_counting_evidence_is_neutral_geometry_index_only() -> None:
# BUG-1183 (TASK-upstream-sync4-20261002 T1). Fictitious chart 1990-06-15 10:30 Beijing.
# 原值: marriage_count ≤ 1 记 positive,details 带 marriage_count 与 d9_marriage_quality
# 新值: 一律 neutral,details 只有 geometric_index;结论只描述几何指数
handler = _handler()
result = handler._compute_thematic_report({
'theme': ['marriage'],
'year': 1990, 'month': 6, 'day': 15, 'hour': 10, 'minute': 30,
'lat': 39.9042, 'lon': 116.4074, 'tz': 8,
})
rows = [item for item in result['themes']['marriage']['evidence'] if item['technique'] == 'Marriage-counting']
assert len(rows) == 1
row = rows[0]
assert row['sentiment'] == 'neutral'
assert set(row['details']) == {'geometric_index', 'source', 'derived'}
assert row['conclusion'].startswith(f"关系几何指数 {row['details']['geometric_index']}:")
for banned in ('再婚', '段关系', '第一段', '终身关系', '忠诚度'):
assert banned not in json.dumps(result['themes']['marriage'], ensure_ascii=False)
def test_thematic_report_derives_relationship_strict_narrative_evidence() -> None:
handler = _handler()
result = handler._compute_thematic_report({