fix(api): keep consultation_workflow alive when API hours are floats
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled

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:
Jesse_Chen
2026-09-04 16:24:41 +08:00
parent 7cab9043fc
commit c140191357
7 changed files with 307 additions and 3 deletions
+15 -2
View File
@@ -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 ''
+8 -1
View File
@@ -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):
+2
View File
@@ -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",