Repository navigation
fix(tasks): keep monthly repeats on one task per month - #1309
saariuslystoned wants to merge 4 commits into
Conversation
addRepeat used time.AddDate for monthly and yearly series. AddDate carries an overflowing day into the next month, so a monthly series from January 31 produced January 31, March 3, March 31 and May 1, and a February 29 yearly series moved to March 1. Add calendar months instead and use the target month's last day when it is shorter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex review: ready, awaiting a maintainer decision. What this changesThis PR clamps monthly and yearly task dates to the last valid day of shorter months. Example: Create four monthly Rent tasks starting on 2026-01-31.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision This PR fixes a current scheduling defect, and the prior changelog finding is resolved; an area owner should confirm the proposed short-month semantics. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Tasks CLI parses recurrence flags, expands dates locally, and inserts a separate Google Task for each occurrence. flowchart LR
A[Tasks add flags] --> B[Date and cadence plan]
B --> C[Repeat schedule]
C --> D[Clamped calendar dates]
D --> E[Tasks API inserts]
E --> F[Created tasks and CLI output]
Technical reviewBest possible solution: Confirm one short-month rule for all cadence aliases and retain the focused repair in the existing schedule owner. Do we have a high-confidence way to reproduce the issue? Current-main source directly explains the overflowing dates, and the contributor supplies matching before-and-after CLI traces; no target code was run during this read-only review. Is this the best way to solve the issue? The patch is a small shared-owner repair with distinct regression coverage; its remaining question is the intended calendar semantics rather than an identified implementation defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e8428c36dd31. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 8, 2026, 8:15 AM ET / 13:15 UTC (Revision 2). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
addMonthsClamped built the first day of the target month at the start's clock time in the start's location. Where daylight saving begins at midnight (America/Asuncion on 2023-10-01), that local time does not exist and normalized into the previous month, so a local 00:00 monthly series stayed in September. Compute the target month in UTC, then apply the original clock and location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed 80b6440: the month-end clamp now picks the target month in UTC, so a local midnight start in a zone where daylight saving begins at midnight (America/Asuncion, 2023-10-01) no longer stays in the same month. A regression test covers it, the CHANGELOG line has the contributor credit, and the body now states the RFC 5545 skip rule next to the clamp choice. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What problem this solves
gog tasks add --repeat monthly(also--recur monthlyand--recur-rrule FREQ=MONTHLY) materializes each occurrence withtime.AddDate(0, n, 0).AddDatenormalizes an overflowing day into the following month, so a series that starts on a day the target month lacks skips that month and lands early in the next:Yearly series from February 29 move to March 1 in common years for the same reason. Any start on the 29th, 30th or 31st is affected.
--repeat-untilseries are affected too, and can end with fewer tasks than months.Change
addRepeatnow adds calendar months and keeps the start's day of month, using the target month's last day when the month is shorter: January 31 is followed by February 28, March 31 and April 30. Each occurrence is still computed from the start date, so later months return to the 31st. Yearly series step 12 months, so February 29 falls on February 28 in common years. Daily and weekly series are unchanged, and so is the time of day for--duevalues that carry a time.Why clamp, not RFC 5545 skipping
RFC 5545 §3.3.10 says a recurrence rule that generates an invalid date, such as February 30 or February 29 in a common year, must ignore that instance and must not count it. Under that rule,
FREQ=MONTHLY;COUNT=4from January 31 gives January 31, March 31, May 31 and July 31, and a February 29 yearly series occurs only in leap years.This PR clamps instead, for three reasons:
--recur-rruleis not an RRULE engine.parseRepeatRRuleaccepts onlyFREQandINTERVALand rejectsBYMONTHDAY,COUNT,UNTILand every other part. Its help calls it an "Alias for --repeat cadence via RRULE", so all three flags share one cadence rule.--repeat-count 4reads as "four monthly tasks". Clamping keeps one task per month. Skipping would spread four tasks over seven months, and a February 29 yearly series would produce one task every four years.java.time.LocalDate.plusMonths, .NETDateTime.AddMonths, date-fnsaddMonths, dateutilrelativedelta.Either choice fixes the current output, which follows neither rule (two March tasks and none in February). If you prefer RFC 5545 skipping, the change is confined to
addMonthsClampedand the expected dates in the three tests.Evidence
Regressions in
internal/cmd/tasks_repeat_test.godriveTasksAddCmdagainst anhttptestTasks server and check each inserteddue: monthly from Jan 31 with--repeat-count,--recur-rrule FREQ=MONTHLYwith--repeat-untiland a time of day, and yearly from Feb 29. All three fail onmain(e8428c3) with the schedules above and pass with this change.The target month is computed in UTC, then the start's clock time and location are applied. Building the first of the month at the start's clock time in a local zone can land in the previous month where daylight saving begins at midnight. America/Asuncion skipped 00:00 on 2023-10-01, so a local
--due "2023-09-15 00:00"monthly series stayed in September.TestAddMonthsClampedIgnoresMidnightDSTGapcovers this: it fails on the first revision of this PR and passes on 80b6440. Date-only and offset--duevalues parse in UTC or a fixed zone and were never affected.A built
bin/gogfrommainand from this branch was run against a local Tasks stand-in throughGOG_GOOGLE_API_BASE_URL, with an emptyGOG_HOMEand the file keyring. The stand-in is not Google and logs each inserteddue:make cipassed locally on 80b6440 (macOS arm64, go1.27.3): fmt-check, lint, deadcode, the full test suite, docs-check and agent-skills-check.The schedule is computed locally, before any request, so the change does not depend on Google Tasks behavior. No live Google account was used.
🤖 Generated with Claude Code