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. |
nextxch
force-pushed
the
pr/1076-contacts-write
branch
from
November 12, 2026 23:38
1244dfe to
21a8ca8
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.
nextxch
force-pushed
the
pr/1076-contacts-write
branch
from
November 13, 2026 06:34
21a8ca8 to
ba2f377
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.
…e go to its server Builds on UCSLabs#1068 (the contacts read) and on UCSLabs#1015, the desktop app's JMAP runner. Contacts of a JMAP account were a read-only copy of the server's; now what is done to them here goes to the server. - mailcraft-model: ContactOp, ContactField, ContactsUpload and their outcomes; `changes` on JmapContactsRequest and `changed` on its result. A contact remembers what its server last said of it (`synced`), and what differs from that is what waits to go. A deletion is remembered (`contact_gone`) until the server has heard. A JMAP account that is no shared mailbox writes its contacts. - mailcraft-jmap: ContactCard/set before the read. A new card goes into the default address book (AddressBook/get, once in a run); an update is a patch that names only the properties of the parts that changed, the birthday by the key of its own anniversary, the notes only where the server has one note or none, so that what MailCraft does not map stays as the server has it. A web address that is not http or https is refused and said, not left out. A card the answer says nothing of is looked up once. A hundred changes in a run, as many to a call as the server takes, an answer read for the changes that were asked and for nothing else. - mailcraft-engine: sync.contactChanges says what is to be told, sync.applyContactChanges takes in what came of it. A download is merged part by part: a part changed here stays and goes up, every other part is the server's; what was deleted here is not brought back, and a contact still to be made is not removed or made twice. A change the server refuses is put back and told. people.new, people.edit, people.delete and people.merge no longer refuse such a contact, and a new contact goes into the account People shows when that account writes its contacts. Microsoft accounts' contacts stay read-only. - mailcraft-ui-egui: the contacts job carries the changes, takes their outcomes in before the download, and goes a few seconds after a change while Send/Receive runs by itself (what it carries and what waits are kept beside the shared state of jmap_side_job.rs); deleting such a contact says that it goes from the server too. - mailcraft (desktop): the runner's contacts job carries the request as it is; a test that a change goes nowhere without a credential. - PRIVACY.md (what of a contact is written, and when), README.md, ROADMAP.md, docs/jmap.md, docs/gaps.md, docs/architecture.md with their fragments, and the release note. A contact's picture is neither read nor written, and groups are not written. Human-reviewed, AI-assisted, nobody's mailbox harmed.
nextxch
force-pushed
the
pr/1076-contacts-write
branch
from
November 13, 2026 07:46
ba2f377 to
56ff11a
Compare
|
4 tasks done
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Builds on #1015 (the desktop app reads JMAP accounts) and on #1123 (#1068: a JMAP account's contacts come down), neither of which is on
mainyet: the branch ismainwith #1015 merged in, the one commit of #1123 on top of that, and the one commit of this pull request on top of both. It is a draft until those two are merged; then it is brought up to date withmainand only its own commit is left.Closes #1076.
What changes for the person using MailCraft
A JMAP account's contacts were a read-only copy of what its server keeps. Now, in the desktop app, where the server offers JMAP for Contacts (RFC 9610), what you do to them here goes to the server:
A Microsoft account's contacts stay read-only, as before.
What it leaves out
main, so none is read (as in #1068: a JMAP account's contacts come down from its server #1123) and none is written: no change ever names a card'smedia, and a picture the server keeps with a card stays there. Pictures are a later pull request.group) are neither read nor written.mainalready, #1074 part 1: a JMAP account's changes go up #1110), to-dos and notes, Add Account.What goes where
crates/model:remote.rsgets what a change is said in (ContactOp,ContactOpKind,ContactFieldwith its ten parts,ContactsUpload,ContactOutcome,ContactResult,ContactsUploaded);sync/jmap.rsgetschangesonJmapContactsRequestandchangedonJmapContactsResult(both left out of the JSON when empty, both printed byDebugas counts only).contact.rs: a contact remembers what its server last said of it (Contact::synced),changed_fieldsis the difference,as_remoteandset_partgo between the two shapes.mailbox.rs:Account::writes_contacts(a JMAP account that is no shared mailbox),Mailbox::contact_gone(deletions the server is yet to hear of, 5,000 at the most),remove_contactnotes one andremove_contact_quietlydoes not. A mailbox file from before opens unchanged, and one without the new fields is written as before (contact_sync_tests.rs).crates/jmap:contacts/changes.rs(one run's changes: which go in which call, the patch of an update, how an answer toContactCard/setis read),contacts/write.rs(a contact written as the properties of a JSContact card, the other way ofcard.rs), andcontacts.rs, wheresync_contactsnow tells the changes before it reads (the reading is stillreader.rs'sCalls::read_all, untouched).card.rsshares its bounds and the choice of the birthday's entry withwrite.rs.mail.rsgetsrefusal(aSetErroras a few clean words).crates/engine:cmd/contacts_remote.rsis new:sync.contactChanges(what is to be told: deletions, then changes, then new contacts),sync.applyContactChanges(what came of it), andmerge_written, the part-by-part merge of a download for an account that writes.cmd/people.rs:people.newtakesaccount,people.editandpeople.deleteno longer refuse a contact of such an account;people_merge.rslikewise;cmd/remote.rs:merge_contactshands such an account tomerge_written, and forgetting an account keeps a contact its server was yet to be given, on this computer. Both new commands are on the agent gate's never list, andsync.contactChangesis among the commands that ask a server.crates/ui-egui:jmap_contacts.rscarries the upload with the job, takes the outcomes in before the download of the same answer, and decides when a change goes (the quiet moment, the back-off when a job gets nothing through);JmapContactsis now the sharedSideJobofjmap_side_job.rswith what the job carries and what waits beside it.dialogs.rs: the question before deleting says the contact goes from the server too.people_view.rs: such a contact's card no longer says it is read-only.forms.rs: a new contact's categories are those of the account it will be made in.apps/mailcraft:jmap_runner.rsneeds no new code:run_contactshands the request tomailcraft-jmapas it is, changes and all. Its comments say so, and a test says that a change goes nowhere without a credential.PRIVACY.md(the JMAP row: what of a contact is written, and when),README.md,ROADMAP.md(M6),docs/jmap.md,docs/gaps.md(gap 5),docs/architecture.md, each table row as a fragment underdocs/log.d/, and the release notepackaging/release-notes.d/new/1076.md.cargo xtask i18nadds five texts to the catalogues, untranslated: two command labels, the sentence in the delete question, and two lines said when something can't be done.Caps, and how an answer is read without trusting it
MAX_CONTACT_OPS), 50 of them new contacts at the most; the rest go with the next run. A call carries as many as the server takes (maxObjectsInSet) and as fit half of itsmaxSizeRequest(64 KiB at the least), never two changes of one card, and no change twice in a run.ContactCard/set, toAddressBook/getand to the look for a card that went unanswered is held to 2 MiB; the read of a card before its birthday or notes are changed to 24 MiB, as any read of cards.set, only the keys that were asked are looked up (outcome_of): a creation id made of the change's place in the request (nothing of the contact is in it), or the card's id. Whatever else the answer holds is not read. An id the server gives a new card is held to the JMAP alphabet, or the creation counts as refused. 10,000 entries of a list are looked at, 500 address books.card.rsreads back: a line has no control character, a note is 16 KiB at the most, 50 entries to a map. A property test writes any contact as a card and reads it back as the same contact.ContactOutcome::tidy).@in it are taken out. The log names the account's id and counts only.Conflicts and refusals
httporhttps(written without it, the address would be lost at the next read), a change of the notes where the server keeps several notes for the contact, an id no server hands out, and a new contact when the account has no address book it may write to.notFound, or a card the answer passed over and a look does not find): a changed contact is made again, a deletion is done.How it was checked
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,591 tests pass, 0 fail, 21 ignored.example.orgnames: 34 inmailcraft-jmap(25 incontacts/changes_tests.rs, 9 incontacts/write_tests.rs, property tests among them over arbitrary answers at every step, arbitrary cards under a patch, and any contact written and read back), 19 inmailcraft-engine(cmd/contacts_remote_tests.rs), 6 inmailcraft-model(contact_sync_tests.rs), 6 inmailcraft-ui-egui(jmap_contacts_tests.rs, 14 there now), and 1 in the desktop app (jmap_runner_tests.rs). One test of #1068: a JMAP account's contacts come down from its server #1123 changed:people.editof a JMAP account's contact is no longer refused.What a reviewer should look at first
crates/jmap/src/contacts/changes.rs:Run::changesandRun::call(what goes in a call and in what order),patchandkeyed(what an update names),outcome_of(how an answer is read).crates/engine/src/cmd/contacts_remote.rs:merge_written(the part-by-part merge, and what makes a download remove a contact) andapply_contact_outcomes_of(each kind of outcome).crates/jmap/src/contacts/write.rs:written, andhas_unkept_link.PRIVACY.md: the JMAP row.crates/ui-egui/src/jmap_contacts.rs:jmap_contacts_pushandjmap_contacts_settle(when a change goes by itself),JmapContacts::answer(what a job carried comes back with its answer), and the taking in ofresult.changedbefore the download.Notes
PRIVACY.mdis one of the documents a change to which is the owners' call (CONTRIBUTING.md): the row is changed here because the program now writes to the server something it only read before. Say if you would rather word it yourselves.What the engine says of a refusal is an English line, as it is for to-dos and events on
main.cargo xtask cipasses"Allow edits by maintainers" is ticked (the box beside Create pull request)
I have signed the CLA, or will by commenting on this pull request
Human-reviewed, AI-assisted, nobody's mailbox harmed.