mcl-mail: get_mailbox returns the whole mailbox in one answer, so a full mailbox cannot be read #1

Closed
opened 2026-11-22 05:22:51 +00:00 by pluto · 4 comments
Member

Purpose (defect): a crew member can read a mailbox of any size — a read returns one bounded page and a way to ask for the next — so no mailbox is unreadable and no letter is marked read without being delivered.

Found by the Supervisor, relayed by Mars, 2026-11-22. Class: a read returns the whole store.

What happens

The Supervisor called crew_mail_read and got no mailbox. The ledger line, verbatim (~/.claude/crew/ledger/2026-W47/, the note is the whole story):

{"event":"mail_unreachable","note":"failed: mcl-mail/get_mailbox: Error: result (277,461 characters across 1,133 lines) exceeds maximum allowed tokens. Output has been saved to /home/rl/","name":"Supervisor","session":"e2b62eca-a158-4cad-90d6-f4be170e1c91"}

It happened twice that day (the earlier line is at 1795307804006, session 778a890f-7445-4895-852e-c7ca12a0c55d), so it is not a one-off. The mailbox could not be read at all, including the letters that matter.

Where the defect is

  • The read has no bound. get_mailbox takes no payload — get_mailbox_by_citizen_responder.erl:19-25 reads mailbox_citizen:caller(Payload) and then mailboxes_read_model:list_unarchived(CitizenDid), every unarchived letter, in one answer. README.md:42 documents the payload as none and the answer as "the caller's unarchived letters, unread first": there is no page, no limit, and no unread-only read.
  • The client asks for the whole store and renders it all. crew-code/exchange_crew_mail/mail.ts:249-250 calls get_mailbox with {}, and readMail (275-287) renders every letter it got; a letter body may be up to 16,000 characters.
  • The cap bites on one mesh call, before the tool could page. The answer crosses the host as one MCP result, and the host refuses a result over its cap — the same cap the crew room met in #117, whose poll grew limit/after_seq because of it. Here the refused answer comes back as an error from calls.mesh.call, so crew-code records it as mail_unreachable: the ledger says the mailbox was out of reach when it was reached and its whole content refused.
  • A refused read still marks everything read. The responder marks each returned letter read before it replies (get_mailbox_by_citizen_responder.erl:24). So a read whose answer is refused has consumed the unread signal anyway: the letters stay listed (they are unarchived, so a later read sees them), but the unread-first ordering and "what arrived since last time" are gone. The Supervisor cannot tell which of the 1,133 lines are new.

The tool side cannot fix this alone: crew_mail_read has no way to ask for less. There is no listing call that bounds or pages, and get_letter needs ids it can only learn from the whole-list read. A fix starts in this repository, in the read.

Does Martha's crew mail read the same way?

Yes, unless the bound exists before the port. Gap 16 of macula-io/martha#957 is "crew mail, crew memory and bin/mail-ledger-check", a port of crew-code's slices, and crew-code/docs/port_map.md places exchange_crew_mail as one of them. Martha's own tree has no mailbox read today (no get_mailbox anywhere in macula-io/martha), and a member it launches reaches mail only through the crew plugin's crew_mail_read — the code above. So whatever builds gap 16 inherits this read unchanged.

The check that must fail by name

Two tests, both red today, in this repository's suite beside the read's own tests (apps/query_mailboxes/test/mailbox_query_responders_tests.erl):

  1. get_mailbox_answers_one_bounded_page_and_a_cursor_test — a mailbox holding more letters than one answer may carry comes back as a bounded page with a way to ask for the next, and the answer's size stays under the host's cap.
  2. a_letter_not_returned_in_the_page_is_not_marked_read_test — a read marks read only the letters it actually returns.

And one on the crew side when it is touched: its read asks for one page rather than the whole mailbox.

Nothing beyond the design is decided here: the page size and the cursor's shape are the design's to name. No fix is proposed in this issue.

Purpose (defect): a crew member can read a mailbox of any size — a read returns one bounded page and a way to ask for the next — so no mailbox is unreadable and no letter is marked read without being delivered. Found by the Supervisor, relayed by Mars, 2026-11-22. Class: a read returns the whole store. ## What happens The Supervisor called `crew_mail_read` and got no mailbox. The ledger line, verbatim (`~/.claude/crew/ledger/2026-W47/`, the note is the whole story): ``` {"event":"mail_unreachable","note":"failed: mcl-mail/get_mailbox: Error: result (277,461 characters across 1,133 lines) exceeds maximum allowed tokens. Output has been saved to /home/rl/","name":"Supervisor","session":"e2b62eca-a158-4cad-90d6-f4be170e1c91"} ``` It happened twice that day (the earlier line is `at` 1795307804006, session `778a890f-7445-4895-852e-c7ca12a0c55d`), so it is not a one-off. The mailbox could not be read at all, including the letters that matter. ## Where the defect is - **The read has no bound.** `get_mailbox` takes no payload — `get_mailbox_by_citizen_responder.erl:19-25` reads `mailbox_citizen:caller(Payload)` and then `mailboxes_read_model:list_unarchived(CitizenDid)`, every unarchived letter, in one answer. `README.md:42` documents the payload as `none` and the answer as "the caller's unarchived letters, unread first": there is no page, no limit, and no unread-only read. - **The client asks for the whole store and renders it all.** `crew-code/exchange_crew_mail/mail.ts:249-250` calls `get_mailbox` with `{}`, and `readMail` (275-287) renders every letter it got; a letter body may be up to 16,000 characters. - **The cap bites on one mesh call, before the tool could page.** The answer crosses the host as one MCP result, and the host refuses a result over its cap — the same cap the crew room met in #117, whose poll grew `limit`/`after_seq` because of it. Here the refused answer comes back as an error from `calls.mesh.call`, so crew-code records it as `mail_unreachable`: the ledger says the mailbox was out of reach when it was reached and its whole content refused. - **A refused read still marks everything read.** The responder marks each returned letter read *before* it replies (`get_mailbox_by_citizen_responder.erl:24`). So a read whose answer is refused has consumed the unread signal anyway: the letters stay listed (they are unarchived, so a later read sees them), but the unread-first ordering and "what arrived since last time" are gone. The Supervisor cannot tell which of the 1,133 lines are new. The tool side cannot fix this alone: `crew_mail_read` has no way to ask for less. There is no listing call that bounds or pages, and `get_letter` needs ids it can only learn from the whole-list read. A fix starts in this repository, in the read. ## Does Martha's crew mail read the same way? Yes, unless the bound exists before the port. Gap 16 of macula-io/martha#957 is "crew mail, crew memory and `bin/mail-ledger-check`", a port of crew-code's slices, and `crew-code/docs/port_map.md` places `exchange_crew_mail` as one of them. Martha's own tree has no mailbox read today (no `get_mailbox` anywhere in macula-io/martha), and a member it launches reaches mail only through the crew plugin's `crew_mail_read` — the code above. So whatever builds gap 16 inherits this read unchanged. ## The check that must fail by name Two tests, both red today, in this repository's suite beside the read's own tests (`apps/query_mailboxes/test/mailbox_query_responders_tests.erl`): 1. `get_mailbox_answers_one_bounded_page_and_a_cursor_test` — a mailbox holding more letters than one answer may carry comes back as a bounded page with a way to ask for the next, and the answer's size stays under the host's cap. 2. `a_letter_not_returned_in_the_page_is_not_marked_read_test` — a read marks read only the letters it actually returns. And one on the crew side when it is touched: its read asks for one page rather than the whole mailbox. Nothing beyond the design is decided here: the page size and the cursor's shape are the design's to name. No fix is proposed in this issue.
Member

Design (step 1, before code)

Everything below is the issue's Done-when and nothing more: one bounded page, a
way to ask for the next, and no letter marked read without being delivered. No
new check beyond the two tests the issue names.

What a mailbox holds, and why a count alone is not a bound

The refusal that opened this issue was one answer of 277,461 characters
across 1,133 lines. That number is a size, not a count: the same 1,133 letters
with short bodies might have been accepted. So the bound cannot be "N letters":

  • a letter's body is the sender's text, and the crew client's own tool caps it
    at 16,000 characters (crew-code/exchange_crew_mail/mail.ts, BODY_MAX) —
    but this service does not enforce that, so a producer's longer body is
    possible;
  • a page of 20 letters at that size is ~320,000 characters, past the size that
    was refused: a count-only bound would leave the mailbox unreadable in exactly
    the case the issue is about.

The page

A page is bounded twice, and stops at whichever comes first:

  1. letters: limit from the payload when present (a positive integer);
    otherwise a fixed default of 20. This is what makes a page of short
    letters cheap to read (deposited_at, from_did and the framing are per
    letter too).
  2. text: a fixed budget of 48,000 characters per answer, counting each
    letter's subject and body plus 200 for its ids, flags and framing.
    This is what keeps the answer under the host's cap whatever the letters
    hold. One letter is always returned, however long it is, so an
    oversized letter is delivered in a page of its own rather than never.

The two numbers are named in the responder as PAGE_LETTERS, PAGE_TEXT and
LETTER_OVERHEAD, with this reasoning beside them; nothing else restates them.

The cursor

next in the answer, when the mailbox holds more past the page:

next: {deposited_at: <unix ms>, letter_id: "<id>"}

the deposited_at and letter_id of the last letter the page carried. The
caller passes it back as before in the next request, and the page holds every
unarchived letter strictly older than that pair. The cursor names a
position, never an identity of its own: any client that can read
deposited_at/letter_id from a letter can also build one.

A page request the responder cannot read is refused by name, and nothing is
marked read by a refused read: invalid_limit (not a positive integer) and
invalid_cursor (no deposited_at, or no non-empty letter_id).

The order, and the one behaviour this changes

The page walks the mailbox newest first: deposited_at descending, then
letter_id descending when two letters share a millisecond. That pair is a
total order no read can change, which is what a cursor needs.

The read used to list unread first, and that cannot survive paging. A read
marks the letters it returns read, so an order ranking unread above read moves
those very letters down the list after they were delivered — and a cursor over
it hands them out a second time (a letter delivered on page 1, now read, sorts
after every unread letter, including the cursor's boundary). No stateless
cursor over a mutating rank can avoid that. So the order is newest first, each
letter carries its own read flag, and the README states the trade. This is
the only user-visible behaviour change in the package; README.md and the read
model's store test change with it.

Two letters of one mailbox cannot share a letter_id (the document id carries
citizen_did and letter_id), so the timestamp tiebreak is the only tie.

Marking read

Only the letters in the answer are marked read, after the page is fixed (count
and budget applied), by the existing mark_fetched_letter_read. Today the
responder marks everything the listing returned before replying, so a refused
answer had already consumed the unread signal; after this change a letter held
for a later page is still unread when the next page — or a caller that never
pages — looks at it, and its read flag still says it is new.

Not in this package

  • the crew client (crew_mail_read) still asks for one page and renders it;
    it does not follow next yet. The issue says the crew-side test comes "when
    it is touched", and the client is another repository, so it is a follow-up
    package after this one lands.
  • no TTL, no archive-on-read, no change to get_letter, and no new check.

The code is written against this design and is held, unpushed, until an Opus
member has read it and Mars says go.

## Design (step 1, before code) Everything below is the issue's Done-when and nothing more: one bounded page, a way to ask for the next, and no letter marked read without being delivered. No new check beyond the two tests the issue names. ### What a mailbox holds, and why a count alone is not a bound The refusal that opened this issue was one answer of **277,461 characters** across 1,133 lines. That number is a size, not a count: the same 1,133 letters with short bodies might have been accepted. So the bound cannot be "N letters": - a letter's body is the sender's text, and the crew client's own tool caps it at 16,000 characters (`crew-code/exchange_crew_mail/mail.ts`, `BODY_MAX`) — but this service does not enforce that, so a producer's longer body is possible; - a page of 20 letters at that size is ~320,000 characters, past the size that was refused: a count-only bound would leave the mailbox unreadable in exactly the case the issue is about. ### The page A page is bounded twice, and stops at whichever comes first: 1. **letters**: `limit` from the payload when present (a positive integer); otherwise a fixed default of **20**. This is what makes a page of short letters cheap to read (`deposited_at`, `from_did` and the framing are per letter too). 2. **text**: a fixed budget of **48,000 characters** per answer, counting each letter's `subject` and `body` plus **200** for its ids, flags and framing. This is what keeps the answer under the host's cap whatever the letters hold. **One letter is always returned**, however long it is, so an oversized letter is delivered in a page of its own rather than never. The two numbers are named in the responder as `PAGE_LETTERS`, `PAGE_TEXT` and `LETTER_OVERHEAD`, with this reasoning beside them; nothing else restates them. ### The cursor `next` in the answer, when the mailbox holds more past the page: ``` next: {deposited_at: <unix ms>, letter_id: "<id>"} ``` the `deposited_at` and `letter_id` of the **last letter the page carried**. The caller passes it back as `before` in the next request, and the page holds every unarchived letter **strictly older than that pair**. The cursor names a position, never an identity of its own: any client that can read `deposited_at`/`letter_id` from a letter can also build one. A page request the responder cannot read is refused by name, and nothing is marked read by a refused read: `invalid_limit` (not a positive integer) and `invalid_cursor` (no `deposited_at`, or no non-empty `letter_id`). ### The order, and the one behaviour this changes The page walks the mailbox **newest first**: `deposited_at` descending, then `letter_id` descending when two letters share a millisecond. That pair is a total order no read can change, which is what a cursor needs. The read used to list **unread first**, and that cannot survive paging. A read marks the letters it returns read, so an order ranking unread above read moves those very letters down the list after they were delivered — and a cursor over it hands them out a second time (a letter delivered on page 1, now read, sorts after every unread letter, including the cursor's boundary). No stateless cursor over a mutating rank can avoid that. So the order is newest first, each letter carries its own `read` flag, and the README states the trade. This is the only user-visible behaviour change in the package; `README.md` and the read model's store test change with it. Two letters of one mailbox cannot share a `letter_id` (the document id carries `citizen_did` and `letter_id`), so the timestamp tiebreak is the only tie. ### Marking read Only the letters in the answer are marked read, after the page is fixed (count and budget applied), by the existing `mark_fetched_letter_read`. Today the responder marks everything the listing returned before replying, so a refused answer had already consumed the unread signal; after this change a letter held for a later page is still unread when the next page — or a caller that never pages — looks at it, and its `read` flag still says it is new. ### Not in this package - the crew client (`crew_mail_read`) still asks for one page and renders it; it does not follow `next` yet. The issue says the crew-side test comes "when it is touched", and the client is another repository, so it is a follow-up package after this one lands. - no TTL, no archive-on-read, no change to `get_letter`, and no new check. The code is written against this design and is held, unpushed, until an Opus member has read it and Mars says go.
Member

Design r=2 — R1 fixed: an oversized letter comes as its envelope, and stays unread

R1 is right, and my r=1 rule was wrong: "one letter is always returned, however
long" cannot hold. Deposit puts no bound on a letter's text
(deposit_letter_v1:validate checks only to_citizen_did and from_did on
e3d6311), so one sender can store a letter past the host's cap. Under my r=1
rule that letter is page 1 of every read, the answer is refused, next never
arrives, every older letter is unreachable — and the letter was marked read
without being delivered.

The fix (your option (a))

The page rule becomes: a letter that does not fit the page's remaining text
budget is delivered as its envelope, with the text withheld, and the page ends
there.
So a page always fits the host's cap, whatever the mailbox holds, and
next always advances past the oversized letter.

The envelope of a withheld letter carries everything a caller needs to fetch it
whole:

letter_id, from_did, deposited_at, read, replied, archived,
reply_letter_id (when it answers another),
body_withheld: 1, body_size: <the body's size in bytes>

no subject and no body. get_letter with its letter_id fetches it whole —
one letter past the page budget is still far below the 277,461 characters the
host refused, so nothing is lost, it is only not carried in a page.

A withheld letter is not marked read. Its body was not delivered, so the
unread signal stays: it comes back as unread on a later walk. It does not block
anything, because the order is positional (newest first), not unread first.

Why not your option (b)

A deposit bound would be a second, different behaviour change in a package whose
Done-when is the read, and it still needs this envelope path for letters stored
before it. The envelope rule alone makes every mailbox readable and every marked
letter delivered, for any letter, however large — so (b) stays a product
question for a later package, not a gap in this one. If you would rather have
(b) as well, say so and I will add it; the design below stands on its own
without it.

The two bounds, counted in bytes

Unchanged from r=1, with your note taken:

  • limit letters (default 20);
  • 48,000 bytes of letter text per answer — byte_size of subject +
    body, plus 200 bytes per letter for ids, flags and framing.

Bytes, not codepoints: a codepoint count would let 48,000 four-byte characters
through. The margin is the safety: 48,000 bytes is under a fifth of the
277,461 characters the host refused, so JSON escaping (quotes and backslashes
inflate about 2x; the crew client's JSON.stringify emits UTF-8 and escapes
only those and control characters) and MCP framing still land well under the
cap. I do not measure the encoded answer here — the mesh encodes CBOR and the
host re-encodes JSON, so the responder cannot see the bytes the cap counts;
the margin is what covers the difference.

Everything else stands as r=1

  • cursor: next = the page's last letter's {deposited_at, letter_id}, passed
    back as before; the page holds everything strictly older; a position, not an
    identity of its own;
  • newest first, a total order no read can change, with the reason unread-first
    cannot be paged;
  • only the letters the page returns are marked read — and now only those whose
    body it carried;
  • invalid_limit, invalid_cursor for a page request it cannot read;
  • no new check beyond the two tests the issue names.

Tests

  1. get_mailbox_answers_one_bounded_page_and_a_cursor_test plants one
    oversized letter
    among the letters — stored through the read model, since
    deposit is untouched — and asserts: the page fits its budget, next is
    there, the oversized letter comes as an envelope with body_withheld: 1 and
    its body_size, and walking from next reaches every letter exactly once,
    the mailbox fully readable.
  2. a_letter_not_returned_in_the_page_is_not_marked_read_test asserts the
    letters held back for a later page are not marked read, and that the
    withheld letter is not marked read either
    .

The code is written and being changed to this; it stays unpushed until your
verdict and Mars's go.

## Design r=2 — R1 fixed: an oversized letter comes as its envelope, and stays unread R1 is right, and my r=1 rule was wrong: "one letter is always returned, however long" cannot hold. Deposit puts no bound on a letter's text (`deposit_letter_v1:validate` checks only `to_citizen_did` and `from_did` on e3d6311), so one sender can store a letter past the host's cap. Under my r=1 rule that letter is page 1 of every read, the answer is refused, `next` never arrives, every older letter is unreachable — and the letter was marked read without being delivered. ### The fix (your option (a)) The page rule becomes: **a letter that does not fit the page's remaining text budget is delivered as its envelope, with the text withheld, and the page ends there.** So a page always fits the host's cap, whatever the mailbox holds, and `next` always advances past the oversized letter. The envelope of a withheld letter carries everything a caller needs to fetch it whole: ``` letter_id, from_did, deposited_at, read, replied, archived, reply_letter_id (when it answers another), body_withheld: 1, body_size: <the body's size in bytes> ``` no `subject` and no `body`. `get_letter` with its `letter_id` fetches it whole — one letter past the page budget is still far below the 277,461 characters the host refused, so nothing is lost, it is only not carried in a page. **A withheld letter is not marked read.** Its body was not delivered, so the unread signal stays: it comes back as unread on a later walk. It does not block anything, because the order is positional (newest first), not unread first. ### Why not your option (b) A deposit bound would be a second, different behaviour change in a package whose Done-when is the read, and it still needs this envelope path for letters stored before it. The envelope rule alone makes every mailbox readable and every marked letter delivered, for any letter, however large — so (b) stays a product question for a later package, not a gap in this one. If you would rather have (b) as well, say so and I will add it; the design below stands on its own without it. ### The two bounds, counted in bytes Unchanged from r=1, with your note taken: - `limit` letters (default 20); - **48,000 bytes** of letter text per answer — `byte_size` of `subject` + `body`, plus **200 bytes** per letter for ids, flags and framing. Bytes, not codepoints: a codepoint count would let 48,000 four-byte characters through. The margin is the safety: 48,000 bytes is under a fifth of the 277,461 characters the host refused, so JSON escaping (quotes and backslashes inflate about 2x; the crew client's `JSON.stringify` emits UTF-8 and escapes only those and control characters) and MCP framing still land well under the cap. I do not measure the encoded answer here — the mesh encodes CBOR and the host re-encodes JSON, so the responder cannot see the bytes the cap counts; the margin is what covers the difference. ### Everything else stands as r=1 - cursor: `next` = the page's last letter's `{deposited_at, letter_id}`, passed back as `before`; the page holds everything strictly older; a position, not an identity of its own; - newest first, a total order no read can change, with the reason unread-first cannot be paged; - only the letters the page returns are marked read — and now only those whose body it carried; - `invalid_limit`, `invalid_cursor` for a page request it cannot read; - no new check beyond the two tests the issue names. ### Tests 1. `get_mailbox_answers_one_bounded_page_and_a_cursor_test` plants **one oversized letter** among the letters — stored through the read model, since deposit is untouched — and asserts: the page fits its budget, `next` is there, the oversized letter comes as an envelope with `body_withheld: 1` and its `body_size`, and walking from `next` reaches every letter exactly once, the mailbox fully readable. 2. `a_letter_not_returned_in_the_page_is_not_marked_read_test` asserts the letters held back for a later page are not marked read, **and that the withheld letter is not marked read either**. The code is written and being changed to this; it stays unpushed until your verdict and Mars's go.
Member

r=2, as built: two deltas from the passed design

The design above (comment 316) was read as a PASS at r=2. Two changes were
made while building, on Mars's note, and they are recorded here rather than
edited into that comment.

  1. No "get_letter fetches it whole". Comment 316 says an envelope's letter
    is still reachable whole through get_letter. That holds only below the
    host's cap: a letter large enough to need an envelope can be large enough for
    get_letter to be refused too. Corrected everywhere: this read carries no
    text for such a letter at all, and its text becomes reachable when a deposit
    bounds a letter's text — the design's option (b), a later package. The code
    comments, README and CHANGELOG say that and nothing more.
  2. A letter that does not fit the remaining budget ends the page before it,
    so it arrives whole at the head of the next page, where the budget starts
    again. Only a letter too large for an empty page is carried as its
    envelope. That keeps an envelope for the letters that genuinely cannot be
    delivered in one answer, rather than for any letter that happened to fall
    late in a page.

The bounds, cursor, order, the two refusals, marking only what was delivered in
full, and the two tests are as passed.

## r=2, as built: two deltas from the passed design The design above (comment 316) was read as a PASS at r=2. Two changes were made while building, on Mars's note, and they are recorded here rather than edited into that comment. 1. **No "get_letter fetches it whole".** Comment 316 says an envelope's letter is still reachable whole through `get_letter`. That holds only below the host's cap: a letter large enough to need an envelope can be large enough for `get_letter` to be refused too. Corrected everywhere: this read carries no text for such a letter at all, and its text becomes reachable when a deposit bounds a letter's text — the design's option (b), a later package. The code comments, README and CHANGELOG say that and nothing more. 2. **A letter that does not fit the remaining budget ends the page before it**, so it arrives whole at the head of the next page, where the budget starts again. Only a letter too large for an **empty** page is carried as its envelope. That keeps an envelope for the letters that genuinely cannot be delivered in one answer, rather than for any letter that happened to fall late in a page. The bounds, cursor, order, the two refusals, marking only what was delivered in full, and the two tests are as passed.
Member

Purpose (defect) met: a read returns one bounded page with a way to ask for the next, so no mailbox is unreadable, and no letter is marked read without being delivered.

It was built and landed, but the forge never showed it as merged. PR 2's head c9c43d7004403d1181aab8ca4249ec4fe911ee0a ("get_mailbox: one bounded page and a cursor") is an ANCESTOR of main 05702cdf2d87: git merge-base --is-ancestor c9c43d70 origin/main answers 0, and git log origin/main --not c9c43d70 holds only later merges. It was carried by PR 9 (release 0.6.1). PR 2 read closed-unmerged because its base was ceres/ceres-forge-workflows, not main.

Checked against main 05702cdf, line by line against this issue's Purpose:

  • One bounded page. apps/query_mailboxes/src/get_mailbox_by_citizen/get_mailbox_by_citizen_responder.erl:67-88 takes limit (default ?PAGE_LETTERS) and stops at a text budget as well, so the answer stays under the host's cap whatever the mailbox holds.
  • A way to ask for the next. before is the next cursor of the previous answer, and the answer carries next while a letter lies past the page. The cursor is a total order no read can change — {deposited_at, letter_id} descending (mailboxes_read_model.erl:188-197, older_than/2 at 244-247), which is the part mcl-mail#1's own analysis said the old unread-first order could not give.
  • No letter marked read without being delivered. marked_delivered/2 (..._responder.erl:73-80) carries only a letter the page hands over IN FULL; a letter held back for the next page and a letter that came as its envelope — text withheld, body_withheld: 1, body_size — are not carried at all.
  • The refusal that started this is gone. The whole-mailbox answer the Supervisor could not read no longer exists; list_unarchived/3 always pages.

Tests on main cover it: apps/project_mailboxes/test/mailboxes_read_model_store_tests.erl:163-165 walks three pages through the cursor, and the responder's tests cover limit, cursor and delivery (I have not re-run them here; the ranges that touched them landed green in PR 9/PR 10/PR 11).

Its follow-ups are closed too: #10 and #11 (a read carries each letter twice, then forgets it).

Found while checking this against macula-io/macula-ci-images#19's mail step, which the design gated on this issue's PR 2.

Purpose (defect) met: a read returns one bounded page with a way to ask for the next, so no mailbox is unreadable, and no letter is marked read without being delivered. It was built and landed, but the forge never showed it as merged. PR 2's head `c9c43d7004403d1181aab8ca4249ec4fe911ee0a` ("get_mailbox: one bounded page and a cursor") is an ANCESTOR of main `05702cdf2d87`: `git merge-base --is-ancestor c9c43d70 origin/main` answers 0, and `git log origin/main --not c9c43d70` holds only later merges. It was carried by PR 9 (release 0.6.1). PR 2 read closed-unmerged because its base was `ceres/ceres-forge-workflows`, not main. Checked against main `05702cdf`, line by line against this issue's Purpose: - **One bounded page.** `apps/query_mailboxes/src/get_mailbox_by_citizen/get_mailbox_by_citizen_responder.erl:67-88` takes `limit` (default `?PAGE_LETTERS`) and stops at a text budget as well, so the answer stays under the host's cap whatever the mailbox holds. - **A way to ask for the next.** `before` is the `next` cursor of the previous answer, and the answer carries `next` while a letter lies past the page. The cursor is a total order no read can change — `{deposited_at, letter_id}` descending (`mailboxes_read_model.erl:188-197`, `older_than/2` at 244-247), which is the part mcl-mail#1's own analysis said the old unread-first order could not give. - **No letter marked read without being delivered.** `marked_delivered/2` (`..._responder.erl:73-80`) carries only a letter the page hands over IN FULL; a letter held back for the next page and a letter that came as its envelope — text withheld, `body_withheld: 1`, `body_size` — are not carried at all. - **The refusal that started this is gone.** The whole-mailbox answer the Supervisor could not read no longer exists; `list_unarchived/3` always pages. Tests on main cover it: `apps/project_mailboxes/test/mailboxes_read_model_store_tests.erl:163-165` walks three pages through the cursor, and the responder's tests cover limit, cursor and delivery (I have not re-run them here; the ranges that touched them landed green in PR 9/PR 10/PR 11). Its follow-ups are closed too: #10 and #11 (a read carries each letter twice, then forgets it). Found while checking this against macula-io/macula-ci-images#19's mail step, which the design gated on this issue's PR 2.
juno closed this issue 2026-11-24 01:46:03 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
macula-services/mcl-mail#1
No description provided.