Repository navigation
Conversation
File › Info › Automatic Replies, its line and the status bar now work for an Exchange server account, through EWS GetUserOofSettings and SetUserOofSettings ([MS-OXWOOF]), at the account's own server with its password. - mailcraft-ews: `oof`, the two requests and a bounded reader (state, audience, UTC time range, the two replies, capped; a reply too long to read makes the answer unreadable, never empty), carried in Graph's names so the existing commands and dialog serve both kinds of account; and `automatic_replies`, which reads, changes what was read and writes it whole, then reads again, so what the owner left alone goes back as the server had it. The stand-in answers both operations, held to the schema. - engine: `can_reply` takes Exchange server accounts (not an online archive or one without a usable server); `ews_request` says what the host asks with. Nothing is changed before the first read or while offline, as for Graph. - window and app: `Services::ews_auto_replies`, the host job in `ews_runner`, a password the server turns down forgotten as for Send/Receive. - tests: reader and writer (hostile, oversize, faults), stand-in round trip, engine commands, the window's job and a kittest of the dialog, the reader in the `ews` fuzz target and the crate's proptests. - docs: gap 17, ui-parity, step 11, fragments 2110.md; catalogues refreshed, the two new texts as fuzzy drafts in every language. Human-reviewed, AI-assisted, nobody's mailbox harmed.
An Exchange server account's rules are kept on its server through EWS GetInboxRules and UpdateInboxRules ([MS-OXWSRULES]), in the model a Microsoft account's already use, so the engine's merge, the Rules and Alerts window and the agent classes serve both. - mailcraft-ews: `rules`, the requests and a bounded reader. Conditions, exceptions and actions MailCraft knows become its own; any other is named among the rule's unknown parts, so the rule is shown, never run here and never made again from what was kept; `IsNotSupported` is read-only. Changes go by RuleId, one operation a request: a MailCraft rule is created whole (its id, which the answer doesn't give, found by reading again), a deletion by id, and a switch or a move is written on the server's own copy of the rule, read just before, with only IsEnabled or Priority changed, so an Outlook rule keeps every part; one that couldn't be read whole is never written back. RemoveOutlookRuleBlob is sent only with the owner's yes, and without it nothing is sent while Outlook's copy is there. The stand-in answers both operations, held to the schema. - engine: `keeps_rules` takes Exchange server accounts (not an online archive or one without a usable server); `ews_rules_request`; the owner's one-shot yes for removing Outlook's copy in the rules driver. - window and app: `Services::ews_rules`, `ews_runner::run_rules`; the question about Outlook's copy (`ui.removeOutlookRules`, classed Delete for agents), closed unanswered is a no; File › Info's rules line with Ask again; a password the server turns down forgotten. - tests: reader and writer (hostile answers, a rule too long to read whole, validation errors), stand-in round trips, an Outlook rule with unknown parts that survives a change of another rule unchanged, engine merge and agent classes, the window's job and question with a kittest, the reader in the `ews` fuzz target and the crate's proptests. - docs: gap 17, ui-parity, step 11, fragments 2110-rules.md; catalogues refreshed, the new texts as fuzzy drafts in every language. Human-reviewed, AI-assisted, nobody's mailbox harmed.
…named by directory name A change of a rule's name, conditions, exceptions or actions goes to the Exchange server by RuleId (SetRuleOperation), written on the server's own copy of the rule read just before, as a switch or a move already is. - mailcraft-ews: `ServerRules::edited`: the rule as MailCraft has it now, on the server's copy; each condition, exception and move or copy the change leaves as it was goes back as the server gave it (a person's name, a folder's change key). Refused, with why, for a rule with a part not known here, one the service may not change (IsNotSupported), one not read whole, and a change the server's rules can't hold; Outlook's copy keeps it from going without the owner's yes, as every change. - People of the organisation an on-premises server names by directory name (RoutingType EX, /o=…/cn=…) in FromAddresses or SentToAddresses are read: by the SMTP address the address list gives (ResolveNames, at most 50 a job), else by the name as given; an unchanged list goes back as the server wrote it, and a new directory name is written routed EX. Such rules were read-only for their "unknown" senders before. - model: `ServerRule::edited` (which change, so an answer for an earlier one doesn't count for a later one), `Rule::mark_edited`; `RuleOp::body` and `edit` for an Update, `RuleOutcome::edit`. - engine: `rule_upload` sends a change whole to an Exchange server alone, of a rule every part of which is known; a read keeps the change until the server takes it; refused, the rule is as the server has it again; one whose server copy now has unknown parts lets the change go. `edited_on_exchange` for the command that changes a rule: marks the change, or (kept on this computer now) has the server delete its copy. - tests: stand-in round trip of a change (name, conditions, actions), an Outlook rule with unknown parts byte-identical through a change of another, refusals (unknown parts, IsNotSupported, not read whole, a flag, Outlook's copy), an EX sender read resolved and not, kept through a change of its rule and of another; engine upload, merge, answers and keeping here; the new readers in the proptests and the `ews` fuzz target. - catalogues re-wrapped by `cargo xtask i18n` (no text changed). Human-reviewed, AI-assisted, nobody's mailbox harmed.
Conflicts and how they were resolved: - crates/ews/src/reply.rs: both sides added a method to `Reply` at the same place; both kept (`response` from this branch, for Automatic Replies' answers that are not response-message lists, and main's `busy_with_nothing_done`). - docs/gaps.md: rows 16 to 18 conflicted only because neighbours moved. Main's rows 16 (encrypting and signing) and 18 (releases), this branch's row 17 (Automatic Replies for Exchange server accounts, UCSLabs#2110), which main had not changed. - crates/i18n/po/{cs,es,fr,he,hu,it,ja,ka,nl,pl,pt_BR,pt_PT,ro,sl,zh_CN}.po: main's catalogues taken, `cargo xtask i18n` run, then this branch's two new texts given their fuzzy drafts again in all 16 languages. Checked: no translation of main's is lost or changed, none of the branch's is lost (hu and ka have main's newer wording). - docs/gaps.md row 17 also names Zimbra accounts (new on main) among those without automatic replies. - docs/parity-checklist.md regenerated with `cargo xtask parity`. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Brings in feat/ews-auto-replies as it is after `UCSLabs#2110: merge main`, so this part is current with main too. Conflicts and how they were resolved: - crates/engine/src/cmd/mod.rs: main added `rules_budget_tests` where this branch added `rules_ews_tests`; both kept, in order. - docs/gaps.md: rows 16 to 18 conflicted only because neighbours moved. Main's rows 16 (encrypting and signing) and 18 (releases), and this branch's row 17, which is part 1's row 17 (unchanged by main) with the rules kept on an Exchange server added; it also names Zimbra accounts (new on main) among those without automatic replies, as part 1 does. - crates/i18n/po/*.po merged without conflicts; `cargo xtask i18n` run, then the new texts of both parts given their fuzzy drafts in all 16 languages. Checked: no translation of main's is lost or changed, none of the branch's is lost (hu and ka have main's newer wording). - docs/parity-checklist.md regenerated with `cargo xtask parity`. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Main's `cargo xtask text-part` (new since this branch began) counts every `.body` read whole as a message's text part read as it is. In crates/ews/src/rules.rs the three it found are a rule change's rule (`RuleOp::body`, as in crates/net/src/graph/rules.rs), not a message's: listed with that reason in xtask/text-part-readers.txt. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Main's `graphs_delete_past_the_retention_period_is_used_in_one_place_only` (apps/mailcraft-cli/tests/graph_changes.rs, UCSLabs#30 part 7) allows the name of that delete in one call site alone. A comment in crates/ews/src/rules.rs named EWS's rule action of the same name, to say it is not known here: it now says "deleting it for good" instead. No code changed. 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. |
Main's new Turkish catalogue (UCSLabs#1711) came after this branch's last merge of main, so the texts of Automatic Replies for Exchange server accounts, and four of main's own (saved searches in Favorites, UCSLabs#1306), had no Turkish entry and `cargo xtask i18n` failed on the merged state. They are drafts, marked fuzzy, as in the other catalogues. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Main's new Turkish catalogue (UCSLabs#1711) has no entry for the texts of rules kept on an Exchange server, so `cargo xtask i18n` failed on the merged state. They are drafts, marked fuzzy, as in the other catalogues. Human-reviewed, AI-assisted, nobody's mailbox harmed.
SonarCloud read `let _ = set.element().write();` in oof_tests.rs as a lock guard dropped at once and rated the new code's reliability C. It is a false positive: `soap::Element::write` turns a SOAP XML element into its text, there is no lock. The text now has a name (`_xml`), still unused, so the rule no longer fires; behaviour is unchanged. The same in the proptest that writes GetUserOofSettings. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Conflicts: - docs/ui-parity.md, the Backstage (File) row: main added Print and Save as PDF and its "No print preview"; this branch added Automatic Replies for an Exchange server account (UCSLabs#2110). Main's row with this branch's words about Automatic Replies. - crates/i18n/po/{cs,es,fr,he,hu,it,ja,ka,nl,pl,pt_BR,pt_PT,ro,sl,tr,zh_CN}.po: entries both sides added next to each other. Main's translation where both have one, this branch's entries and drafts added, then `cargo xtask i18n`. No translation of main's or of this branch's is lost; every catalogue is 100%. Human-reviewed, AI-assisted, nobody's mailbox harmed.
SonarCloud read `let _ = e.write();` in rules_tests.rs as a lock guard dropped at once and rated the new code's reliability C. It is a false positive: `soap::Element::write` turns a SOAP XML element into its text, there is no lock. The text now has a name (`_xml`), still unused, so the rule no longer fires; behaviour is unchanged. The same for the two lines after it that write a rule's element. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Brings part 1's merge of main (Print and Save as PDF, UCSLabs#32, and the rest) and its SonarCloud fix. Conflict: - docs/ui-parity.md, the Backstage (File) row: part 1 brought main's Print and Save as PDF and "No print preview"; this branch added where an Exchange server account's rules on the server stand, with Ask again. Part 1's row with this branch's clause about the rules. Catalogues merged without conflict; after `cargo xtask i18n` no translation of main's, part 1's or this branch's is lost, and every catalogue (tr included) is 100%. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Conflicts and how they were resolved: - crates/ews/src/lib.rs: main added the calendar module docs and standin_userconfig beside this branch's oof and standin_oof; both kept (standin_userconfig keeps its cfg line). - crates/ews/src/xml.rs: main added MAX_DICTIONARY_TEXT and the Value/Body/TextBody text caps beside this branch's MAX_MESSAGE_TEXT and its Message arm; both kept. - apps/mailcraft/src/ews_runner.rs: main's run_calendar and run_calendar_with, then this branch's run_auto_replies and run_auto_replies_with; imports of both. - apps/mailcraft/src/main.rs: main's calendar and JMAP host contexts and hooks, then this branch's automatic replies one. - crates/ui-egui/src/lib.rs: Services keeps main's ews_calendar and this branch's ews_auto_replies. - docs/gaps.md, docs/ui-parity.md: main's rows, with this branch's words for Exchange server accounts' automatic replies put into them. - crates/i18n/po/*.po: main's catalogues, `cargo xtask i18n`, then this branch's two texts' drafts put back; no translation of main's lost, and the five Turkish saved-search entries are now main's own. Human-reviewed, AI-assisted, nobody's mailbox harmed.
…ver accounts - A change the server took is said as made when the read after it fails: the EWS host chooses its line by whether the change went (auto_replies_result), as the Microsoft host does, so the trouble kept is a read's, never "Couldn't change"; and the status line says what was set, from the change, instead of what was known before it (both hosts). - A reply too long for a server is refused with the reason, never cut: MAX_REPLY_HTML is the 128 000 bytes the schema advises; account.setAutomaticReplies refuses a reply whose HTML is longer (REPLY_TOO_LONG), and so does OofSettings::with_change (Error::TooLarge, OofRun::refused). A server's plain reply written as HTML for showing stops before the character that would not fit, never inside a <br> or a reference. - The text cap of an automatic reply's Message applies inside InternalReply and ExternalReply only; any other element of that name keeps the cap every element has. - OofRun's Debug shows how the run went, never the replies. - The proptest of a change has times that can be read, so it reaches its body, and checks that the reply reads back as written and became no element. - A read that waits for the password says so in File › Info and in the dialog. - An online archive and an account without a usable server address get refusals of their own (ARCHIVE; the account's own "has no Exchange server address that can be used"), not the text for IMAP accounts, renamed NOT_SUPPORTED. Human-reviewed, AI-assisted, nobody's mailbox harmed.
`cargo xtask i18n`, and fuzzy drafts in all 17 catalogues of the refusal for an online archive and of the one for a reply too long for the server. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Brings in Automatic Replies for Exchange server accounts with the review's fixes (NOT_SUPPORTED, the scoped Message cap, MAX_REPLY_HTML 128 000) and main up to 5df5365, which has UCSLabs#1177 (rules.edit, a change sent part by part). Where the rules model clashed, main's is taken: this branch's own change counter (ServerRule::edited, RuleOp::edit, RuleOutcome::edit, the edit helper and the merge's keeping of an edit) is dropped; the EWS writer is moved onto RuleOp::parts in the next commit. Catalogues refreshed, the branch's translations kept. Human-reviewed, AI-assisted, nobody's mailbox harmed.
…'s rules.edit sends it The EWS host now takes main's RuleOp::Update with its parts (UCSLabs#1177): the server's copy of the rule, read just before, is written back whole with SetRuleOperation (EWS has no change of a part alone), the parts the change names taken from its body, IsEnabled and Priority where given, and every other part as the server gave it, byte for byte. A rule not read whole, with parts not known here, or IsNotSupported is still never rewritten; a part the server's rules can't hold is refused before anything is sent. Each outcome gives back the op's body and parts, so the engine's outcomes take what went, put a refused part back as the server has it, and drop a rule gone from the server. Outlook's own copy, directory names and Exchange's validation errors are as they were. Tests: one part written with the rest byte for byte, a switch and a move with it, a refused part given back, a rule gone; rules.edit on such an account sends its parts, a refusal and a gone rule come back through main's outcomes, a rule taken off the server is deleted there. Docs and fragments say a change goes part by part; exchange-servers.md lists the rules among what is not yet tried against a real server. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Up to 95bee53. Only tr.po clashed: main's taken, the catalogues refreshed with cargo xtask i18n, and this branch's Turkish drafts put back (none of main's translations lost, none of the branch's). Human-reviewed, AI-assisted, nobody's mailbox harmed.
… change's body The change written part by part reads its body's parts once more; that body is the rule a change carries (RuleOp::body), never a message's text part. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Contributor
Author
|
Reworked onto main's rule-editing model from #1177, now that it's merged. What changed:
|
|
This branch has not been deployed
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 #2255
Closes #2110 (part 2 of 2). Until the part before it is merged, this pull request also shows its commits; the rules are the commits after
#2110: merge part 1.What it does for the owner
An Exchange server account (on-premises Exchange reached over EWS) keeps its rules on its server, as a Microsoft account already does through Graph:
/o=…/cn=…) in a rule's senders or recipients are shown by their address, looked up in the address list.How it behaves
GetInboxRules/UpdateInboxRules([MS-OXWSRULES]).rules.editmodel (Reules edit #1177), the same as for a Microsoft account: the engine sends only the parts changed here (RuleOp::Updatewithparts: name, conditions, exceptions, actions), plus a switch or a move. This pull request has no edit path of its own.SetRuleOperationreplaces the whole rule). So each change goes by rule id, one at a time, and is written on the server's own copy of that rule, read just before. Only the parts the change names are written anew; every other part goes back byte for byte as the server gave it. Within a part that changed, a condition, exception, move or copy that is the same as on the server also goes back as the server gave it (a person's display name, a folder's change key). An Outlook rule with parts unknown here survives a change of another rule byte for byte.IsNotSupported) is never rewritten. A rule with unknown parts can still be switched, moved and deleted. AnIsNotSupportedrule is shown read-only.RuleNotFound, or missing from a complete read) deletes it here too, and says so.OutlookRuleBlobExists), the server takes no change unless that copy is removed. MailCraft then sends nothing and asks the owner first ("Outlook's Copy of the Rules"). The rules on the server stay and keep running either way. Only on a yes is the copy removed (RemoveOutlookRuleBlob), once, with the next change that goes. A question closed unanswered is a no; File › Info's rules line says where it stands and offers Ask again. Until then new rules and changes stay on this computer and run here.ui.removeOutlookRulesis classed as Delete, so an agent needs the owner's yes; changes to the server's rules need the owner as they do for a Microsoft account.Privacy
ResolveNames, at most 50 a job), on the same server.How it was tested
Fakes only, never a real mailbox:
mailcraft-ews: the reader and writer (hostile answers, a rule too long to read whole, validation errors); the in-process EWS stand-in answers both operations, held to the schema, with round trips of creating, switching, moving, deleting and changing a rule; a change of one part written with every other part byte for byte; a switch and a move with it; a part the server's rules can't hold refused and given back; a rule gone; an Outlook rule with unknown parts unchanged through a change of another; refusals (unknown parts,IsNotSupported, not read whole, Outlook's copy); a sender named by directory name, resolved and not, kept through changes; the readers in theewsfuzz target and the crate's property tests.rules.editon such an account sends its changes part by part, a refused part comes back as the server has it, a gone rule goes, a rule taken off the server is deleted there, an Outlook rule or a read-only one is never rewritten; main's rules tests pass unchanged; agent classes.cargo xtask cipasses.Catalogues refreshed with
cargo xtask i18n; the new texts have fuzzy drafts in all 16 languages. Docs: gap 17,docs/ui-parity.md,docs/exchange-servers.md(not yet tried against a real server), ROADMAP step 11, with their fragments (packaging/release-notes.d/new/2110-rules.md,docs/log.d/…/2110-rules.md).Human-reviewed, AI-assisted, nobody's mailbox harmed.