Skip to content

Reject impossible /schedule calendar dates instead of overflowing the month - #349

Merged
tylerreckart merged 5 commits into
mainfrom
cursor/bc-5398f738-f2e5-4dec-9a2b-1c10bad828db-1da3
Sep 21, 2026
Merged

tylerreckart merged 5 commits into
mainfrom
cursor/bc-5398f738-f2e5-4dec-9a2b-1c10bad828db-1da3

Conversation

@cursor

@cursor cursor Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

on YYYY-MM-DD only checked month 1–12 and day 1–31, so on 2027-02-31 / on 2026-06-31 / non-leap Feb 29 parsed as success. mktime then normalized the overflow (Feb 31 → early March) and the one-shot fired on a different civil day than the agent asked for.

parse_ymd now round-trips the date at noon and fails closed with invalid YYYY-MM-DD. Leap day on 2028-02-29 still works. Distinct from #318 (interval integer overflow) and #334 (resume/pause status).

unit_schedule_parser 8/8 locally (+ ASan/UBSan, 79 assertions).

merge-tree vs main: CLEAN. vs #334: schedule_parser.cpp / tests auto-merge (parse_ymd vs resume helpers); only CHANGELOG [Unreleased] sibling-conflicts, same as #321–#348.

Open in Web View Automation 

Note

Low Risk
Localized validation change in schedule phrase parsing with new unit tests; behavior tightens invalid input only and does not alter valid schedules beyond rejecting previously mis-normalized dates.

Overview
/schedule one-shot dates now fail closed on impossible calendar days instead of accepting on YYYY-MM-DD when only month/day ranges were checked and mktime silently rolled overflow (e.g. Feb 31 → March).

parse_ymd round-trips the parsed date through mktime at local noon and requires the normalized tm fields to match the input, which rejects Jun 31, non-leap Feb 29, etc., while still allowing valid leap days. Unit tests cover overflow rejection, leap-year acceptance, and the existing invalid YYYY-MM-DD error path.

The changelog [Unreleased] section documents this fix.

Reviewed by Cursor Bugbot for commit 376e71e. Bugbot is set up for automated code reviews on this repo. Configure here.

… month.

on YYYY-MM-DD only checked 1..12 / 1..31, so Feb 31 and Jun 31 were
accepted and mktime rolled them into the next month. Round-trip the
civil date at noon and fail closed with invalid YYYY-MM-DD.

Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
…e5-4dec-9a2b-1c10bad828db-1da3

# Conflicts:
#	CHANGELOG.md
@tylerreckart
tylerreckart marked this pull request as ready for review September 21, 2026 12:58
@tylerreckart
tylerreckart enabled auto-merge (squash) September 21, 2026 12:58
…e5-4dec-9a2b-1c10bad828db-1da3

# Conflicts:
#	CHANGELOG.md
…e5-4dec-9a2b-1c10bad828db-1da3

# Conflicts:
#	CHANGELOG.md
…e5-4dec-9a2b-1c10bad828db-1da3

# Conflicts:
#	CHANGELOG.md
@tylerreckart
tylerreckart merged commit 47b9e6f into main Sep 21, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants