Skip to content

Add integration test 012: per-recipient reject codes 100/101/102 - #18

Merged
markmnl merged 1 commit into
mainfrom
test-012-per-recipient-reject-codes
Aug 26, 2026
Merged

Add integration test 012: per-recipient reject codes 100/101/102#18
markmnl merged 1 commit into
mainfrom
test-012-per-recipient-reject-codes

Conversation

@markmnl

@markmnl markmnl commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Every existing test asserts a delivery; none asserts a per-recipient rejection, leaving fmsgd's validateMsgRecvForAddr ladder untested end to end and the sender-visible outcome of a bounce unverified (SPEC §10.4 step 6, §8).

The ladder checks duplicate -> unknown -> accepting -> limits in order, so each case isolates one rung:

Case Setup Expected
100 user unknown send to unseeded @dave@example.com per-recipient 100
102 user not accepting carol's fmsgid accepting_new = false 102, message never delivered
101 user full carol's limit_recv_count_per_1d = 0 101

All three cross the wire from hairpin.local: whether a recipient exists is not a header-level check — SPEC §10.3 step 3 asks only whether the recipient's domain is ours — so the header is accepted, the data downloaded, and the rejection arrives as the per-recipient response byte.

Each code is asserted twice: on the sender's msg_to.response_code, and on to_delivery[].response_code from GET /fmsg/:id, which is the only way a client learns why a message bounced and was covered by no test. That second assertion needs a bearer JWT, so test-lib.sh gains api_json_get, which exchanges an API key for one the way fmsg-cli does internally. Tests planned as 013/015/018 will reuse it.

Notes on the implementation details that shaped the test:

  • Code 101 is retryable (fmsgd retryableResponseCodes) while 100 and 102 are terminal, so non-delivery is asserted only for the 102 case.
  • Carol cannot authenticate while not accepting — the webapi token exchange itself consults fmsgid — so her mailbox is inspected only after the flag is restored.
  • fmsgd does not cache fmsgid lookups, so the edits take effect on the next delivery attempt with no restart.

Carol's original fmsgid settings are captured up front and restored via trap ... EXIT; leaving her not-accepting would break every later test involving her.

Also adds test/tests-to-add.md, a running list of spec paths the suite does not yet cover (tiered, with rationale per item), with 012 crossed off.

Full suite run locally against the podman runner: 12 passed, 0 failed.

🤖 Generated with Claude Code

Every existing test asserts a delivery; none asserts a per-recipient
REJECTION, leaving fmsgd's validateMsgRecvForAddr ladder untested end to
end and the sender-visible outcome of a bounce unverified (SPEC §10.4
step 6, §8).

The ladder checks duplicate -> unknown -> accepting -> limits in order, so
each case isolates one rung: send to an unseeded address (100), set
carol's fmsgid accepting_new false (102), set her daily receive count
limit to 0 (101). All three cross the wire from hairpin.local, since
whether a recipient exists is not a header-level check — SPEC §10.3 step 3
asks only whether the recipient's domain is ours.

Each code is asserted twice: on the sender's msg_to.response_code, and on
to_delivery[].response_code from GET /fmsg/:id, which is the only way a
client learns why a message bounced and was not covered by any test. That
second assertion needs a bearer JWT, so test-lib gains api_json_get, which
exchanges an API key for one the way fmsg-cli does internally.

Code 101 is retryable while 100 and 102 are terminal, so non-delivery is
asserted only for the 102 case. Carol's original fmsgid settings are
captured up front and restored on any exit — leaving her not-accepting
would break every later test involving her.

Also adds test/tests-to-add.md, the running list of spec paths the suite
does not yet cover, with 012 crossed off.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@markmnl
markmnl merged commit e5ef87d into main Aug 26, 2026
1 check passed
@markmnl
markmnl deleted the test-012-per-recipient-reject-codes branch August 26, 2026 04:33
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