Skip to content

fix: reject calendar grids beyond chrono's date range instead of panicking - #249

Draft
TwoDCube wants to merge 1 commit into
fix/events-calendar-grid-endfrom
fix/calendar-grid-earliest-month
Draft

TwoDCube wants to merge 1 commit into
fix/events-calendar-grid-endfrom
fix/calendar-grid-earliest-month

Conversation

@TwoDCube

Copy link
Copy Markdown
Member

Fixes a bug recorded by the tests in #246. Stacked on #248 (base fix/events-calendar-grid-end), because both change calendar_grid_range. This is a draft until #246, #247 and #248 merge.

Bug

For the earliest month chrono can represent, calendar_grid_range stepped back to the preceding Monday with unchecked NaiveDateTime arithmetic. That overflowed and panicked (NaiveDateTime - TimeDelta overflowed), so events for that month returned HTTP 500 instead of a GraphQL error.

Fix

Use checked_sub_signed / checked_add_signed and return None when the grid would leave chrono's range. The events resolver already turns None into its invalid date error.

Tests

  • calendar_grid_does_not_panic_at_the_earliest_representable_month is no longer ignored.
  • The proptest date_ranges_never_panic covers calendar_grid_range again.
  • cargo clippy --workspace --all-targets -D warnings is clean. CI=true cargo test --workspace passes against MySQL 8.4 and Redis 6.2.

🤖 Generated with Claude Code

@verseghy-prow

verseghy-prow Bot commented Sep 14, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TwoDCube

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@verseghy-prow verseghy-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2026
…cking

For the earliest month chrono can represent, stepping back to the preceding
Monday overflowed NaiveDateTime and panicked, so `events` for that month
returned HTTP 500. Use checked arithmetic and return None, which the events
resolver already reports as "invalid date".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@TwoDCube
TwoDCube force-pushed the fix/events-calendar-grid-end branch from 8038d30 to ec6e13d Compare September 14, 2026 18:22
@TwoDCube
TwoDCube force-pushed the fix/calendar-grid-earliest-month branch from 3eb6ef2 to 5cd2e0c Compare September 14, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant