fix(rectification): keep clock-stamped events out of window intercept (BUG-631, BUG-632)
Dated life events with clock times were swallowed as birth-window replies, and compare columns still stopped at the first nine candidates after the hour-window cap. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,7 +52,7 @@ _EVENT_PROVENANCE_FIELDS = frozenset({
|
||||
})
|
||||
_REQUEST_FIELDS = frozenset({
|
||||
"birth_date", "start_time", "end_time", "lat", "lon", "tz", "events",
|
||||
"ayanamsa", "node_mode", "asked_probe_keys", "minute_step", "blocks",
|
||||
"ayanamsa", "node_mode", "asked_probe_keys", "column_times", "minute_step", "blocks",
|
||||
}) | _REQUEST_PROVENANCE_FIELDS
|
||||
ASKED_PROBE_KEY_MAX_LENGTH = 200
|
||||
_EVENT_FIELDS = frozenset({"id", "domain", "event_kind", "date_start", "date_end", "precision", "summary"}) | _EVENT_PROVENANCE_FIELDS
|
||||
@@ -169,6 +169,7 @@ class RectificationRequest(TypedDict):
|
||||
local_time_status: NotRequired[str | None]
|
||||
asked_probe_keys: NotRequired[list[str]]
|
||||
dropped_asked_probe_keys: NotRequired[int]
|
||||
column_times: NotRequired[list[str]]
|
||||
minute_step: NotRequired[int]
|
||||
blocks: NotRequired[list[dict[str, Any]]]
|
||||
|
||||
@@ -354,6 +355,20 @@ def normalize_rectification_request(body: Any, *, today: date | None = None) ->
|
||||
cleaned_request["asked_probe_keys"] = cleaned_keys
|
||||
if dropped:
|
||||
cleaned_request["dropped_asked_probe_keys"] = dropped
|
||||
if "column_times" in body:
|
||||
raw_times = body.get("column_times")
|
||||
if not isinstance(raw_times, list) or not 1 <= len(raw_times) <= 64:
|
||||
raise ValueError("column_times must contain between 1 and 64 HH:MM values")
|
||||
cleaned_times: list[str] = []
|
||||
seen_times: set[str] = set()
|
||||
for index, item in enumerate(raw_times):
|
||||
if not isinstance(item, str) or not _CLOCK.fullmatch(item):
|
||||
raise ValueError(f"column_times[{index}] must be HH:MM")
|
||||
if item in seen_times:
|
||||
continue
|
||||
seen_times.add(item)
|
||||
cleaned_times.append(item)
|
||||
cleaned_request["column_times"] = cleaned_times
|
||||
if "minute_step" in body:
|
||||
minute_step = body.get("minute_step")
|
||||
if isinstance(minute_step, bool) or not isinstance(minute_step, int) or not 1 <= minute_step <= 15:
|
||||
|
||||
Reference in New Issue
Block a user