Skip to content

id(directory_mail): SmtpSink continuation-line cap (MAX_REPLY_CONTINUATION_LINES) has no test that can reach it (PR #4267) #10365

Closed

Description

@dezren39

Finding

PR #4267 (fix for #1899) added three bounds to SmtpSink's SMTP reply reader in directory_mail.rs: a total deadline, a per-line byte cap (MAX_REPLY_LINE_BYTES, 8192), and a per-reply continuation-line cap (MAX_REPLY_CONTINUATION_LINES, 100). The deadline and the line cap each got a dedicated fake-relay regression test. The continuation cap got none — and the tests that look closest cannot reach it:

  • a_trickling_reply_fails_at_the_total_deadline uses a relay that sends one 250- continuation line every 50 ms and a 300 ms send timeout, so the send fails at the deadline after ~6 continuation lines — the counter never approaches 100.
  • The byte-trickle and over-long-line tests exercise the deadline and the line cap, not the continuation count.

So the continuations <= MAX_REPLY_CONTINUATION_LINES refusal can be deleted or broken (off-by-one, counter reset per line, cap raised) and every test in the suite stays green. The bound is part of the #1899 hardening: without it, a relay that answers promptly but endlessly with continuation lines is bounded only by the 10 s total deadline, not by the documented 100-line reply bound.

Evidence

Why it matters

#1899's fix was a hardening change against a hostile or broken relay. Two of its three bounds are pinned by tests; the third is a three-line ensure! that a future refactor of expect/read_reply_line can silently drop. A prompt endless-continuation relay is exactly the case the deadline tests do not cover at the cap boundary, so the regression would ship unnoticed.

Acceptance criteria

  • A fake-relay test in the directory_mail test module sends more than MAX_REPLY_CONTINUATION_LINES continuation lines promptly (well inside the send deadline) and asserts the send fails with the continuation-cap error ("more than 100 continuation lines"), not the deadline error.
  • A control at or under the cap (e.g. a reply with a handful of continuation lines followed by a final line) still succeeds, pinning that the cap counts continuations per reply.
  • Existing directory_mail tests keep passing.

Activity

  1. added
    kind/testTest coverage, test infrastructure, or test-only fixes
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 14, 2026
  2. developing-today commented on Nov 14, 2026

    @developing-today
    Contributor
  3. added
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 14, 2026
  4. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  5. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged
    task: 17332
    lane: code-b
    date: 2026-11-16

    Inline triage of #10365 — finding CONFIRMED against current main this shift (file read from main via the contents API):

    • pkgs/id/crates/id-directory/src/directory_mail.rs (986 lines on main): MAX_REPLY_CONTINUATION_LINES = 100 at line 224; the counting/refusal in expect() at lines 358-376 (continuations += 1; ensure!(continuations <= MAX_REPLY_CONTINUATION_LINES, "the mail relay sent more than {MAX_REPLY_CONTINUATION_LINES} continuation lines in one reply")).
    • The test module contains exactly the three PR fix(id): total deadline + line bound for SmtpSink reply reader (#1899) #4267 regressions: a_trickling_reply_fails_at_the_total_deadline (50 ms trickle vs 300 ms timeout — the deadline fires after ~6 continuation lines), a_byte_trickling_line_fails_at_the_total_deadline, and an_over_long_reply_line_is_refused_instead_of_buffered. No test sends more than 100 continuation lines promptly, so the cap refusal is unreachable by the suite — deleting or breaking the ensure! keeps every test green. The packet's evidence is accurate in every particular.

    Triage decision:

    • Work kind: task/small-fix — one fake-relay test plus an at/under-cap control, in the existing directory_mail test module, following the existing relay-harness shape (a prompt relay that writes >100 250- lines immediately, well inside the send deadline; assert the continuation-cap error text, not the deadline error; control: a handful of continuation lines then a final line succeeds).
    • Priority: priority/low (unchanged — a test-coverage gap on an internal hardening bound, no live defect).
    • Effort: effort/s.
    • Kind: kind/test (already present).
    • First concrete step: add a prompt endless-continuation fake relay beside trickling_relay() in the test module and drive send_with_timeout with a generous deadline so only the cap can fire.
    • Acceptance check: the issue's own criteria — the new test fails if the ensure! is removed or the cap is raised (mutation check), the control passes, and the existing directory_mail tests keep passing (cargo test -p id-directory on the laptop or via CI).

    The fix is enqueued as a follow-on small_fix task (named in the completion record) because it is code+test work on the laptop surface, which is down this shift; this triage task completes as triaged with the follow-on named, per the reasoned-split rule.

  6. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    effort/sSmall: expected under 2 hours of work
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 16, 2026
  7. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    Agent note — task 17498 capacity-parked: laptop route down (lane code-d, 2026-11-16)

    State: parked (capacity — laptop unavailable)

    • Fresh revalidation 2026-11-16: issue id(directory_mail): SmtpSink continuation-line cap (MAX_REPLY_CONTINUATION_LINES) has no test that can reach it (PR #4267) #10365 OPEN, no hard-stop labels (kind/test, priority/low, effort/s).
    • The work — a test-module-only change in pkgs/id/crates/id-directory/src/directory_mail.rs plus cargo test -p id-directory and the mutation check — is laptop work under the standing execution rule (worktrees live on the laptop; no sandbox worktrees). The laptop route is down this shift: laptop-agent health/exec fail with HTTP 502 (proxy closed during CONNECT), retested at 14:08Z and reported by multiple lanes since ~13:05Z.
    • Resume: when laptop-agent exec answers, add the prompt fake-relay test (>100 continuation lines inside the deadline -> continuation-cap error), the at/under-cap control, and record the mutation check (removing the ensure! fails the new test) in the PR.
  8. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    work/assignedQueue worker lifecycle state
    on Nov 16, 2026
  9. added a commit that references this issue on Nov 16, 2026
  10. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/testTest coverage, test infrastructure, or test-only fixespriority/lowNice to have; do when convenientsource/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions