Skip to content

Support day, month, and year recurrence intervals - #11

Closed
seungjuchoi wants to merge 1 commit into
raine:mainfrom
seungjuchoi:interval-and-yearly-recurrence
Closed

seungjuchoi wants to merge 1 commit into
raine:mainfrom
seungjuchoi:interval-and-yearly-recurrence

Conversation

@seungjuchoi

Copy link
Copy Markdown
Contributor

Hi! Thanks for building aven — I use it daily and it has been great.

One gap I kept running into is that the recurrence grammar has no day-based intervals and nothing above monthly, so things like "water the plants every 3 days" or "wedding anniversary every year" can only be approximated with rules like every 52 weeks. This PR extends the rule grammar to cover those cases.

What's added

Rule Schedule
every N days Every N days from the start date.
every N months The start date's day number every N months.
yearly The start date's month and day every year.
every N years Same, every N years.

All new rules anchor on --repeat-start-on, consistent with the existing monthly behavior:

  • Day intervals count from the start date.
  • Month intervals keep the start date's day number and clamp to shorter months (a Jan 31 quarterly series runs Apr 30, Jul 31, Oct 31).
  • Yearly rules keep the start month and day; a Feb 29 anchor runs on Feb 28 outside leap years and returns to Feb 29 in leap years.
  • Existing rules are untouched — daily/monthly with interval 1 evaluate exactly as before.

The TUI/natural-language input additionally accepts annually, every year, and friendly forms like every 3 days, and the AI intake prompt and docs are updated to match.

Implementation notes

  • Core: RecurrenceFrequency gains a Yearly variant, and the interval-must-be-1 restriction on daily/monthly is lifted. Weekday sets remain weekly-only.
  • Migration: recurrence_series is rebuilt to relax the frequency/interval CHECK constraints, following the same pattern as 20260728183707_support_monthly_recurrence.sql (data copied over, trigger and indexes recreated).
  • Sync: SYNC_PROTOCOL_VERSION is bumped 13 → 14 so older peers get a clean sync-protocol-unsupported error instead of failing mid-apply on a frequency they can't parse — following the precedent of the task-metadata bump (12 → 13). Happy to handle this differently if you'd prefer another compatibility strategy.
  • uniffi: the mirrored RecurrenceFrequency enum gains Yearly.

Deliberately not included: monthly on 15 / monthly on last day / monthly on last fri, since those need new rule fields (ordinal weekdays, explicit month days) and felt like a separate design discussion. Monthly dates stay start-date-anchored.

Testing

  • New unit tests for the schedule math (day intervals, month clamping, Feb 29 yearly anchors), the CLI grammar, and the natural-language parser.
  • cargo test --workspace, cargo clippy, cargo fmt all clean on my machine (the only failures are a handful of pre-existing ones that also fail for me on a clean main checkout — happy to share details).
  • Manual CLI smoke test: created yearly, every 3 days, every 3 months (Jan 31 anchor → Oct 31 slot), and every 2 years series against a fresh DB and verified recur list labels and slots.

Happy to adjust anything — naming, migration approach, or scope. Thanks for taking a look!

Extend the recurrence rule grammar with every N days, every N months,
yearly, and every N years. All new rules anchor on the series start
date: day intervals count from it, month intervals keep its day number
and clamp to shorter months, and yearly rules keep its month and day,
returning on February 28 outside leap years for February 29 anchors.

The natural-language schedule input additionally accepts annually,
every year, and friendly interval forms such as every 3 days.

Rebuild the recurrence_series table to relax the frequency and
interval CHECK constraints, and bump the sync protocol version so
older peers fail fast with a clear upgrade error instead of choking
on rule payloads they cannot parse.
@raine

raine commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Hey, thanks a lot for the pull request. I really appreciate it

The change turned out to be more complex than I expected, and workflow-wise it was easier for me to reimplement it using my own AI workflow and test it from scratch. This isn’t personal or a reflection on your work. Your PR was helpful in shaping and validating the feature. Thanks again for taking the time to contribute! 🙏

@raine raine closed this Aug 19, 2026
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.

2 participants