Repository navigation
Bind net-imap (Net::IMAP) into rbgo - #202
Closed
tannevaled wants to merge 1 commit into
Closed
tannevaled wants to merge 1 commit into
tannevaled wants to merge 1 commit into
Conversation
Wire the pure-Go go-ruby-net-imap/net-imap command builder + response
parser into the interpreter so `require "net/imap"` works with no .rb
file, giving a live Net::IMAP session over an injected IO seam.
The library is deterministic (command encoding + response grammar) and
never opens a socket; the transport is the host's job. Like the redis /
pg bindings, Net::IMAP.new takes an injected IO-like connection
(connection:/conn: keyword or a positional IO — a StringIO, a TCPSocket,
or an OpenSSL::SSL::SSLSocket for TLS, all responding to #read/#write).
rubyConn bridges it to the library Reader's line/literal callbacks.
Surface (net_imap.go + net_imap_bind.go):
- Net::IMAP.new + greeting/responses/disconnect/disconnected?
- login, authenticate (PLAIN/LOGIN/CRAM-MD5/XOAUTH2 via the library's
SASL encoders), select, examine, create, delete, rename, subscribe,
unsubscribe, list, lsub, status, fetch, uid_fetch, store, uid_store,
copy, uid_copy, search, uid_search, expunge, append (literals),
capability, noop, logout, check, close, unselect, starttls
- Net::IMAP.encode_utf7 / decode_utf7
- typed value classes mirroring Net::IMAP::* member-for-member
(TaggedResponse / UntaggedResponse / ContinuationRequest /
ResponseText / ResponseCode / MailboxList / StatusData / FetchData /
Envelope / Address / AppendUIDData / CopyUIDData / BodyType{Text,
Basic,Message,Multipart}) and the Net::IMAP error tree
- full error mapping (NoResponseError / BadResponseError /
ByeResponseError / ResponseParseError / DataFormatError)
registerNetIMAP runs after registerSocket/registerOpenSSL so a real
TCPSocket/SSLSocket can be the TLS seam; providedFeatures gains
"net/imap"; classOf gains *IMAPObj.
Tests drive the full surface over an in-process duplex FakeSock (no real
network, no leaked goroutines); 100% coverage of the new files
(deterministic Ruby-level tests + Go-level unit tests for defensive
arms). gofmt/vet/-race clean; builds on all six 64-bit arches.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Superseded by the net-wave consolidation PR (single merge onto main; shared builtins/require/object_model). Work preserved verbatim; branch kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wire the pure-Go
go-ruby-net-imap/net-imapcommand builder + response parser into the interpreter sorequire "net/imap"works with no.rbfile — a liveNet::IMAPsession over an injected IO seam.The library is deterministic (IMAP4rev1 command encoding + the response grammar) and never opens a socket — the transport is the host's job. Mirroring the
redis/pgbindings,Net::IMAP.newtakes an injected IO-like connection (connection:/conn:keyword, or a positional IO — aStringIO, aTCPSocket, or anOpenSSL::SSL::SSLSocketfor TLS, all responding to#read/#write).rubyConnbridges it to the libraryReader's line/literal callbacks.Surface
net_imap.go(shell + command methods) +net_imap_bind.go(protocol driver + value mapping + coercion):new,greeting,responses,disconnect,disconnected?login,authenticate(PLAIN/LOGIN/CRAM-MD5/XOAUTH2 via the library's SASL encoders),select,examine,create,delete,rename,subscribe,unsubscribe,list,lsub,status,fetch,uid_fetch,store,uid_store,copy,uid_copy,search,uid_search,expunge,append(with literal continuation),capability,noop,logout,check,close,unselect,starttlsNet::IMAP.encode_utf7/decode_utf7Net::IMAP::*member-for-member:TaggedResponse/UntaggedResponse/ContinuationRequest/ResponseText/ResponseCode/MailboxList/StatusData/FetchData/Envelope/Address/AppendUIDData/CopyUIDData/BodyType{Text,Basic,Message,Multipart}Error/ResponseError/NoResponseError/BadResponseError/ByeResponseError/ResponseParseError/DataFormatError, with faithful NO/BAD/parse/transport mappingWiring
registerNetIMAP()in bootstrap afterregisterSocket/registerOpenSSLso a realTCPSocket/SSLSocketcan be the TLS seamprovidedFeaturesgains"net/imap"classOfgains*IMAPObjVerification
internal/vm+internal/objectgreen;-raceon new tests greenFakeSock— no real network, no leaked goroutines — plus Go-level unit tests for defensive arms)gofmt -lclean,go vetclean, orphan-casescan clean🤖 Generated with Claude Code