Skip to content

Honor clone freeze keywords for Config and SequenceSet - #739

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

Honor clone freeze keywords for Config and SequenceSet#739
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/clone-imap

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Forward clone freeze keywords to Config internal data and honor them when copying SequenceSet runs. Thawed copies need mutable independent data; explicitly frozen copies need frozen internal data. Default frozen SequenceSet clones retain their shallow-copy optimization.

Reproduction

require 'net/imap'
original = Net::IMAP::SequenceSet['1:3']
copy = original.clone(freeze: false)
copy.delete(1)
p [original.to_s, copy.to_s, copy.frozen?] # ["1:3", "2:3", false]
config = Net::IMAP::Config.default.clone(freeze: false)
config.open_timeout = 12
p config.open_timeout # 12
# Before: both clone calls raise ArgumentError for the keyword argument.

Verification

  • 212 focused checks; 78 failing expectations before, zero afterward. Config/SequenceSet cases cover mutable/frozen/default/empty/full originals, omitted freeze and nil/false/true, internal frozen state, mutation and original ownership. Existing 🐛 Fix Config#clone to clone internal data struct #303/♻️ Refactor SequenceSet#dup, #clone, and #replace #505 fix earlier copying behavior; open 🔧 Make Config.global Ractor shareable #595 proposes a broader global/Ractor config design and is not included.
  • Existing rake test on this isolated branch: 1726 tests, 12592 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications, Ruby 4.0.6 via rbenv. The baseline also passes all 1,726 tests; assertion counts vary slightly across runs.
  • Supplemental RuboCop Lint retains the same 48 existing findings. Ruby syntax and git diff --check pass. No repository tests, dependencies or workflows were added or modified; focused reproductions live outside the repository under the consumer's no-new-tests policy.
  • Independent branch based on 6d2ef7a636a1e2449187a83b06ac7a5baa54ead2; the runtime diff from released 0.6.6 is documentation-only before this patch.

Compatibility and limits

No new public API or Ruby minimum. Standard clone(freeze:) calls now work. Default clone and dup semantics remain. This patch does not make global configuration Ractor-shareable. Other Ruby/OS versions were not run locally. No production or external IMAP service was used. Local verification does not imply upstream CI approval or comprehensive behavioral coverage.

@nevans

nevans commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PRs! I'm not sure what "focused reproductions live outside the repository under the consumer's no-new-tests policy" means, but tests are generally appreciated. :)

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.

2 participants