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
+12 -12
View File
@@ -2177,14 +2177,14 @@ def execute_consultation_workflow(
from scripts.consultation_plan_contract import (
ConsultationPlanContractError,
apply_plan_precision_boundary,
declared_workflow_route,
declared_workflow_route, plan_route_contract,
validate_consultation_plan_contract,
)
except ModuleNotFoundError: # pragma: no cover - direct script execution
from consultation_plan_contract import (
ConsultationPlanContractError,
apply_plan_precision_boundary,
declared_workflow_route,
declared_workflow_route, plan_route_contract,
validate_consultation_plan_contract,
)
try:
@@ -2338,9 +2338,9 @@ def execute_consultation_workflow(
modules = chart.get('modules') if isinstance(chart.get('modules'), dict) else {}
prompt_snapshot = (((chart.get('ai_prompt_pack') or {}).get('evidence_snapshot')) or {}) if isinstance(chart, dict) else {}
strict_workflow_contracts = prompt_snapshot.get('strict_workflow_contracts') if isinstance(prompt_snapshot.get('strict_workflow_contracts'), dict) else {}
route_contracts = {theme: plan_route_contract(theme) for theme in themes}
chart_guided_topics = modules.get('guided_topics') if isinstance(modules.get('guided_topics'), list) else []
audited_remedies = handler._build_audited_remedies_from_guided_topics(chart_guided_topics)
thematic_report = {}
if 'run_thematic_report' in runtime_planner.get('sync_steps', []):
thematic_report = handler._compute_thematic_report({
@@ -2354,12 +2354,11 @@ def execute_consultation_workflow(
'skip_full_reading_for_thematic': True,
'upstream_contract': {
'chart': chart_for_theme,
'strict_workflow_contracts': strict_workflow_contracts,
'strict_workflow_contracts': strict_workflow_contracts, 'route_contracts': route_contracts,
'guided_topics': chart_guided_topics,
},
})
executed_steps.append('run_thematic_report')
vedastro_gateway = rectification.get('vedastro_gateway') if isinstance(rectification, dict) else None
if defer_optional_external_evidence:
vedastro_gateway = _join_foreground_vedastro(
@@ -4282,6 +4281,7 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
adapter_evidence = {}
derived_context = None
strict_workflow_contracts = upstream_contract.get('strict_workflow_contracts') if isinstance(upstream_contract.get('strict_workflow_contracts'), dict) else {}
route_contracts = upstream_contract.get('route_contracts') if isinstance(upstream_contract.get('route_contracts'), dict) else {}
upstream_guided_topics = upstream_contract.get('guided_topics') if isinstance(upstream_contract.get('guided_topics'), list) else []
if not has_custom_evidence and not strict_workflow_contracts and self._can_derive_thematic_evidence(chart_data):
derived_context = self._derive_thematic_evidence(chart_data, report_orchestrator)
@@ -4349,9 +4349,8 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
theme_name,
evidence=adapter_evidence.get(theme_name, []),
upstream_contract_available=self._thematic_upstream_contract_available(
strict_workflow_contracts,
theme_name,
report_orchestrator,
strict_workflow_contracts, route_contracts,
theme_name, report_orchestrator,
),
)
@@ -5179,10 +5178,11 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
def _thematic_upstream_contract_available(
self,
strict_workflow_contracts,
domain,
report_orchestrator,
strict_workflow_contracts, route_contracts,
domain, report_orchestrator,
):
if isinstance(route_contracts, dict) and bool(route_contracts.get(domain)):
return True
if not isinstance(strict_workflow_contracts, dict):
return False
for raw_domain, contract in strict_workflow_contracts.items():
@@ -7182,7 +7182,7 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
'mode': 'jyotish_structured_prompt_pack',
'prompt_zh': '\n'.join(prompt_lines),
'evidence_snapshot': {
'birth': birth,
**((chart.get('ai_prompt_pack') or {}).get('evidence_snapshot') or {}), 'birth': birth,
'ayanamsa': {
'name': birth.get('ayanamsa_name', DEFAULT_AYANAMSA_NAME),
'display': ayanamsa_display,
+5
View File
@@ -77,6 +77,11 @@ CORE_PYTEST_TARGETS = [
"tests/test_api_server_growth_contract.py",
# Fail-fast heavy-compute concurrency gate (429 + Retry-After, health ungated).
"tests/test_api_heavy_compute_gate.py",
# Upstream-sync acceptance regressions must fail the automatic staging gate.
"tests/test_consultation_workflow_domains.py",
"tests/test_mcp_strict_workflow_finance.py",
"tests/test_interpretation_template_registry.py",
"tests/test_vedastro_external_technique_evidence.py",
]
RUNTIME_TRUTH_PYTEST_TARGETS = [