Skip to content

fix: collection period adjustment - #20

Merged
drugoi merged 1 commit into
mainfrom
period-adjustment
Mar 31, 2026
Merged

drugoi merged 1 commit into
mainfrom
period-adjustment

Conversation

@maximgorbatyuk

Copy link
Copy Markdown
Collaborator

'Week' meaning 'this week' -> last 7 days
'Month' meaning 'this month' -> last 30 days

@maximgorbatyuk maximgorbatyuk changed the title DRAFT: Period adjustment Period adjustment Mar 18, 2026
@drugoi

drugoi commented Mar 22, 2026

Copy link
Copy Markdown
Owner

@maximgorbatyuk please, cleanup / reopen this MR.

Screenshot 2026-03-22 at 13 43 09

@drugoi
drugoi force-pushed the period-adjustment branch from a608816 to 775f7d8 Compare March 30, 2026 15:19
@drugoi drugoi changed the title Period adjustment fix: collection period adjustment Mar 30, 2026

@drugoi drugoi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review (PR #20)

What looks good

  • Copy in interactive.rs and the Week / Month doc comments now match the new rolling-window intent.
  • Datelike import removal is correct after dropping calendar-week / month-start logic.
  • Tests were updated consistently with the implementation; cargo test passes.

Issue: off-by-one vs “last 7 / 30 days”

load_commits_for_window uses query_date_range(from, to), and date_range_bounds_in_timezone includes both from and to as full local calendar days (committed_at >= start_of(from) and < start_of(to.next_day())).

So with week_start = today - Duration::days(7) and to = today, the inclusive calendar span is 8 days (e.g. 2026-03-05 … 2026-03-12), not 7. Similarly today - 30 through today is 31 inclusive days in typical month boundaries (e.g. Feb 10 … Mar 12 in the test), not 30.

If the product intent is exactly seven / thirty calendar days ending today, the starts are usually today - 6 and today - 29 respectively (with matching test expectations and labels).

Worth fixing so CLI copy, AI ai_period text, and actual query windows stay aligned.

Nit (out of diff)
README.md still mentions this week / this month in the template-variable example; consider updating when you touch docs.

Week and Month periods used days(7)/days(30) offsets but
date_range_bounds_in_timezone includes both endpoints as full calendar
days, resulting in 8/31 day spans. Changed to days(6)/days(29) so the
inclusive range is exactly 7/30 days as labeled.
@maximgorbatyuk

Copy link
Copy Markdown
Collaborator Author

#20 (review)

fixed, commits history is rewritten

@drugoi
drugoi merged commit 02097ef into main Mar 31, 2026
1 check passed
@drugoi
drugoi deleted the period-adjustment branch March 31, 2026 07:24
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