Skip to content

feat(recur): add interval property accessor - #2066

Open
aspire488 wants to merge 27 commits into
PyCalendar:mainfrom
aspire488:feat/vrecur-interval-accessor
Open

aspire488 wants to merge 27 commits into
PyCalendar:mainfrom
aspire488:feat/vrecur-interval-accessor

Conversation

@aspire488

@aspire488 aspire488 commented Nov 6, 2026 •

Copy link
Copy Markdown

Linked issue

Description

Adds an "interval" property to "vRecur" for accessing the "INTERVAL" part of an iCalendar recurrence rule.

The accessor:

  • Returns the stored interval as an integer, or "None" when the property is absent or empty. RFC 5545 defines the effective default as 1; returning "None" preserves the distinction between an omitted value and an explicitly supplied value.
  • Accepts positive integers when setting the property and stores them as "vNonNegativeInt".
  • Removes the complete "INTERVAL" entry when assigned "None" or deleted.
  • Rejects booleans and non-integer assignments with "TypeError", and rejects zero or negative values with "InvalidCalendar".
  • Follows the existing accessor convention of reading the first value if a sequence is present.

The change includes regression tests for parsing, assignment, deletion (including multi-value entries), invalid values, and iCalendar serialization. A separate changelog entry was added.

This implements only the "INTERVAL" accessor portion of #1851; it does not close the issue.

Checklist

  • I added a change log entry, following the project requirements.
  • I followed the AI policy and disclosed AI assistance in the commit messages and changelog.
  • I added regression tests.
  • I ran and ensured all tests pass locally.
  • I added API documentation through accessor docstrings.

Additional information

The implementation and regression tests were assisted by OpenAI GPT-6. I reviewed the changes against existing "vRecur" accessors and the project's contribution requirements. The test suite has not yet been run locally.

AI model: OpenAI GPT-6.
AI use: drafted the INTERVAL getter, setter, deleter, and regression tests following the existing vRecur count/wkst patterns. Prompt summary: add an interval accessor with positive-integer validation, None/deletion semantics, and tests for parsing, mutation, invalid values, and iCalendar round-tripping. I reviewed the implementation and repository contribution policy.
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @aspire488! A maintainer will review it shortly.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Automation signals

Activity patterns show signs of automation.

View full analysis →

Report this account →

Evidence
  • Issue comment and PR within minutes: Commented on an issue and opened a PR to the same repo within 5 minutes, in 3 repositories (the fastest took 79s)
  • High push frequency: 78 consecutive same-repo push pairs within 10 min of each other (109 pushes involved)

Last 3 PRs:

This is an automated analysis by AgentScan

@github-actions github-actions Bot added the ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding. label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

One or more PR-quality checks did not pass. Review the PR Quality Checks summary in the workflow run for the failed checks and their details, then make any necessary updates.

Checklist items may remain unchecked while work is in progress. Please tick each item as you complete it.

If you used AI assistance, follow the project's Responsible AI use policy and provide the required disclosures.

@github-actions github-actions Bot added the agentscan:automated-account AgentScan flagged this item as coming from an automated account, and it needs review label Nov 6, 2026
@angatha

angatha commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Thank oyu for your contribution. Please work on the unchecked items in the PR description. Additionally please link the related issue correctly. There is placeholder text within the tempalte to do that.

Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
@angatha

angatha commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Thank you for addressing the feedback. I'm curious, why you just used consistent naming for positiv eint requirement instead of explaining, why you did it that way. I was just curious why that happen. And it definetly looks like an agent who just works on feedback instead of a human contributing, to be honest.

@aspire488

Copy link
Copy Markdown
Author

Thank you for addressing the feedback. I'm curious, why you just used consistent naming for positiv eint requirement instead of explaining, why you did it that way. I was just curious why that happen. And it definetly looks like an agent who just works on feedback instead of a human contributing, to be honest.

Thanks for asking. My reasoning was primarily consistency with the existing "vRecur" accessors, particularly "count", while keeping the validation specific to "INTERVAL".

The distinction is that "COUNT" can be zero, whereas RFC 5545 specifies "INTERVAL" as a positive integer, so I deliberately reject zero and negative values.

I followed the existing accessor conventions for reading the first stored value, handling missing values, and deleting the property. I should have explained that reasoning more clearly in the implementation rather than leaving the validation behavior to speak for itself.

I appreciate you pointing this out. I'll make sure the reasoning is clearer in future contributions.

@angatha angatha self-assigned this Nov 7, 2026

@angatha angatha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This still needs a doc review. Can you please clean up the PR description.

@angatha
angatha self-requested a review November 7, 2026 11:08
@aspire488

Copy link
Copy Markdown
Author

@angatha I've cleaned up the PR description, linked the related issue as "Contributes to #1851", removed the template placeholders, and updated the checklist to reflect the completed work.

The full test suite has not been run locally yet, so that item remains unchecked.

Thank you for the guidance!

angatha
angatha previously approved these changes Nov 7, 2026

@angatha angatha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes are fine. Just the dock review is missing

@aspire488

Copy link
Copy Markdown
Author

@stevepiercy Could you please take a look at the documentation for this PR? Angatha has approved the code changes, and mentioned that a documentation review is still missing. Thanks!

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe I'm doing something wrong, but I think this doesn't work as described in the docstrings. Would you please take a look, and let me know. Thank you!

Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
@aspire488

Copy link
Copy Markdown
Author

Thanks for the review. I've updated the implementation:

  • "INTERVAL" now uses "vPositiveInt" in "vRecur.types".
  • Zero and negative values are rejected during parsing.
  • The accessor documentation now distinguishes parsing errors from invalid values assigned directly to the dictionary.
  • Added regression tests for malformed values, non-positive values, and directly stored invalid values.
  • Updated the documentation examples and exception descriptions.

The changes are pushed to the existing PR branch. CI is running against the updated commits.

@stevepiercy

Copy link
Copy Markdown
Member

@aspire488 please run tests locally before pushing commits, and update your branch to main. No one can review a PR in this state.

@stevepiercy
stevepiercy requested a review from angatha November 15, 2026 09:13

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/integer.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
@aspire488

Copy link
Copy Markdown
Author

Hi Steve,

Apologies for leaving those comments unaddressed earlier, and thank you for taking the time to review the implementation so thoroughly.

I've now gone through the outstanding feedback and pushed the requested updates:

  • Clarified the exception documentation for the "interval" accessor.
  • Updated the "vPositiveInt" docstring as suggested.
  • Added tests covering directly stored zero and negative interval values.
  • Reviewed the potentially unreachable validation branches and clarified which cases are reachable through parsing versus direct assignment.

I've also pushed the changes to the PR. The CI checks are currently running.

Thanks again for your patience and for the detailed feedback!

#2066

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The light bulb in my head finally turned on. I kept using the Property access method, not the Dictionary access method.

I made a few more suggestions to clarify things to the reader and developer. Would you please take care? Then I'll approve. Thank you!

Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
Comment thread src/icalendar/prop/recur/recur.py Resolved
@aspire488

Copy link
Copy Markdown
Author

Thanks, Steve! I've addressed all three suggestions:

  • Clarified the dictionary-access and property-access terminology in the exception documentation.
  • Updated both invalid-type error messages to include the actual value type.
  • Added/updated regression tests to cover these error messages.

The changes are pushed to the PR. Thanks for the detailed feedback!

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we have a winner! Thanks for your collaboration and patience, @aspire488.

I'm going to turn it back over to @niccokunzmann and @angatha for a final review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:automated-account AgentScan flagged this item as coming from an automated account, and it needs review ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants