Merge PR #49: pass birth-time accuracy truth into consultation engine

Reviewed: tsc + consult 295 + rectification 747 + python suites green;
guard functions and window/general instructions verified unchanged.
Conflict: BUG entry renumbered 467→468 (467 taken by report-extraction).
Review fix: test_consultation_birth_accuracy.py added to CORE_PYTEST_TARGETS
(pytest-style file outside the rectification glob would never hit the auto gate).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0155nFCgCHtoA7jhSDGmZmMu
This commit is contained in:
Jesse_Chen
2026-09-01 20:48:27 +00:00
15 changed files with 534 additions and 14 deletions
+1
View File
@@ -38,6 +38,7 @@ EVENT_HOUSE_MAP = {
# 矫正精度与分盘启用矩阵
ACCURACY_MATRIX = {
'minute': {'D1': True, 'D9': True, 'D10': True, 'D5': True, 'D4': True, 'D7': 'warn', 'D30': False, 'D60': False},
'5min': {'D1': True, 'D9': True, 'D10': True, 'D5': 'warn', 'D4': 'warn', 'D7': 'warn', 'D30': False, 'D60': False},
'15min': {'D1': True, 'D9': True, 'D10': 'warn', 'D5': 'warn', 'D4': 'warn', 'D7': False},
'1hour': {'D1': True, 'D9': 'warn'},
'unknown': {'D1': True, 'D9': 'warn'},
+18 -7
View File
@@ -1800,10 +1800,10 @@ _ROUTE_DOMAIN_CONTEXT = {
},
}
# Birth-time precision tiers that need no uncertainty boundary. Anything else counts as uncertain,
# including an absent tier and the '5min' value `get_effective_accuracy` can return but
# `ACCURACY_MATRIX` has no row for.
# Birth-time precision tiers that need no uncertainty boundary. `5min` / `15min`
# keep a lighter precision-annotation boundary instead of candidate windows.
_PRECISE_BIRTH_TIME_ACCURACY = ('minute', 'rectified')
_ANNOTATED_BIRTH_TIME_ACCURACY = ('5min', '15min')
def _build_consumer_context(
@@ -1853,15 +1853,20 @@ def _build_consumer_context(
# read that state instead of waiting for the user to phrase it. An absent tier counts as
# uncertain: not knowing the precision is not the same as having confirmed it.
lagna_boundary = rectification.get('lagna_boundary') if isinstance(rectification.get('lagna_boundary'), dict) else {}
if (
str(rectification.get('effective_accuracy') or '') not in _PRECISE_BIRTH_TIME_ACCURACY
or bool(lagna_boundary.get('is_sensitive'))
):
effective_accuracy = str(rectification.get('effective_accuracy') or '')
lagna_sensitive = bool(lagna_boundary.get('is_sensitive'))
if lagna_sensitive or effective_accuracy not in _PRECISE_BIRTH_TIME_ACCURACY + _ANNOTATED_BIRTH_TIME_ACCURACY:
add_domain_layer(
'birth_time uncertain boundary', 'not_auto_rectified',
boundary_key='birth_time_uncertainty_boundary',
boundary='Birth-time uncertainty requires candidate windows and event evidence; the workflow is not_auto_rectified.',
)
elif effective_accuracy in _ANNOTATED_BIRTH_TIME_ACCURACY:
add_domain_layer(
'birth_time precision annotation',
boundary_key='birth_time_precision_boundary',
boundary='Birth time is the reported clock; minute-sensitive claims are precision-annotated, not candidate-windowed.',
)
d1_ready = 'D1' in available_layers and bool(chart.get('success', True))
hard_blockers = [] if d1_ready else ['core_chart_unavailable']
@@ -8628,6 +8633,12 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
if is_boundary:
headline = '出生时间高度敏感,建议先做事件反验'
next_action = '优先录入婚姻、迁移、事业转折、健康危机等日期明确事件,再比较相邻候选时间。'
elif effective_accuracy in ('minute', 'rectified'):
headline = '出生时间风险较低,可进入完整解盘'
next_action = '保留原始出生记录来源;重要预测仍建议用 Dasha/Transit/案例验证交叉确认。'
elif effective_accuracy in ('5min', '15min'):
headline = '按填报时间排盘,分钟敏感结论已标注精度'
next_action = 'D1 可正常阅读;分钟敏感结论需标注时间精度限制。'
elif warned or disabled:
headline = '可读主盘,但高敏分盘需要降级'
next_action = 'D1 可正常阅读;D9/D10 以上结论需标注时间精度限制。'
+3
View File
@@ -65,6 +65,9 @@ CORE_PYTEST_TARGETS = [
"tests/test_rectification_*.py",
# This file regexes frontend source. Home-split and other page.tsx moves must keep it green.
"tests/test_supabase_user_data_contract.py",
# Consultation birth-accuracy invariants are pytest-style functions; unittest
# discover collects zero of them, so the auto gate must list the file itself.
"tests/test_consultation_birth_accuracy.py",
# Locks archive as PATCH archived_at, never HTTP DELETE (data-safety).
"tests/test_session_management_entrypoints.py",
# Pure source/SQL regex for the birth-time journey; no runtime services.