Skip to content

Reject gapped events#5

Merged
rsgalloway merged 2 commits into
masterfrom
fix/reject-gapped-events
May 31, 2026
Merged

Reject gapped events#5
rsgalloway merged 2 commits into
masterfrom
fix/reject-gapped-events

Conversation

@rsgalloway
Copy link
Copy Markdown
Contributor

@rsgalloway rsgalloway commented May 31, 2026

This pull request introduces a new validation function for event data, ensuring that event date sequences are strictly increasing and consecutive, with no gaps. The validation logic is now centralized and reused across the codebase, improving data integrity and maintainability. The release version is also bumped to 0.5.9, and copyright years are updated.

Event validation improvements:

  • Added a new validate_events function in drawcal/events.py to check that each event is a list of consecutive, strictly increasing date strings in "M/D/YYYY" format. This function raises descriptive errors for invalid input.
  • Updated read_events to use validate_events, removing duplicate validation logic and ensuring consistent checks for events loaded from files.
  • Updated draw_calendar in drawcal/drawlib.py to call validate_events when events are provided directly, enforcing validation for all event entry points. [1] [2]

Testing enhancements:

  • Added new unit tests in tests/test_events.py and tests/test_render.py to verify that gapped or non-consecutive events are correctly rejected by both file and direct input validation. [1] [2] [3]

Versioning and metadata:

  • Bumped the project version to 0.5.9 in pyproject.toml and drawcal/__init__.py. [1] [2]
  • Updated copyright years to 2026 in all relevant files. [1] [2] [3] [4] [5] [6]

These changes ensure that event data is consistently validated, preventing subtle bugs and improving user feedback for incorrect input.

@rsgalloway rsgalloway linked an issue May 31, 2026 that may be closed by this pull request
@rsgalloway rsgalloway self-assigned this May 31, 2026
@rsgalloway rsgalloway added the bug Something isn't working label May 31, 2026
@rsgalloway rsgalloway requested a review from Copilot May 31, 2026 12:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR centralizes event validation so both file-loaded and directly provided events reject non-consecutive date sequences before rendering, while also bumping the package version and updating copyright years.

Changes:

  • Adds validate_events for list/date format checks plus strict consecutive ordering.
  • Reuses validation from read_events and draw_calendar.
  • Adds regression tests for gapped events and updates metadata to 0.5.9 / 2026.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/drawcal/events.py Adds centralized event validation and applies it to file-loaded events.
lib/drawcal/drawlib.py Validates directly supplied events before rendering.
tests/test_events.py Adds tests for rejecting gapped events from files and direct validation.
tests/test_render.py Adds render-entry validation coverage for gapped events.
pyproject.toml Bumps project version to 0.5.9.
lib/drawcal/__init__.py Bumps runtime package version and copyright year.
LICENSE Updates copyright year.
bin/drawcal Updates copyright year.
lib/drawcal/cli.py Updates copyright year.
lib/drawcal/config.py Updates copyright year.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rsgalloway rsgalloway merged commit 9a7fedd into master May 31, 2026
6 checks passed
@rsgalloway rsgalloway deleted the fix/reject-gapped-events branch May 31, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gaps in event dates

2 participants