Skip to content

#851 follow-up: a stopped rename writes no more, and a change is never sent again by itself - #1812

Merged
benandez merged 1 commit into
UCSLabs:mainfrom
kartas39:851-follow-up-stop
Nov 28, 2026
Merged

benandez merged 1 commit into
UCSLabs:mainfrom
kartas39:851-follow-up-stop

Conversation

@kartas39

@kartas39 kartas39 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Follows #1715: the P3 note in the approving review, and one more of the same kind as that pull request's blocker. The issue is #851 (closed).

What changes for the person using MailCraft

  • Cancel of a Send/Receive while a category is being renamed on the server's mail now stops before the next changes go. Before, when it came while a batch of up to twenty messages was being read, those twenty were still changed, and when they were the last ones the Send/Receive didn't end as stopped.
  • A category I give a message or event in Outlook is no longer lost when the rename's change of that item got no answer, or the server put it off. Before, MailCraft sent the same change again after a wait of up to a minute, with the list of categories it had read before the wait. Now the item is left for the next run, which reads it again.
  • What wasn't changed gets the new name with the next Send/Receive, as after any Cancel.

How it was checked

Human-reviewed, AI-assisted, nobody's mailbox harmed.

Summary by CodeRabbit

  • Bug Fixes
    • Recategorization changes are now submitted only once per run. If a write is deferred or unsuccessful, it can be reconsidered during a later run using the latest item information.
    • When a run is cancelled during batched reads, pending changes are left unwritten and the run is reported as stopped. Runs with no pending changes can still complete normally.

…is never sent again by itself

- In batch mode the owner's stop is looked at between the batch of reads and the batch of
  changes: what was to be written waits for a later run, and the run is said to be stopped.
- A change of an item's categories is asked once. One that got no answer, or that a busy server
  put off, is left for a later run, which reads the item again, instead of being sent again
  with the list it was built from.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@kartas39
kartas39 requested a review from benandez as a code owner November 21, 2026 14:17
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The recategorization flow now uses one-time PATCH requests instead of Kind::Same. The batch path checks for cancellation after reads and before writes, then reports a stopped run when pending changes remain. Tests cover cancellation and nonzero write responses.

Changes: Recategorization flow

Layer / File(s) Summary
Cancellation and one-time writes
crates/net/src/graph/recategorize.rs, crates/net/src/graph/recategorize_tests.rs
The batch path checks cancellation after reads and marks pending changes Later if the run is stopped. The caller records the stop state. Batch and single-item PATCH requests use Kind::Once. Tests check that stopped runs do not write pending changes and that writes returning 503 are not resent from stale reads.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 636d6

Canceling a category rename now stops before the next batch of changes is written, and each change is sent only once per run. Unanswered or deferred changes wait for the next Send/Receive. No actionable merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two behaviours the PR changes: a stopped rename writes no more changes, and a change is no longer resent on its own. It also names the follow-up to #851. It is specific and matches…
Description check Passed The description follows the repository template. It gives the 'Closes' line with the related issue #851 and a note on the follow-up to #1715. It explains the user-visible changes and how the work was …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two behaviours the PR changes: a stopped rename writes no more changes, and a change is no longer resent on its own. It also names the follow-up to #851. It is specific and matches the raw summary and objectives. It does not cover the test additions, but that is expected.

Full details: Description check

Explanation

The description follows the repository template. It gives the 'Closes' line with the related issue #851 and a note on the follow-up to #1715. It explains the user-visible changes and how the work was checked, with the test file and the failing-on-main evidence. The checklist items are present and ticked. The 'Closes #' line is left as the issue reference #851 is only named in prose, so the link is not formal. The template's 'Builds on' note does not apply here, since the PR is a follow-up rather than a multi-part feature. Overall the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 98e5305 and 636d6b1.

Files selected for processing: 2

  • crates/net/src/graph/recategorize.rs
  • crates/net/src/graph/recategorize_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@sonarqubecloud

Copy link
Copy Markdown

@omg-review-bot omg-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review of 636d6b1

The production change reads correctly from the diff: the stop flag is checked between the read and write $batches, items cut by a stop are left as Said::Later rather than written, and both write paths now ask once (Kind::Once) so a deferred or unanswered change is re-read on a later run instead of being replayed with a stale category list. I found no defect in the rename logic itself; the only issues are in how one of the new tests proves its case and a small redundancy in the new module doc text.

No issues found.

✅ Approved: no unresolved findings at [P2] MAJOR or above.

2 lower-priority or previously reported findings were omitted.

Model deepseek-v4.1-flash:cloud · skill code-change-review · 2 files reviewed. Reply to an inline comment to discuss it.

@benandez benandez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kartas39, approving. The stop check now sits between the reads and the writes, items about to be written become "later", and a stopped run ends without counting as done. Both new tests are good. CI green on all three platforms.

Optional: writes now use Kind::Once, so a connection error before the request left is no longer retried inside the run. It becomes "stuck" and counts toward MAX_RENAME_TRIES (10) when the run changed nothing. On a very flaky network that could give a rename up sooner than before. Seems a fair price for avoiding the stale-list overwrite.

@benandez
benandez added this pull request to the merge queue Nov 28, 2026
Merged via the queue into UCSLabs:main with commit 9a24558 Nov 28, 2026
18 checks passed
@kartas39
kartas39 deleted the 851-follow-up-stop branch November 29, 2026 10:14
benandez added a commit that referenced this pull request Nov 29, 2026
…tch translations

Human-reviewed, AI-assisted, nobody's mailbox harmed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants