fix(api): keep consultation_workflow alive when API hours are floats
API birth payloads store hour/minute as floats, and datetime() rejected them after sensitivity was wired into every consultation_workflow call. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2144,6 +2144,17 @@ def _join_foreground_vedastro(future, *, timeout: float) -> dict:
|
||||
return result if isinstance(result, dict) else _blocked_foreground_vedastro(reason='gateway_invocation_error')
|
||||
|
||||
|
||||
def _blocked_birth_time_sensitivity(*, error_type: str) -> dict:
|
||||
return {
|
||||
'schema': 'jyotish.report_birth_time_sensitivity.v1',
|
||||
'status': 'not_applicable',
|
||||
'availability': 'not_available',
|
||||
'blocked': True,
|
||||
'reason': 'birth_time_sensitivity_unavailable',
|
||||
'error_type': error_type,
|
||||
}
|
||||
|
||||
|
||||
def execute_consultation_workflow(
|
||||
handler,
|
||||
*,
|
||||
@@ -2158,8 +2169,10 @@ def execute_consultation_workflow(
|
||||
sensitivity_args = type('BirthTimeSensitivityArgs', (), birth_payload)()
|
||||
try:
|
||||
birth_time_sensitivity = _load_local_module('jyotish_engine')._build_birth_time_sensitivity(sensitivity_args)
|
||||
except ValueError as exc:
|
||||
raise BadRequest(str(exc)) from exc
|
||||
except BadRequest:
|
||||
raise
|
||||
except Exception as exc:
|
||||
birth_time_sensitivity = _blocked_birth_time_sensitivity(error_type=type(exc).__name__)
|
||||
themes = handler._high_rigor_requested_themes(body)
|
||||
events = handler._high_rigor_events(body)
|
||||
question = body.get('question') or ''
|
||||
|
||||
@@ -9749,7 +9749,14 @@ def _birth_time_string(hour, minute, second=0):
|
||||
|
||||
|
||||
def _birth_datetime_from_args(args):
|
||||
return datetime(args.year, args.month, args.day, args.hour, args.minute, _arg_second(args))
|
||||
return datetime(
|
||||
int(args.year),
|
||||
int(args.month),
|
||||
int(args.day),
|
||||
int(args.hour),
|
||||
int(args.minute),
|
||||
_arg_second(args),
|
||||
)
|
||||
|
||||
|
||||
def _compute_chart_from_args(args):
|
||||
|
||||
@@ -79,6 +79,8 @@ CORE_PYTEST_TARGETS = [
|
||||
"tests/test_api_heavy_compute_gate.py",
|
||||
# Upstream-sync acceptance regressions must fail the automatic staging gate.
|
||||
"tests/test_consultation_workflow_domains.py",
|
||||
# Float hour/minute from the API payload must not 500 consultation_workflow (BUG-524).
|
||||
"tests/test_consultation_workflow_birth_time_sensitivity.py",
|
||||
"tests/test_mcp_strict_workflow_finance.py",
|
||||
"tests/test_interpretation_template_registry.py",
|
||||
"tests/test_vedastro_external_technique_evidence.py",
|
||||
|
||||
Reference in New Issue
Block a user