Read enhanced status codes, and check that we emit them
`Reply.enhanced` parses the class.subject.detail code RFC 3463 defines
and RFC 2034 puts at the front of a reply's text; `Reply.message` gives
the text without it. 550 is "no", where 5.1.1 is "no, that mailbox does
not exist" and 5.7.1 is "no, and not because of anything about the
address" -- a difference a caller can act on and the three digits cannot
express.
The parser is strict on purpose, because the failure mode of a loose one
is misreading an ordinary message that happens to start with digits. The
class must be one of the three RFC 3463 defines, each field is one to
three digits with no leading zeros, and the code must be followed by a
space or be the whole text. "2.1 GB is too large" is not a status code
and does not parse as one.
`agrees` is there because nothing else checks it: a 250 carrying a 5.x.x
code is a server contradicting itself, RFC 3463 does not say what a
receiver should do about that, and a caller that reads only one half will
believe the wrong one.
The other half of this is a test that walks a session touching most of
the command table and checks every reply against RFC 2034's rule --
prefaced with a code whose class agrees, except the greeting, the EHLO
response and any 3xx, which must *not* carry one. It passes, and it is
not vacuous: deleting the code from one reply makes it fail naming that
line.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SDrB41sGu5k1ubD1ufbxqC