Skip to content

Preserve caller fetch modifiers when adding keyword options - #746

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/modifiers-imap
Open

Preserve caller fetch modifiers when adding keyword options#746
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/modifiers-imap

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Copy a supplied fetch modifier array before appending PARTIAL or CHANGEDSINCE keyword options. Reusing the same array currently accumulates duplicate modifiers, and frozen arrays raise FrozenError. Calls without keyword additions retain the existing allocation behavior.

Reproduction

require 'net/imap'
imap = Net::IMAP.allocate
def imap.send_command_returning_fetch_results(*args) = args
modifiers = ['VANISHED'].freeze
p imap.uid_fetch(1..3, 'UID', modifiers, changedsince: 9).last
# Before: FrozenError. After: ["VANISHED", "CHANGEDSINCE", 9].
p modifiers # still ["VANISHED"]

Verification

  • 260 focused checks, 86 failing expectations before and zero afterward. Mutable/frozen, empty/nonempty modifiers, FETCH/UID FETCH, repeated calls, partial/changedsince separately and together, zero modseq and invalid keyword inputs are covered.
  • Existing rake test on this isolated branch: 1726 tests, 12599 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications, Ruby 4.0.6 via rbenv. Baseline also passes 1,726 tests; assertion counts vary slightly between runs.
  • Supplemental RuboCop Lint retains the same 48 existing findings. Syntax and git diff --check pass. No new/modified repository tests, dependencies or workflows; focused checks were external under the consumer repository's no-new-tests policy.
  • Based on master 6d2ef7a636a1e2449187a83b06ac7a5baa54ead2; runtime differs from released 0.6.6 only in documentation before this change. Existing upstream PR searches found no matching fix.

Compatibility and limits

No signature, version or dependency change. Caller modifier arrays are no longer modified by keyword additions, including on validation errors. Only a shallow copy is needed; contained modifier objects are not changed. The reproduction stubs only command dispatch to stay offline. No production or external IMAP service used. Other Ruby/OS versions were not run locally. Local success does not imply upstream CI approval or exhaustive coverage.

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.

1 participant