Skip to content

Parse STATUS responses with empty attribute lists - #748

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

Parse STATUS responses with empty attribute lists#748
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/empty-status-imap

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Accept an empty attribute list in a STATUS response and return StatusData with an empty attr hash. The response grammar permits the list to be absent inside parentheses, but the parser currently unconditionally requires its first attribute.

Reproduction

require 'net/imap'
p Net::IMAP::ResponseParser.new.parse("* STATUS INBOX ()\r\n").data.attr
# Before: ResponseParseError. After: {}.

Verification

  • 74 focused checks, 48 failing expectations before and zero afterward. Atom/quoted/literal mailbox names, keyword casing, existing trailing-space tolerance, frozen inputs, input retention and populated responses are covered. RFC3501 section 9 explicitly makes status-att-list optional: https://www.rfc-editor.org/rfc/rfc3501.html#section-9
  • Existing rake test on this isolated branch: 1726 tests, 12594 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 or existing valid-response shape change. Previously rejected valid empty responses now return an empty hash. Nonempty attribute parsing is unchanged; no new malformed-input tolerance is introduced. 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