fix(rectification): keep clock-stamped events out of window intercept (BUG-631, BUG-632)
Independent Staging Quality Gate / validate (push) Successful in 12m36s
Independent Staging Quality Gate / publish (push) Successful in 2m11s

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:
Jesse_Chen
2026-09-10 09:23:35 +08:00
co-authored by Cursor
parent 2de2aa0b71
commit 719ff55a09
19 changed files with 395 additions and 24 deletions
+16 -1
View File
@@ -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: