Repository navigation
Conversation
The desktop app gets the host the browser build has for a JMAP account: apps/mailcraft/src/jmap_runner.rs runs mailcraft-jmap's Send/Receive and its whole-message fetch over mailcraft_net::https, each job on a thread of its own, the pieces streamed to the window. main.rs sets Services::jmap and Services::jmap_fetch; the window already takes JMAP accounts into Send/Receive once its host runs them. - mailcraft-net: an answer's Content-Type is kept (a JMAP answer must be JSON; one too long to be a media type is none); https::send_with gives an exchange a time limit of the caller's (at most 10 min); is_too_slow and is_too_long are public. - Each request kind has its own time limit (session 30 s, API 2 min, download 5 min). Stop is heard before each request and latched per job; a job never sets the window's shared flag. A Retry-After date is handed to the client as seconds, and ignored while the clock is plainly not set. - The credential stays in memory: the read of the credential store leaves JMAP accounts out, so a password kept under an install's old name is no longer moved to a JMAP account with that address (it was written to the store, though never used to send). - docs/jmap.md, the architecture table, README, gap 5, M6's row; fragments for the logs and the release notes. Tests: jmap_runner_tests.rs runs the real transport over loopback sockets against the JMAP stand-in (a whole run, Basic and Bearer, refusals, no secret and Stop sending nothing, an unreachable server, plain http refused, messages fetched whole, time limits, the stop latch, Retry-After); a net test for Content-Type; the_old_name_never_moves_to_a_jmap_account fails without its fix. cargo xtask ci passes (all 13 steps, deny included). Human-reviewed, AI-assisted, nobody's mailbox harmed.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
544fa0c to
aefe2b5
Compare
… until it is on main README.md: both sides changed the Servers and Files lines. Kept main's lines (nothing is sent yet; a .pst file's calendar, tasks, notes and journal come in) and UCSLabs#1015's word that JMAP is on the desktop too. ROADMAP.md: both sides changed the M6 row. Kept main's row (the marks, moves and deletions go up, UCSLabs#1074 part 1) and UCSLabs#1015's word that JMAP reads mail in the desktop app too. docs/architecture.md, docs/gaps.md, docs/jmap.md: both sides changed the sentences that say where a JMAP account is read. Kept main's word that what is changed in its mail goes up and UCSLabs#1015's that the desktop app is a host too; the desktop app runs the same `sync_mail`, so the changes go up from there as well. Human-reviewed, AI-assisted, nobody's mailbox harmed.
aefe2b5 to
a41c66d
Compare
Builds on UCSLabs#1015, the desktop app's JMAP runner. Read only: nothing of a contact goes up (that is UCSLabs#1076). - mailcraft-jmap: sync_contacts reads the account's contacts (JMAP for Contacts, RFC 9610; cards in JSContact, RFC 9553) where the server offers them: ContactCard/query a page at a time, ContactCard/get 200 to a request, a call that fails halved until the card that breaks it is found, 20,000 contacts at the most, every map, list and text of a card bounded. A card's picture is not read, and nothing in a card is fetched. reader.rs holds what the readers of one kind of data share: whose data is read, a request of one call, and the reading itself (Calls::read_all: the list page by page, the get in chunks and its halving), with tests of its own; contacts.rs says what is asked for contacts and what a card becomes. - mailcraft-model: JmapContactsRequest and JmapContactsResult; a JMAP account keeps contacts. - mailcraft-engine: a JMAP account's download is merged as a Microsoft account's is (a test; no change to the code). - mailcraft-ui-egui: the contacts are a job of their own, after the account's Send/Receive and every quarter of an hour, one at a time, with the credential the Send/Receive went with. jmap_side_job.rs holds what such a job is whatever it reads (when one is due, the wait after one that came to nothing, whose an answer is); jmap_contacts.rs what is asked for contacts and how they are taken in. - mailcraft (desktop): run_contacts on top of UCSLabs#1015's runner, through on_thread and signed_in, which any such job goes through. - PRIVACY.md, README.md, ROADMAP.md, docs/jmap.md, docs/gaps.md, docs/architecture.md with their fragments, and the release note. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Builds on UCSLabs#1015 and on UCSLabs#1068. Read only: nothing of a calendar or an event goes up, and a repeating event comes as its occurrences in the stretch; the series as one repeating event, and writing, are UCSLabs#1090. - mailcraft-jmap: sync_calendar reads the calendars the account subscribes to and may read (JMAP for Calendars; events in JSCalendar, RFC 8984) where the server offers them, and for each the events of the stretch: CalendarEvent/query a page at a time with what repeats expanded by the server, CalendarEvent/get 200 to a request for the properties that are read and no others, a call that fails halved until the event that breaks it is found, every map, list and text of an event bounded. The list and the halving are reader.rs's, as for the contacts (Calls::read_all); it learns of an object that can not be read (an event whose time can not be told), which counts as not answered for. - mailcraft-model: JmapCalendarRequest and JmapCalendarResult. - mailcraft-engine: a JMAP account's calendar is never where an event made without saying where goes, and a change to one is refused with the reason. - mailcraft-ui-egui: the calendars are a job of their own, on jmap_side_job.rs as the contacts' is, after the contacts' and when the calendar comes to the front, a month back and a year ahead. - mailcraft (desktop): run_calendar beside run_contacts on UCSLabs#1015's runner, through the same on_thread and signed_in. - PRIVACY.md, README.md, ROADMAP.md, docs/jmap.md, docs/gaps.md, docs/architecture.md with their fragments, and the release note. Human-reviewed, AI-assisted, nobody's mailbox harmed.
a41c66d to
d74cdc3
Compare
`cargo xtask live` starts a mail server and a mail catcher in throwaway containers on loopback ports, runs the `#[ignore]`d `live_` tests of the desktop app against the server, and removes both containers and their network, whatever came of the tests. The scripted tests prove that the client does what we think the protocol asks; a real server shows whether servers answer that way. Nothing of this runs in `cargo test` or `cargo xtask ci`, no workflow runs it, and nothing is added to the build or to `Cargo.lock`. - `xtask/src/live.rs`: the harness, on the standard library alone. One mailbox (`ada@example.org`) with a password made up for the run and never printed. The server image, its start recipe, its port and the catcher's are taken from the environment (`MAILCRAFT_LIVE_IMAGE`, `MAILCRAFT_LIVE_ENV`, `MAILCRAFT_LIVE_SERVER_PORT`, `MAILCRAFT_LIVE_PORT`, `MAILCRAFT_LIVE_CATCHER_IMAGE`, `MAILCRAFT_LIVE_CATCHER_PORT`). - `apps/mailcraft/src/live_tests.rs`: three tests through the functions the window's jobs run: mail is listed and a message fetched whole, contacts come down, calendars and their events come down. They refuse a server that is not on this computer. A server that offers no contacts or no calendars has that test say so and end there. - `docs/live-tests.md`: what it is, how to run it, what it starts and removes, another server and what its image must offer. Linked from `CONTRIBUTING.md` and `docs/jmap.md`. The default image, `nextxch/server`, is the mail server the author of this change works on: commercial software under its own licence, free to pull and to run for a few mailboxes, not open source. The harness and the doc say so. CI never pulls it. Human-reviewed, AI-assisted, nobody's mailbox harmed.
d74cdc3 to
15502e2
Compare
|
|
@nextxch, thank you for the thought and work in this, and sorry for the wait. We've decided to keep tests on the in-process fake servers ( Human-reviewed, AI-assisted, nobody's mailbox harmed. |



A proposal for #1113, in the shape the issue calls 2 (in the repository, server-neutral, with a default image) and without a workflow. It builds on #1015 (the desktop app reads JMAP accounts), #1123 (#1068, contacts come down) and #1124 (#1072, calendars and events are shown), none of which is on
mainyet: the branch ismainwith #1015 merged in, the commits of those two, and the one commit of this pull request on top. It is a draft until those are onmainand until you have said which shape you want, if any; a no, or another shape, is as good an answer, and I will change or close it accordingly.Closes #1113.
What it is
cargo xtask liveruns the desktop app's JMAP code against a real mail server in a throwaway Docker container on the computer of whoever asks for it, and removes everything afterwards. It is opt-in: for somebody who changes that code and wants to see it work against a server before proposing the change. Nobody has to run it and nothing depends on it.Why
The unit tests script the server (scripted exchanges, the stand-in). That proves the client does what we think the protocol asks. It cannot show whether a server answers that way, because the script and the client were written by the same people.
The live run has already found one such case: a server that answers
Email/setdestroyfor an id it does not know with neitherdestroyednornotDestroyed. A client that keeps to RFC 8620 then has no answer and asks again at every run, for ever. The client now looks such ids up once (#1110); no scripted test would have found it.What it starts and removes
mailcraft-live).mailcraft-live-catcher,axllent/mailpit, MIT), which is the server's smart host, so that mail the server sends goes to the catcher and nowhere else. Its web page is on127.0.0.1:58125.mailcraft-live-jmap) on127.0.0.1:58180, which on first start makes one mailbox,ada@example.org, with a password made up for the run.cargo test --locked -p mailcraft --bin mailcraft live_ -- --ignored --test-threads=1, with the server's address, the mailbox's address and the password in the environment of that one process.--keepleaves them for a look; the next run removes them first).What it never does
cargo testor incargo xtask ci: every test is#[ignore]d. There is no workflow, and CI never pulls either image.Cargo.lock: the harness is on the standard library alone, and the tests use what the desktop app has already (Cargo.lockand everyCargo.tomlare unchanged).localhost,127.0.0.1,::1) before a byte is sent, since they write to the mailbox they are given. Without the harness's environment a test fails and says so, rather than pass having tested nothing.The tests in it now, and the ones that follow
Each test puts something into the test mailbox the way another client would (a JMAP
setcall) and reads it back through the functions the window's jobs run (jmap_runner::run_*_with). Three are here, for what this base can do:live_mail_is_listed_and_a_message_comes_down_whole: a Send/Receive lists the folders and finds the Inbox; a message put there is listed with its subject and sender, and fetched whole (M6 (#1014): the desktop app reads JMAP accounts #1015's runner).live_contacts_come_down_with_their_fields: a card put into the address book comes down with name, company, address, phone number and note (JMAP accounts: read contacts from the server (JMAP for Contacts, RFC 9610) #1068).live_calendars_and_their_events_come_down: the calendars are listed, one of them the main one, each read only; an event put there comes down at its time, with its length and place (JMAP accounts: show the server's calendars and events (JMAP for Calendars, read-only) #1072).A server has to offer mail. Where its session names no account for contacts or for calendars, that test prints
live: skipped, ...and ends there (the test run then counts it as passed; the doc says to read the lines).The others that the issue lists exist on my fork and each comes with the pull request of its feature, since the code it calls is not on this base: sending through the catcher (#1074), contacts made, changed and deleted (#1076), events made, changed and deleted, series, to-dos and notes over CalDAV (#1090, #1073, #1100), Add Account's sign-in check and the Autoconfig document. The one for marks going up and the lookup of unknown ids exists there too: its code is on
mainnow (#1110), and the test is not part of this pull request. The catcher is started already, as the server's only smart host, although no test here sends mail yet.Another server
The image, its start recipe (the container's environment, with
{email},{password}and{catcher}filled in by the harness), the port it speaks HTTP on, and the loopback ports come from the environment:MAILCRAFT_LIVE_IMAGE,MAILCRAFT_LIVE_ENV,MAILCRAFT_LIVE_SERVER_PORT,MAILCRAFT_LIVE_PORT,MAILCRAFT_LIVE_CATCHER_IMAGE,MAILCRAFT_LIVE_CATCHER_PORT.docs/live-tests.mdsays what an image has to offer: one mailbox made on first start from environment variables, HTTP on one port with the JMAP session at/.well-known/jmap, and an outbound smart host. If you would like it to pass against an open-source JMAP server of your choice, name it and I will add its recipe; if you would rather have no default image in the tree (shape 1), that isDEFAULT_IMAGEandDEFAULT_RECIPEinxtask/src/live.rstaken out and one paragraph of the doc.What you should know about the default image
The image a run starts when none is named is
nextxch/serverfrom Docker Hub. It is the mail server I work on. It is commercial software under its own licence, free to pull and to run for a few mailboxes, and not open source. It is the default because it offers JMAP for mail, contacts and calendars on one origin and because I can fix it when a test finds a fault on its side. Nothing of it is in the repository or in a build; Docker pulls it on the computer of whoever runscargo xtask live, and nothing else does. The one place in the code that names it (DEFAULT_IMAGE) says what it is, and so doesdocs/live-tests.md. Naming a commercial image in the repository is your call, which is why this is a proposal.What goes where
xtask/src/live.rs(new) and four lines ofxtask/src/main.rs(the module, the usage text, the command).apps/mailcraft/src/live_tests.rs(new), brought in by#[cfg(test)] mod live_tests;inmain.rs. No other code changes.docs/live-tests.md(new), one sentence each inCONTRIBUTING.md(beside "Tests never touch a real mailbox") and indocs/jmap.md(Trying it), each with its revision-history fragment underdocs/log.d/. No release note: nothing changes for a person using MailCraft.How it was checked
cargo xtask liveon Windows with Docker Desktop:3 passed; 0 failed; 0 ignoredagainst the default imagenextxch/server:1.3.3, and the same again against the image as Docker Hub has it under that tag (named by its digest throughMAILCRAFT_LIVE_IMAGE, with the recipe given throughMAILCRAFT_LIVE_ENVand another inner port throughMAILCRAFT_LIVE_SERVER_PORT, which is the path another server takes). After each run no container and no network of the harness was left. A recipe entry that is notNAME=valueand an image that cannot be pulled each end with an error and leave nothing behind.cargo xtask ci: all 12 steps pass (fmt, test, assets, spdx, test-files, workflows, layers, wasm, deny, i18n, release-notes, docs-log; cargo-deny is not installed here and its step says skipped), andcargo clippy --locked --workspace --all-targets --exclude mailcraft -- -D warningsandcargo clippy --locked -p mailcraft --bin mailcraft -- -D warningsbeside it. 7,564 tests pass, 0 fail, 24 ignored; the three live tests are among the ignored (ignored, needs a mail server on this computer: cargo xtask live), sociruns none of them.Cargo.lockand everyCargo.tomlare the same as on #1072: a JMAP account's calendars and events are shown #1124's branch.What a reviewer should look at first
docs/live-tests.md: "What it never does" and "The default image". They are the promises, and the disclosure.xtask/src/live.rs:runandstart_all(what is started, that both ports are published on127.0.0.1only, thatremoveruns on every way out) andstart(the password is taken out of what Docker said before it is shown);DEFAULT_IMAGEandDEFAULT_RECIPE.apps/mailcraft/src/live_tests.rs:Live::get(the refusal of a server that is not on this computer, before anything is sent) andLive::offers(the skip).CONTRIBUTING.md: the sentence added to "Tests never touch a real mailbox". Say if you would rather word it yourselves or not have it there.cargo xtask cipassesHuman-reviewed, AI-assisted, nobody's mailbox harmed.