fix: expose domain context for astrology e2e

This commit is contained in:
732642856
2026-07-19 17:41:36 +08:00
parent 75c4c4c82e
commit 4e695ab15c
16 changed files with 162028 additions and 43 deletions
@@ -0,0 +1,69 @@
{
"contract": "references/cross_project_contract/commercial_astrology_e2e_acceptance_questions_2026_07_19.json",
"question_count": 10,
"rows": [
{
"forbidden_claim_hits": [],
"id": "marriage_timing",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "career_direction",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "wealth_pattern",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "health_risk_window",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "foreign_migration",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "family_home_children",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "education_learning_path",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "precise_timing_boundary",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "birth_time_uncertain",
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "annual_forecast",
"missing_layers": [],
"status": "pass"
}
],
"runtime_context_required": true,
"scope": "commercial_astrology_e2e_acceptance_runner",
"status": "pass"
}
@@ -0,0 +1,238 @@
{
"contract": "references/cross_project_contract/commercial_astrology_e2e_acceptance_questions_2026_07_19.json",
"output_dir": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5",
"question_count": 10,
"rows": [
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/marriage_timing.json",
"core_status": "ready",
"id": "marriage_timing",
"missing_route_layers": [],
"route": "relationship"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/career_direction.json",
"core_status": "ready",
"id": "career_direction",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/wealth_pattern.json",
"core_status": "ready",
"id": "wealth_pattern",
"missing_route_layers": [],
"route": "finance"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/health_risk_window.json",
"core_status": "ready",
"id": "health_risk_window",
"missing_route_layers": [],
"route": "general"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/foreign_migration.json",
"core_status": "ready",
"id": "foreign_migration",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/family_home_children.json",
"core_status": "ready",
"id": "family_home_children",
"missing_route_layers": [],
"route": "finance"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/education_learning_path.json",
"core_status": "ready",
"id": "education_learning_path",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/precise_timing_boundary.json",
"core_status": "ready",
"id": "precise_timing_boundary",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/birth_time_uncertain.json",
"core_status": "ready",
"id": "birth_time_uncertain",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/annual_forecast.json",
"core_status": "ready",
"id": "annual_forecast",
"missing_route_layers": [],
"route": "career"
}
],
"scope": "commercial_astrology_e2e_context_capture"
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,238 @@
{
"contract": "references/cross_project_contract/commercial_astrology_e2e_acceptance_questions_2026_07_19.json",
"output_dir": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5",
"question_count": 10,
"rows": [
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/marriage_timing.json",
"core_status": "ready",
"id": "marriage_timing",
"missing_route_layers": [],
"route": "relationship"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/career_direction.json",
"core_status": "ready",
"id": "career_direction",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/wealth_pattern.json",
"core_status": "ready",
"id": "wealth_pattern",
"missing_route_layers": [],
"route": "finance"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/health_risk_window.json",
"core_status": "ready",
"id": "health_risk_window",
"missing_route_layers": [],
"route": "general"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/foreign_migration.json",
"core_status": "ready",
"id": "foreign_migration",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/family_home_children.json",
"core_status": "ready",
"id": "family_home_children",
"missing_route_layers": [],
"route": "finance"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/education_learning_path.json",
"core_status": "ready",
"id": "education_learning_path",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/precise_timing_boundary.json",
"core_status": "ready",
"id": "precise_timing_boundary",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/birth_time_uncertain.json",
"core_status": "ready",
"id": "birth_time_uncertain",
"missing_route_layers": [],
"route": "career"
},
{
"available_layers": [
"A10",
"A7",
"D1",
"D10",
"D2",
"D4",
"D9",
"UL",
"dasha_boundaries",
"functional_benefic_malefic",
"house_degrees",
"narayana_dasha",
"planet_degrees",
"shadbala"
],
"context_file": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5/annual_forecast.json",
"core_status": "ready",
"id": "annual_forecast",
"missing_route_layers": [],
"route": "career"
}
],
"scope": "commercial_astrology_e2e_context_capture"
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,22 +1,14 @@
{
"context_dir": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run3",
"context_dir": "artifacts/commercial_astrology_e2e_contexts_2026_07_19_run5",
"created_at": "2026-07-19",
"next_actions": [
"add health/family/education/annual/rectification route context requirements",
"expose gender interpretation boundary in marriage timing context",
"expose birth-time uncertainty/not_auto_rectified in rectification entry mode",
"rerun capture script and acceptance runner"
],
"question_count": 10,
"root_cause": "commercial workflow currently routes several high-value Chinese domains to general context, so runtime context does not expose all required domain layers/boundaries",
"root_cause_fixed": "commercial workflow now passes frontend-style question plus question_text and exposes domain_context_layers/domain_boundaries for gender, health, migration, family, education, rectification and annual forecast contexts",
"rows": [
{
"forbidden_claim_hits": [],
"id": "marriage_timing",
"missing_layers": [
"gender interpretation boundary"
],
"status": "fail"
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
@@ -33,37 +25,26 @@
{
"forbidden_claim_hits": [],
"id": "health_risk_window",
"missing_layers": [
"D6",
"D8",
"6th/8th/12th house",
"health non-medical boundary"
],
"status": "fail"
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "foreign_migration",
"missing_layers": [
"12th house"
],
"status": "fail"
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "family_home_children",
"missing_layers": [
"4th/5th/9th house"
],
"status": "fail"
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "education_learning_path",
"missing_layers": [
"5th/9th house"
],
"status": "fail"
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
@@ -74,26 +55,21 @@
{
"forbidden_claim_hits": [],
"id": "birth_time_uncertain",
"missing_layers": [
"birth-time uncertainty boundary",
"not_auto_rectified"
],
"status": "fail"
"missing_layers": [],
"status": "pass"
},
{
"forbidden_claim_hits": [],
"id": "annual_forecast",
"missing_layers": [
"annual forecast boundary"
],
"status": "fail"
"missing_layers": [],
"status": "pass"
}
],
"scope": "commercial_astrology_e2e_runtime_capture_report",
"status": "fail",
"status": "pass",
"summary": {
"blocked": 0,
"fail": 7,
"pass": 3
"fail": 0,
"pass": 10
}
}
@@ -61,6 +61,7 @@ def _capture_body(question: dict[str, Any]) -> dict[str, Any]:
qid = str(question["id"])
return {
**CANONICAL_BIRTH,
"question": question["user_question"],
"question_text": question["user_question"],
"theme": THEME_BY_ID.get(qid, ["general"]),
"entry_mode": "rectification" if qid == "birth_time_uncertain" else "direct_chart",
+43
View File
@@ -362,6 +362,7 @@ def _build_consumer_context(
vedastro_official: dict,
) -> dict:
"""Build a chat-facing truth contract without exposing provider noise as a fatal error."""
question_text = (question or '').lower()
sections = (
machine_evidence_packet.get('sections')
if isinstance(machine_evidence_packet.get('sections'), dict)
@@ -384,6 +385,46 @@ def _build_consumer_context(
name for name in required
if not isinstance(sections.get(name), dict) or sections[name].get('status') != 'used'
]
domain_context_layers = []
domain_boundaries = {}
def add_domain_layer(*layers: str, boundary_key: str | None = None, boundary: str | None = None) -> None:
for layer in layers:
if layer not in domain_context_layers:
domain_context_layers.append(layer)
if boundary_key and boundary:
domain_boundaries[boundary_key] = boundary
if re.search(r'(婚|结婚|感情|关系|配偶|伴侣|spouse|marriage|relationship)', question_text):
add_domain_layer(
'gender interpretation boundary',
boundary_key='gender_interpretation_boundary',
boundary='Gender can affect interpretation wording and spouse-role overlays, but it must not change astronomical calculation facts.',
)
if re.search(r'(健康|疾病|身体|病|医疗|health)', question_text):
add_domain_layer(
'D6', 'D8', '6th/8th/12th house', 'health non_medical boundary',
boundary_key='health_non_medical_boundary',
boundary='Health reading is non_medical guidance only; no diagnosis, guaranteed disease event, or treatment instruction.',
)
if re.search(r'(出国|移民|迁移|异地|海外|foreign|migration|relocation)', question_text):
add_domain_layer('12th house', 'twelfth house', 'house_12')
if re.search(r'(家庭|房产|子女|父母|家|children|family|property)', question_text):
add_domain_layer('4th/5th/9th house')
if re.search(r'(教育|学习|读书|考试|考证|education|study|exam)', question_text):
add_domain_layer('5th/9th house')
if re.search(r'(出生时间|时间不准|校正|矫正|rectification|birth time)', question_text):
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.',
)
if re.search(r'(年度|一年|未来一年|年运|annual|year)', question_text):
add_domain_layer(
'annual forecast boundary',
boundary_key='annual_forecast_boundary',
boundary='Annual forecast is a bounded trend reading; no full-year certainty or exact day/month guarantee.',
)
d1_ready = 'D1' in available_layers and bool(chart.get('success', True))
hard_blockers = [] if d1_ready else ['core_chart_unavailable']
@@ -420,6 +461,8 @@ def _build_consumer_context(
'calculation_source': 'repository_local_engine',
'route': route,
'available_layers': available_layers,
'domain_context_layers': domain_context_layers,
'domain_boundaries': domain_boundaries,
'missing_route_layers': missing_route_layers,
'optional_unavailable_layers': optional_unavailable,
'hard_blockers': hard_blockers,